Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

using c++ Building Person carExp Car 1) Based on the following UML class diagram, write the header on (Building.h) file and the implementation on (BuildingImp.cpp)

image text in transcribed image text in transcribedimage text in transcribed using c++

Building Person carExp Car 1) Based on the following UML class diagram, write the header on (Building.h) file and the implementation on (BuildingImp.cpp) file for the Building class. Building -address: string -numofFloors: int -area: double + Building() + Building (string, int, double) setBuilding Info (string, int, double): void + printInfo() : void Functions Description for Building class: 1) A default constructor to set appropriate values for the private members. 2) A constructor that takes 3 parameters and sets them to the following members: the address, the numOfFloors and the area. 3) setBuildingInfo: that takes 3 parameters and sets them to the following members: the address, the numOfFloors and the area. 4) printInfo function that prints all information about the building: the address, the numOfFloors and the area. 2) Based on the following UML class diagram, write the header on (Person.h) file and the implementation on (PersonImp.cpp) file for the Person class. Person -name: string -nationality: string -age: int -gender: char + Person() + Person (string, string, int, char) set Person Info (string, string, int, char): void + printInfo(): void Functions Description for Person: 1) A default constructor to set appropriate values for the private members. 2) A constructor that takes 4 parameters and sets them to the following members: the name, the nationality, the age and the gender. 3) setPersonInfo: that takes 4 parameters and sets them to the following members: the name, the nationality, the age and the gender. 4) printInfo function that prints all information about the person: the name, the nationality, the age and the gender. 3) Based on the following UML class diagram, write the header on (Car.h) file for the Car struct. - Car + type: string + color: string + year: int + price: double 4) Write the header on (carExp.h) file and the implementation on (carExpImp.cpp) file of the new class carExp which publically inherits the properties of the Building class with the following additional members as shown in the below UML class diagram. carExp -name: string -maxNumofCars int -numofCars int -c: Car + owner: Person + carExp (string, int, double, string, string, int,char, string, int) + carExp (carExp&) + -carExp() + getMaxNumOfCars(); int + getNumOfCars(): int + isFull(): bool + isEmpty(): bool + insertCar(string, string, int, double): void + printAllCars():void + allCarsPrices(): double + searchCarPrice (double): void + printInfo():void Functions Description for carExp: 1) A constructor that takes 9 parameters and sets them to the following members: the address, the numOfFloors and the area for the building, the name, the nationality, the age and the gender for the owner and the name and the maxNumOfCars for the car exhibition. Also, it sets the numOfCars to zero (length). Then, builds a dynamic array of size maxNumOfCars of type Car by using the c pointer. 2) carExp(carExp &):a copy constructor to avoid shallow copying 3) -carExp(): Destructor will delete the dynamic array and print the following statement "The car exhibition is closed". 4) getMaxNumOfCars(): return the maximum number of cars in the exhibition. 5) getNumOfCars(): return the number of cars in the carray. Car 6) isEmpty(): return true if the car list has no elements else return false 7) isFull0:return true if the car list is full else return false 8) insert(string,string, int double): a void function that inserts a new car to the list. (Remember that you can't insert if the car list is full). 9) printAllCars(): a void function to print all information about the car with the following format. Type Color Year Price Toyota BMW Ferrari Black Silver Red 2010 2012 2011 13000JD 30000JD 50000JD 10) allCars Prices: a function that computes and returns the summation of all prices for all cars in the exhibition. 11)searchCarPrice(double): a void function that prints all information for all cars that have a price less than the parameter value. 12)printInfol: a void function that prints all information for the car exhibition. Exipition name: Just Address: Amman Number of floors: 3 Area: 5000 Owner Name: Amr Owner Nationality: Jordinian Owner Age: 50 Owner Gender: M Number of cars in this exipition: 3 Type Color Year Price Toyota BMW Ferrari Black Silver Red 2010 2012 2011 13000JD 30000JD 50000JD in the main 1) Declare an object of type carExp (el) with the following values: ("Amman",3,5000,"Amr","Jordinian",50,'M',"Just",20). 2) Prompt the user to enter 3 cars information (type, color, year and price) then insert them to the car list using loop structure with cin statement. 3) Prompt the user to enter a price then prints the information for all cars that have price less than the entered value. 4) Print the summation of all prices for en. 5) Print all information about the object e1. 6) Declare a new dynamic object of type carExp (using the pointer (e2)) using the values of e1. 7) Print just the owner information for the object that e2 points to. 8) Set the following values to the building for the object that e2 points to ("Irbid", 4, 1000)

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

More Books

Students also viewed these Databases questions

Question

=+3 In what ways can an MNE improve or change its approach to IHRM?

Answered: 1 week ago