예제 #1
0
        // Write the default parameterless contructor and another version that sets
        // the year, address, price, income and expanse

        public override string ToString()
        {
            return("Street Address: " + Address + "\n"
                   + "Year built: " + Year + "\n"
                   + "Purchase price: " + PurchasePrice.ToString("C") + "\n"
                   + "Income rent: " + IncomeFromRent.ToString("C") + "\n"
                   + "Montly expense: " + MontlyExpense.ToString("C") + "\n"
                   + "Montly earning: " + MontlyEarnings.ToString("C"));
        }
예제 #2
0
        public override string ToString()
        {
            //this method must return a string
            string outputStr = "Street Address: " + Address + "\n"
                               + "Year Built: " + Year + "\n"
                               + "Purchase Price: " + PurchasePrice.ToString("C") + "\n"
                               + "Income From Rent: " + IncomeFromRent.ToString("C") + "\n"
                               + "Monthly Expense: " + MonthlyExpense.ToString("C") + "\n"
                               + "Monthly Earnings: " + MonthlyEarnings.ToString("C");

            return(outputStr);
        }