probably something INCREDIBLY easy haha but i am having so much trouble trying to figure out the code i would need to write to get the GetArea calculation to be wrote to a file here is some of the code all help appreciated :)
using System;
using System.IO;
namespace system
{
class Rectangle
{
private double length;
private double width;
public void GetDetails()
{
Console.WriteLine("Enter Length: ");
length = Convert.ToDouble(Console.ReadLine());
Console.WriteLine("Enter Width: ");
width = Convert.ToDouble(Console.ReadLine());
}
public double GetArea()
{
return length * width;
}
public void Display()
{
Console.WriteLine("Length: {0}", length);
Console.WriteLine("Width: {0}", width);
Console.WriteLine("Area: {0}", GetArea()); // this is what i need to be wrote to the file
}
public void WriteToFile()
{
//this is the method where i need to find out the code to get the the getarea to write to the file
}
}
class CalculateRectangle
{
static void Main(string[] args)
{
Rectangle r = new Rectangle();
r.GetDetails();
r.Display();
r.WriteToFile(); //this is the main method in which i need the area of the rectangle to be wrote to the file
Console.ReadLine();
}
}
}