CIS247C Project Week 5 of 7 – Hybrid Class – Vistual studio code, document and screenshot – Perfect Solution – Instant Delivery
Project Week 5 of 7: Inheritance
SUMMARY
The objective this week is to enhance last week’s Vehicle class by creating the Hybrid class which inherits the Vehicle class. The Hybrid class has all the same attributes as the Vehicle class except it has an additional attribute to describe the range of the battery.
Download the instructions and grading rubric in files section or clicking here.
Required Software
Connect to the Lab here.Links to an external site.
STEP 1: Understand the UML Diagram
STEP 2: Create the Project
You will want to use the Week 4 project as the starting point. To do this, you will want to create a new project by following these steps:
1. Create a new project and name it “CIS247C_Project5”.
2. Copy all the source files from the Week 4 project into the Week 5 project.
3. Before you move on to the next step, build and execute the Week 5 project.
STEP 3: Add the Hybrid Class
• Referring to the UML Class diagram, create the Hybrid class, ensuring to specify that the Hybrid class inherited from the Vehicle class.
• For each of the constructors listed in the Hybrid class, invoke the appropriate base class constructor and pass the correct arguments.
• Override the displayVehicle() to display the range of the Hybrid Vehicle.
STEP 4: Modify the Vehicle Class
• With the exception of the static integer, change the attributes from private to protected.
STEP 5: Modify the main function
Create code statements that perform the following operations. Note that several of the steps below were accomplished in last week’s assignment. New steps are in bold.
1. Using your code from Week 1, display a divider that contains the string “Start Program”.
2. Update and call the DisplayApplicationInformation function.
3. Using your code from Week 1, display a divider that contains the string “Vehicle 1”
4. Create a Vehicle object using the default constructor.
5. Prompt for and then set year and mpg using the overloaded setters from week 3 that accepts strings.
6. Create a Warranty object called warranty1 using the default constructor.
7. Prompt for and set number of years and number of miles. **Make sure to convert the return data type of the GetInput() function from a string to an integer**
Ex: warranty1.setMiles(atoi(GetInput(“number of miles”).c_str()));
8. Display the Vehicle Information.
9. Using your code from Week 1, display a divider that contains the string “Vehicle 2”
10. Create a Warranty object called warranty2 using the multi-argument constructor. You can set the number of years as 6 and number of miles as 70000.
11. Create another second Vehicle object using the multi-argument constructor, setting each of the attributes with the following values: “Cadillac”, 2017, 26.5 , warranty2
12. Create a third object by copying the second object.
13. Delete the third object by calling the destructor method.
14. Using your code from Week 1, display a divider that contains the string “Vehicle 3”
15. Create another Warranty object called warranty3 using the using the multi-argument constructor. You can set the number of years as 5 and number of miles as 60000.
16. Create a Hybrid object using the multi-argument constructor, setting each of the attributes with the following values: (570, “Toyota”, 2017, 52,warranty3). **Note that 570 is the range, Toyota is the make of the car, 2017 is the year, and 52 is the mpg.**
17. Display the Hybrid Vehicle information.
18. Display the number of vehicles created using getNumVehicles. Remember to access getNumVehicles using the class name, not the Vehicle object.
19. Update and call the TerminateApplication function.
STEP 6: Compile and Test
When done, compile and run your code.
Then, debug any errors until your code is error-free.
Check your output to ensure that you have the desired output, modify your code as necessary, and rebuild.
STEP 7: Screenshots
• Capture a screenshot of your working code and paste into a Word document.
• Capture a screenshot of your group meeting/discussion and paste in the same Word document.
STEP 8: Submit Deliverables
• Put all of the Visual Studio Project files into a zip file.
• Upload the zip file and screenshots (Word document).
• Please include the names of all participating team members in word document.
• Only one submission is required for the entire group.
CIS247C Week 5 Project Overview
The objective this week is to enhance last week’s Vehicle class by creating the Hybrid class which inherits the Vehicle class. The Hybrid class has all the same attributes as the Vehicle class except it has an additional attribute to describe the range of the battery.
In the Hybrid class complete the following steps:
• Referring to the UML Class diagram, create the Hybrid class, ensuring to specify that the Hybrid class inherited from the Vehicle class.
• For each of the constructors listed in the Hybrid class, invoke the appropriate base class constructor and pass the correct arguments.
• Override the displayVehicle() to display the range of the Hybrid Vehicle.
In the Warranty class:
• No change.
In the Vehicle class:
• With the exception of the static integer, change the attributes from private to protected.
In the main program:
Create code statements that perform the following operations. Note that several of the steps below were accomplished in last week’s assignment. New steps are in bold.
1. Using your code from Week 1, display a divider that contains the string “Start Program”.
2. Update and call the DisplayApplicationInformation function.
3. Using your code from Week 1, display a divider that contains the string “Vehicle 1”
4. Create a Vehicle object using the default constructor.
5. Prompt for and then set year and mpg using the overloaded setters from week 3 that accepts strings.
6. Create a Warranty object called warranty1 using the default constructor.
7. Prompt for and set number of years and number of miles. **Make sure to convert the return data type of the GetInput() function from a string to an integer**
Ex: warranty1.setMiles(atoi(GetInput(“number of miles”).c_str()));
8. Display the Vehicle Information.
9. Using your code from Week 1, display a divider that contains the string “Vehicle 2”
10. Create a Warranty object called warranty2 using the multi-argument constructor. You can set the number of years as 6 and number of miles as 70000.
11. Create another second Vehicle object using the multi-argument constructor, setting each of the attributes with the following values: “Cadillac”, 2017, 26.5 , warranty2
12. Create a third object by copying the second object.
13. Delete the third object by calling the destructor method.
14. Using your code from Week 1, display a divider that contains the string “Vehicle 3”
15. Create another Warranty object called warranty3 using the using the multi-argument constructor. You can set the number of years as 5 and number of miles as 60000
16. Create a Hybrid object using the multi-argument constructor, setting each of the attributes with the following values: (570, “Toyota”, 2017, 52, warranty3). **Note that 570 is the range, Toyota is the make of the car, 2017 is the year, and 52 is the mpg.**
17. Display the Hybrid Vehicle information.
18. Display the number of vehicles created using getNumVehicles. Remember to access getNumVehicles using the class name, not the Vehicle object.
19. Update and call the TerminateApplication function.
Grading Rubric
Compiles correctly 5
Modify Vehicle class 5
Create Hybrid class 15
Instantiate and display Hybrid object 15
Correctly formatted output 5
Screenshot 5
TOTAL 50
Steps
1. Review instructions and UML diagram.
2. Create a new project and name it “CIS247C_Project5”. Copy all the source files from the Week 4 project into the Week 5 project.
3. Compile and test the program to ensure there are no errors.
4. Capture screenshot of working code and paste into word document.
5. Submit zipped visual studio project and screenshot.
Refer to the following UML class diagram. No pseudocode is provided.