Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

//Form1.cs using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using PropertyClasses; namespace Lab_3___RentProperty { public

image text in transcribedimage text in transcribed

//Form1.cs

using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using PropertyClasses;

namespace Lab_3___RentProperty { public partial class Form1 : Form { Rent rent; string type; public Form1() { InitializeComponent(); AcceptButton = btnBuy; CancelButton = btnClear; radTown.Checked = true; }

private void btnBuy_Click(object sender, EventArgs e) { int beds = 0; double baths;

//for number of beds if (rad1room.Checked) beds = 1; else if (rad2rooms.Checked) beds = 2; else if (rad3rooms.Checked) beds = 3; else beds = 4;

//for num of baths if (rad1Bath.Checked) baths = 1; else if (rad1AndHalfBath.Checked) baths = 1.5; else if (rad2andhalfbath.Checked) baths = 2.5; else baths = 2;

rent = new Rent(txtFName.Text, txtLName.Text, type, beds, baths);

lblDisplayRent.Text = " " + rent.ToString() + "!!"; btnClear.Focus(); }

private void btnClear_Click(object sender, EventArgs e) { txtFName.Text = string.Empty; txtLName.Text = string.Empty; rad1room.Checked = true; rad1Bath.Checked = true; radTown.Checked = true; lblDisplayRent.Text = string.Empty; txtFName.Focus(); }

private void btnExit_Click(object sender, EventArgs e) { Close(); }

private void radTown_CheckedChanged(object sender, EventArgs e) { type = radTown.Text.TrimStart(new char[] { '&' }); rad4Rooms.Enabled = false; }

private void radSemi_CheckedChanged(object sender, EventArgs e) { type = radSemi.Text.TrimStart(new char[] { '&' }); rad4Rooms.Enabled = true; }

private void radDetached_CheckedChanged(object sender, EventArgs e) { type = radDetached.Text.TrimStart(new char[] { '&' }); rad4Rooms.Enabled = true; } } }

//Buyer.cs

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks;

namespace PropertyClasses { public class Buyer { private string firstName; private string lastName;

public string FirstName { get { return firstName; } set { firstName = value; } }

public string LastName { get { return lastName; } set { lastName = value; } }

public Buyer(string fName, string lName) { FirstName = fName; LastName = lName; }

public override String ToString() { return "Thank you " + FirstName + " " + LastName; } } }

//Property.cs

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks;

namespace PropertyClasses { public class Property { public int NumOfBedrooms { get; set; } public double NumOfBathrooms { get; set; } public string TypeOfHouse { get; set; } private const int BEDPRICE = 300; private const int BATHPRICE = 75; private const double TOWN_COST = 500; private const double SEMI_COST = 700; private const double DETACHED_COST = 1000; public double Cost { get; set; }

public Property(int beds, double baths, string type) { NumOfBedrooms = beds; NumOfBathrooms = baths; TypeOfHouse = type;

switch (TypeOfHouse) { case "Town": Cost = TOWN_COST; break; case "Semi-Detached": Cost = SEMI_COST; break; case "Detached": Cost = DETACHED_COST; break; } } public double CalculateRent() { return (NumOfBedrooms * BEDPRICE) + (NumOfBathrooms * BATHPRICE) + Cost; }

public override string ToString() { return " You have rented a " + TypeOfHouse + " house with " + NumOfBedrooms + " bedroom(s) and " + NumOfBathrooms + " bathroom(s) for the monthly rent of " + CalculateRent().ToString("c"); } } }

//Rent.cs

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks;

namespace PropertyClasses { public class Rent { public Buyer Buyer { get; set; }

public Property MyProperty { get; set; }

//constructor version for house public Rent(string fName, string lName, string type, int beds, double baths) { Buyer = new Buyer(fName, lName); MyProperty = new Property(beds, baths, type); }

public override string ToString() { return Buyer.ToString() + MyProperty.ToString(); } } }

Use your finished solution for Lab 5 and change the design to accommodate another type of property: Condominium. Design a system for users to input their names and other details (as in Lab 5) and select a condominium with or without amenities from a combo box or a type of house from another combo box. If a customer chooses Condominium as a property of interest, then he/she can choose how many beds and baths (max. beds are 2 and max. baths are 1.5) they want and also whether they want amenities or not. Amenities are general facilities and services like swimming pools, gym, party rooms, visitor parking and many more that are available for the use of residents. Here is the price list. Base condominium price = $600 Amenities = $150 Beds and baths = same amount as in lab 5 X Property for Rent Amit Braich Property for Rent Bonn First Name Tige di Prat Condomu Condor Type dl Propery Condom Buy House Cear Lastne 22 Last Name Tom Home Condomu |Without rate Ithout me Seached Beled Be dedicams Roon O2 Roons 4 Rooms of Baths Bed and Bath of Bedrooms 1 Room Roone dah . 015 02 025 015 This time you should be using inheritance. Think about common fields and methods among house and condominium objects. You may need to make some changes to Property class. Use Lab 5 as a starting point. Add radio buttons to control the activation of the correct set of controls for the type of property the user wants to choose. If you choose Condominium, maximum availability for number of beds and baths is 2 and 1.5 respectively. Check the screen shot. Also add a combo box to your form to allow the user to select amenities option from a drop down list. Add another combo box to allow the user to select the type of house - town, semi or detached. Once the customer is done with filling the details and options for property lookup, a label should display the customer and property details along with total rent. CPAN 151 C#.NET Amrit Braich - X Property for Rent Buyer's Information First Name: Kate Type of Property Condominium Buy House Clear Last Name: Eylles Condominium With amenities House Town House Exit # of Baths 01 Thank you Kate Eyles You have rented Condominium(With amenities) with 2 bedrooms and 1.5 bathrooms for the monthly rent of $1.462.50!! Beds and Baths # of Bedrooms 1 Room 2 Rooms 3 Rooms 4 Rooms 1.5 2 25 - You'll need to modify your Class Library to accommodate this new type of property. - Use a combo box and set the DropDownStyle property to 'DropDownLis. - Use an if statement or switch case to determine whether amenities are chosen or not. - Make sure you follow the GUI design guidelines on this assignment. That means accelerators, tab stops. - Use our naming conventions for all controls, variables and constants. - Be sure to include comments. - Code formatting is also worth marks. Challenge - Have the combo boxes display the first item when the form first runs. Use your finished solution for Lab 5 and change the design to accommodate another type of property: Condominium. Design a system for users to input their names and other details (as in Lab 5) and select a condominium with or without amenities from a combo box or a type of house from another combo box. If a customer chooses Condominium as a property of interest, then he/she can choose how many beds and baths (max. beds are 2 and max. baths are 1.5) they want and also whether they want amenities or not. Amenities are general facilities and services like swimming pools, gym, party rooms, visitor parking and many more that are available for the use of residents. Here is the price list. Base condominium price = $600 Amenities = $150 Beds and baths = same amount as in lab 5 X Property for Rent Amit Braich Property for Rent Bonn First Name Tige di Prat Condomu Condor Type dl Propery Condom Buy House Cear Lastne 22 Last Name Tom Home Condomu |Without rate Ithout me Seached Beled Be dedicams Roon O2 Roons 4 Rooms of Baths Bed and Bath of Bedrooms 1 Room Roone dah . 015 02 025 015 This time you should be using inheritance. Think about common fields and methods among house and condominium objects. You may need to make some changes to Property class. Use Lab 5 as a starting point. Add radio buttons to control the activation of the correct set of controls for the type of property the user wants to choose. If you choose Condominium, maximum availability for number of beds and baths is 2 and 1.5 respectively. Check the screen shot. Also add a combo box to your form to allow the user to select amenities option from a drop down list. Add another combo box to allow the user to select the type of house - town, semi or detached. Once the customer is done with filling the details and options for property lookup, a label should display the customer and property details along with total rent. CPAN 151 C#.NET Amrit Braich - X Property for Rent Buyer's Information First Name: Kate Type of Property Condominium Buy House Clear Last Name: Eylles Condominium With amenities House Town House Exit # of Baths 01 Thank you Kate Eyles You have rented Condominium(With amenities) with 2 bedrooms and 1.5 bathrooms for the monthly rent of $1.462.50!! Beds and Baths # of Bedrooms 1 Room 2 Rooms 3 Rooms 4 Rooms 1.5 2 25 - You'll need to modify your Class Library to accommodate this new type of property. - Use a combo box and set the DropDownStyle property to 'DropDownLis. - Use an if statement or switch case to determine whether amenities are chosen or not. - Make sure you follow the GUI design guidelines on this assignment. That means accelerators, tab stops. - Use our naming conventions for all controls, variables and constants. - Be sure to include comments. - Code formatting is also worth marks. Challenge - Have the combo boxes display the first item when the form first runs

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

Explain the strength of acid and alkali solutions with examples

Answered: 1 week ago

Question

Introduce and define metals and nonmetals and explain with examples

Answered: 1 week ago

Question

Are robots going to displace all workers? Explain your answer.

Answered: 1 week ago