abzstarboy
New member
- Joined
- Nov 12, 2019
- Messages
- 3
- Programming Experience
- Beginner
C#:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Midexampractice
{
public class House
{
public static void Main(string[] args)
{
double length;
double width;
double area;
public House(double l, double w)
{
length = l;
width = w;
}
public double ShowData()
{
area = length * width;
Console.WriteLine("I am a house, my area is " + area + "m2.");
}
public class testhouse
{
double length;
double width;
Console.WriteLine("Enter the length");
double l = double.Parse(Console.ReadLine());
Console.WriteLine("Enter the Width");
double w = double.Parse(Console.ReadLine());
House h = new House(length, width)
h.ShowData();
}
}
}
Last edited by a moderator: