static void Main(string[] args) { WriteLine("Lec5: Real Estate Investment Demo"); GetPropertyInfo(out string address, out int year, out double purchasePrice); //now, you can create the RealEstate object RealEstate myRealEstate = new RealEstate(year, address, purchasePrice); myRealEstate.IncomeFromRent = 1965.99; //you can get this from user myRealEstate.MonthlyExpense = 789; //you can get this from user //myRealEstate.MonthlyEarnings = 501.00; //cannot set value of read-only property MonthlyEarnings WriteLine("The details of the real estate you entered are..."); WriteLine(myRealEstate); //note you say WriteLine(object/instance); automatically calls ToString() //Call the GetIncomeAndExpense method with out arguments for income and rent //Set the IncomeFromRent and MonthlyExpense properties of myRealEstate object //WriteLine the object to see if the user values are displayed right GetIncomeAndExpense(out double incomeA, out double expenseA); WriteLine("The details of the real income and expenses you entered..."); myRealEstate.IncomeFromRent = incomeA; myRealEstate.MonthlyExpense = expenseA; //WriteLine("{0}", myRealEstate.IncomeFromRent); //WriteLine("{0}", myRealEstate.MonthlyExpense); WriteLine(myRealEstate); //Write 5 parameter version of the constructor in the class - address, year, price, income, expense //Write a method in the Main program that gets user input for all these returns a string corresponding //to the address, and sets out parameters for year, price, income and expense //Call this method to get all values from user and creates object using the 5-parameter constructor GetAllParameters(out string stAddress, out int yearBuilt, out double price, out double income, out double expense); RealEstate rE = new RealEstate(yearBuilt, stAddress, price, income, expense); Console.WriteLine(rE); }
static void Main(string[] args) { WriteLine("Lec5: Real Estate Investment Demo"); GetPropertyInfo(out string address, out int year, out double purchasePrice); //now, you can create the RealEstate object RealEstate myRealEstate = new RealEstate(year, address, purchasePrice); myRealEstate.IncomeFromRent = 1965.99; //you can get this from user myRealEstate.MonthlyExpense = 789; //you can get this from user //myRealEstate.MonthlyEarnings = 501.00; //cannot set value of read-only property MonthlyEarnings WriteLine("The details of the real estate you entered are..."); WriteLine(myRealEstate); //note you say WriteLine(object/instance); automatically calls ToString() //Call the GetIncomeAndExpense method with out arguments for income and rent GetIncomeAndExpense(out double incomeFromRent, out double monthlyExpense); //Set the IncomeFromRent and MonthlyExpense properties of myRealEstate object myRealEstate.IncomeFromRent = incomeFromRent; myRealEstate.MonthlyExpense = monthlyExpense; //WriteLine the object to see if the user values are displayed right WriteLine("After the user entered income and expense is updated, the details of the real estate investment is..."); WriteLine(myRealEstate); //Write a method in the Main program that gets user input for all these returns a string corresponding string newAddress = GetRealEstateDetails(out int newYear, out double price, out double income, out double expense); //to the address, and sets out parameters for year, price, income and expense //Call this method to get all values from user and creates object using the 5-parameter constructor RealEstate myRealEstate2 = new RealEstate(newYear, newAddress, price, income, expense); WriteLine("Details of the new real estate -object created with 5 parameters"); WriteLine(myRealEstate2); }
static void Main(string[] args) { WriteLine("Lec5: Real Estate Investment Demo"); GetPropertyInfo(out string address, out int year, out double purchasePrice); //now, you can create the RealEstate object RealEstate myRealEstate = new RealEstate(year, address, purchasePrice); WriteLine("The details of the real estate you entered so far are..."); WriteLine(myRealEstate); //note you say WriteLine(object/instance); automatically calls ToString() //Update the income and expense for that object //using method call //Display the object after the update }