Question: Note/ I need the code in C++ Language please ! Question: Write a C++ program that has following classes: Really lance . 2 Clem uchy





Note/ I need the code in C++ Language please !
Question: Write a C++ program that has following classes: Really lance . 2 Clem uchy string Reaty Constructor 19-int setricain pricevo Taxi)int setTaxit favold Calcul ce vroid Calculate Taxoval vos getirtual vold witu od home land con bodean numberchcom CRC PRO Caculalei word -gelinput Void panti) void home default cod shop - Caterice!) void -Caltext void -geinpulv printa syaratons gelincement come come into -moede bolan and of const caloid Calculadou getinulowa pringvold Realty Class: This is the abstract base class. It has following structure: Class variables: . price: Price of realty. . m2: Total m2 of realty. . tax: Annual tax of realty. city: City of Realty Class Functions: Realty(): In this constructor function, you may initialize variables of your object. . getPrice(): This function returns the price. setPrice(int_price): Changes the value of price. CENG 241 LAB WORKS getTax(): This function returns the tax. setTax(int _tax) Changes the value of tax. . virtual void CalculatePrice()=0: This virtual function is only defined as a prototype for sub classes. In sub classes it will calculate the price according to some rules. . virtual void Calculate Tax()=0: This virtual function is only defined as a prototype for sub classes. In sub classes it will calculate the tax according to some rules. . virtual void getInput()=0: This function gets inputs from the user. Its only defined as a prototype in the abstract class. Then, in the sub classes it will be overloaded. virtual void print(): This function prints class variables to give information. You may write a print function in your cpp file too or you may leave it undeclared if you define your function in the format "virtual void print()=0". Home Class: This is a child class inherited from abstract "Realty Class". It has following structure: Class variables: . numberofrooms: number of rooms that home has. C balcony: boolean Class Functions: . home(): Default constructor of home class. You may initialize class variables in this function. . getInputs(): In this function, program gets inputs from the user for the variables of abstract parent class and also home class. . CalculateTax(): In this function, program calculates the annual tax for home. While calculating tax, program should consider the m2 and location of home. Possible cities: New York, Los Angeles, Miami, Denver, Utah. Formula: i. New York: 1.75 ii. Los Angeles: 1.70 CENG 241 LAB WORKS Miami: 1.60 iv. Denver: 1.2 V. Utah: 1.4 Annual Tax=total m2 of the house x 10 x location value. Calculate Price(): In this function, program calculates the price of home according to the given formula: Price- total m2 of the house x 1000 x location value x number of rooms 4 Print(): In this function, you will print tax, price, m2, city, number of rooms and balcony information of the home. land Class: This is a child class inherited from abstract "Realty Class". It has following structure: Class variables: . Improved_area: This is a boolean variable that is true if land is in improved area. Class Functions: land(): This is default constructor of the class. You may initialize class variable improved_area in this function, CalculatePrice(): In this function, program should calculate the price of land according to the given formula: i. New York: 1.75 ii. Los Angeles: 1.70 iii. Miami: 1.60 iv. Denver: 1.2 V. Utah: 1.4 Price= m2 of the land x 500 x location value. CENG 241 LAB WORKS Calculate Tax(): In this function, program should calculate the tax of land according to the given formula: Tax= m2 of the land * 5 * location value. getInputs(): In this function, program gets inputs from the user for the variables of abstract parent class and also land class. . Print(): In this function, you will print tax, price, m2, city and improved area information of the land. shop Class: This is a child class inherited from abstract "Realty Class. It has following structure: Class variables: . income: This is an int variable that stores the income of shop. Class Functions: . shop(): This is default constructor of the class. You may initialize class variable income in this function. . CalculatePrice(): In this function, program should calculate the price of shop according to the given formula: Price= income of shop x 100. Calculate Tax(): In this function, program should calculate the tax of shop according to the given formula: Tax= income of shop x 1.25. getInputs(): In this function, program gets inputs from the user for the variables of abstract parent class and also shop class. Print(): In this function, you will print tax, price, m2, city and income information of the shop. CENG 241 LAB WORKS Main Class and Functions: You should define an array of object from the abstact parent class so that you will apply polymorphism. You may define size of array as "3". There are some functions you need to define in your main class: . int totalTax(realty **obj,int n): This function takes object as type of abstract base class "realty" so that it may work with all kind of classes that are inherited from abstract base class. Then, it will calculate the total tax of objects that exists in the array. . int totalPrice(realty **obj,int n): This function takes object as type of abstract base class "realty" so that it may work with all kind of classes that are inherited from abstract base class. Then, it will calculate the total price of objects that exists in the array. LOVE --------------------shop-- enter monthly income: 9500 enter m2: 450 enter city: Los Angeles --------------Land ---- ------ is land in an improved area? (yes or no) yes enter m2: 550 enter city: Miami ------------Home enter number of rooms: 5 does home have a balcony? (yes or no) yes enter m2: 200 enter city: Denver -----------Shop Info m2: 450 city: Los Angeles income: 9500 price: 9500005 tax: 118755 ----------------Land Info- m2: 550 city: Miami improved_area: 1 price: 440000s tax: 52805 -------Home Info-- m2: 200 city: Denver number of rooms: 5 balcony: 1 price: 300000$ tax: 2400$ ---------------TOTALS-- total price: 16900005 total tax: 195555 -------- Process exited after 47.57 seconds with return value o Press any key to continue
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
