Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Example : #include #include #include using namespace std; // The Location class holds general data about the location class Location { public: }; // The

image text in transcribedimage text in transcribedimage text in transcribed

Example :

#include #include #include using namespace std;

// The Location class holds general data about the location class Location { public: };

// The House class holds general data about the location class House { private: protected: public: // Default constructor House() {

} // Constructor // Accessors

};

// The Bungalow class represents a bungalow class Bungalow : { private: public: // Default constructor // Constructor #2 // Accessor for deriveType attribute

//Display the houses for rent

};

// The Apartment class represents an apartment class Apartment { private: public: // Default constructor // Constructor #2 // Accessor for deriveType attribute //Display the houses for rent

};

int main() {

system ("pause"); return 0; }

Do It In C++ Language Code

Question: Suppose you are hired to develop a program for a rental house agent. The system is used to advertise all houses for rent. The rental houses include two types of houses: bungalow and apartment houses. Location House -street: string - no Room : int; -town: string #rentRate : double +Location (string" ", string") +House) + getStreet(): string + House Location, int, double) + getTown(): string + getLocation():string +getFullLocation(): string + getRoom():int + getRate(): double + getDeposit(): virtual double + display(): virtual void Bungalow -land : int +Bungalow Bungalow(Location *, int, double, int) +getLand():int + getDeposit(): double + display() : void Apartment -level:int +Apartment +Apartment(Location *, int, double, int) +getFLevel(:int + getDeposit(): double + display:void Figure 1. UML Class Diagram 1. Given the class diagram in Figure 1, write C++ program based on the diagram. Note that, the purpose of each operation is as its name implies. Define class Location, class House, class Bungalow and class Apartment with attributes and methods as shown in the class diagram. Class House has pure virtual function, namely getDeposit() and display(). The deposit for Bungalow is 6 months rent amount while the deposit for Apartment is 3 months rent amount. The information for Apartment and Bungalow to be displayed in display() function are as shown in Figure 2. 2. Define main() program with the following implementation: Define one Bungalow instance with values as shown in the output in Figure 2. Define two Apartment instances with values as shown in the output in Figure 2. Display the information of all the houses for rent as shown in the Figure 2. HOUSE FOR RENT We have a bungalow located at Eco Botanic , Nusajaya with 6 bedrooms Land size : 1200 sqft. Monthly rental rate: RM2400.00 Deposit : RM1 4400.00 We have an apartment located at Meridin, Medini with 3 bedrooms, at level 5. Monthly rental rate: RM1000.00 Deposit : RM3000.00 We have an apartment located at Meridin, Medini with 2 bedrooms, at level 2. Monthly rental rate: RM700.00 Deposit : RM2100.00 Figure 2. Expected Output

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

Recommended Textbook for

Database Design Using Entity Relationship Diagrams

Authors: Sikha Saha Bagui, Richard Walsh Earp

3rd Edition

103201718X, 978-1032017181

More Books

Students also viewed these Databases questions

Question

Define organisational structure

Answered: 1 week ago

Question

Define line and staff authority

Answered: 1 week ago

Question

Define the process of communication

Answered: 1 week ago

Question

Explain the importance of effective communication

Answered: 1 week ago

Question

* What is the importance of soil testing in civil engineering?

Answered: 1 week ago