BCS2Workshop 5Object Oriented Programming - Inheritance in C++: Inheritance is a powerful feature of OO programming. In an inheritance hierarchy, all attributes and operations are inherited from...

1 answer below »
Please do the assignment with full concentration this assignment is very much important. I have already uploaded the files


BCS2 Workshop 5 Object Oriented Programming - Inheritance in C++: Inheritance is a powerful feature of OO programming. In an inheritance hierarchy, all attributes and operations are inherited from a super class to all of its subclasses. Thus, inheritance is very important for code reuse. Task: A system is required for property management game. In the game you need to make a decision quickly on whether to buy or sell properties. The system needs to keep track of properties for sale. The information recorded for each property includes address, number of rooms, condition and asking price. The model covers two kinds of property: flats and houses. Additional information for a flat includes years remaining on lease, and for a house a “type” attribute to say whether the house is detached, semi-detached or terraced. An object oriented model of this will make use of: · A base class property, with the relevant member data, such as address, number of rooms, condition and asking price. A constructor performing the setting up (input) of property’s address, number of rooms etc. and some functions such as buy and sell, and others for getting address, number of rooms, the asking price etc. · Two derived classes house and flat for different types of properties, which inherits from class property, and each with a constructor; one for entering the type of the house, and the other say for entering the number of years on lease for flats. The two classes will have their get functions as well as different implementation, but with the same name, of a function for working out the commission to be paid, 2.5 % of sale price for houses and 2% for flats. (1) Write C++ code to declare the classes property, house and flat. (2) Write C++ code to implement all the functions named above. (3) Write two C++ codes for main program to test the above functions, the first code for a main program using automatic objects and the second using dynamic objects. In the first implementation you should: (i) Initiate two objects of houses, flat. (ii) use the (.) operator to invoke all the required functions and getting the results, which should include the sold property address, price, and working out the commission for each object. In the second implementation you should do the following: (i) Declare pointers to the two classes house and flat. (ii) Use the new and delete operators to create and destroy objects. (iii) Use the arrow (->) operator to invoke all the required functions and getting the results, which should include the sold property address, price, and working out the commission for each object. Gaming Aspects · Interaction and engagement with the player (user). · Ask the player if they are buyers or sellers, check for the asking price and offer price and make a decision about the sale. · Example play against computer generated offers. · Player makes an offer for a property, which is compared against a computer generated offer using random number generator (Check workshop 1 and workshop2). · The highest offer wins the property. · Repeat the same for several properties, the one with highest number of acquired properties win the game · You can use an array of houses with flats and houses. · You can play until there are no more houses or flats. You are free to make your own game rule
Answered 1 days AfterFeb 06, 2023

Answer To: BCS2Workshop 5Object Oriented Programming - Inheritance in C++: Inheritance is a powerful...

Ashutosh Sanjay answered on Feb 07 2023
31 Votes
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here