Hi,
I keep getting an error message when I try to call the below methods and show output them in the console.WriteLine method. Please have a look:
using System;
namespace ConsoleApplication1
{
class Building
{
int floor;
int occupants;
int area;
public Building(int f, int o, int a)
{
floor = f;
occupants = o;
area = a;
}
public int areaPerPerson()
{
return area / occupants;
}
public int maxOccupants(int minArea)
{
return area / minArea;
}
}
class Test
{
public static void Main()
{
Building office = new Building(20, 1200, 15000);
Building house = new Building(3, 4, 1500);
Console.WriteLine("Each person in the office will be provided with an area of {0}", office.areaPerPerson);//problem here
Console.WriteLine("Each person in the house will be provided with an area of {0}", house.areaPerPerson); //problem here
Console.WriteLine("The maximum number of occupants in the office is {0}", office.maxOccupants(20));//problem here
Console.WriteLine("The maximum number of occupants in the office is {0}", house.maxOccupants(20));//problem here
}
}
}
I keep getting an error message when I try to call the below methods and show output them in the console.WriteLine method. Please have a look:
using System;
namespace ConsoleApplication1
{
class Building
{
int floor;
int occupants;
int area;
public Building(int f, int o, int a)
{
floor = f;
occupants = o;
area = a;
}
public int areaPerPerson()
{
return area / occupants;
}
public int maxOccupants(int minArea)
{
return area / minArea;
}
}
class Test
{
public static void Main()
{
Building office = new Building(20, 1200, 15000);
Building house = new Building(3, 4, 1500);
Console.WriteLine("Each person in the office will be provided with an area of {0}", office.areaPerPerson);//problem here
Console.WriteLine("Each person in the house will be provided with an area of {0}", house.areaPerPerson); //problem here
Console.WriteLine("The maximum number of occupants in the office is {0}", office.maxOccupants(20));//problem here
Console.WriteLine("The maximum number of occupants in the office is {0}", house.maxOccupants(20));//problem here
}
}
}