CIS247C Project Week 3 of 7 – Vehicle Class – Fully commented code with screenshots – Perfect Solution – Instant Delivery

Lab Price = $9
Please feel free to send us your queries at: support@iqrajavaid.com
Payment methods

Add to Cart

Buy Now

View Cart


Problem Statement

Project Week 3 of 7: Overloaded Methods and Static Methods / Variables
SUMMARY
The project objective this week is to enhance last week’s Vehicle class by making the following changes:
• Create a static variable called numVehicles that holds an int and initialize it to zero. This will allow us to count all the Vehicle objects created in the main class.
• Add the copy constructor.
• Increment numVehicles in all of the constructors
• Decrement numVehicle in destructor
• Add overloaded versions of setYear and setMpg that accept strings. This way, we will have two “set” methods; one that accepts a string, and one that accepts its default data type.
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
• The following attribute has been added:
– static numVehicles: int = 0
• The following behaviors have been added:
• + static getNumVehicles( ) : int
+ Vechicle(vh: Vehicle)
• + setYear(string year) : void
• + setMpg(string mpg) : void
STEP 2: Create the Project
You will want to use the Week 2 project as the starting point.
STEP 3: Modify the Vehicle Class
1. Create a static numVehicles variable and initialize it to zero.
2. Create a copy constructor.
3. Update the destructor to decrement numVehicles by one.
4. Increment numVehicles by one in each of the constructors.
5. Create an overloaded setYear method and this time make the parameter a string.
6. Create an overloaded setMpg method and this time make the parameter a string.
**Remember that you will have to convert the string in the above two “set” methods to the data type of the attribute.**
7. Make the getNumVehicles a static method. This way, you can call it with the class name instead of an object name.
Be sure you follow proper commenting and programming styles (indentation, line spacing, etc.).
STEP 4: Modify the Main Method
In the Main class, create code statements that perform the following operations. Be sure you follow proper commenting and programming styles (header, indentation, line spacing, etc.). 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. Create an Vehicle object using the default constructor.
4. Prompt for and then set year and mpg using the new overloaded setters. Consider using your getInput method from Week 1 to obtain data from the user for this step as well as Step 3.
5. Using your code from Week 1, display a divider that contains the string “Vehicle 1 Information”.
6. Display the Vehicle Information.
7. Create a second Vehicle object using the multi-arg constructor, setting each of the attributes with the following values: “Cadillac”, 2017, 26.5
8. Create a third object by copying the second object.
9. Delete the third object by calling the destructor method.
10. Display the number of vehicles created using getNumVehicles. Remember to access getNumVehicles using the class name, not the Vehicle object.
11. Update and call the TerminateApplication function.
STEP 5: 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 6: 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 7: 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 3 Project Overview

The objective of this week is to enhance last week’s Vehicle class by making the following changes:
• Create a static variable called numVehicles that holds an int and initialize it to zero. This will allow us to count all the Vehicle objects created in the main class.
• Add the copy constructor
• Increment numVehicles in all of the constructors
• Decrement numVehicle in destructor
• Add overloaded versions of setYear and setMpg that accept strings. This way, we will have two “set” methods; one that accepts a string, and one that accepts its default data type.

In the Vehicle class complete the following steps:
1. Create a static numVehicles variable and initialize it to zero.
2. Create a copy constructor.
3. Update the destructor to decrement numVehicles by one.
4. Increment numVehicles by one in each of the constructors.
5. Create an overloaded setYear method and this time make the parameter a string.
6. Create an overloaded setMpg method and this time make the parameter a string.
**Remember that you will have to convert the string in the above two “set” methods to the data type of the attribute.**
7. Make the getNumVehicles a static method. This way, you can call it with the class name instead of an object name.

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. Create a Vehicle object using the default constructor.
4. Prompt for and then set year and mpg using the new overloaded setters. Consider using your getInput method from Week 1 to obtain data from the user for this step as well as Step 3.
5. Using your code from Week 1, display a divider that contains the string “Vehicle 1 Information”.
6. Display the Vehicle Information.
7. Create a second Vehicle object using the multi-arg constructor, setting each of the attributes with the following values: “Cadillac”, 2017, 26.5
8. Create a third object by copying the second object.
9. Delete the third object by calling the destructor method.
10. Display the number of vehicles created using getNumVehicles. Remember to access getNumVehicles using the class name, not the Vehicle object.
11. Update and call the TerminateApplication function.


Grading Rubric

Compiles correctly 10
Copy constructor 5
Static variable created and incremented in all constructors 5
getNumVehicles() function 5
Overloaded setters 10
main() with correct function calls and three objects instantiated 5
Correctly formatted output 5
Screenshot 5
TOTAL 50

Steps
1. Review instructions and UML diagram.
2. Compile and test the program to ensure there are no errors.
3. Capture screenshot of working code and paste into word document.
4. Submit zipped visual studio project and screenshot.

Refer to the following UML class diagram. No pseudocode is provided.

Vehicle
– make: string
– year: int
– mpg: double
– numVehicles: static int
+Vehicle()
+Vehicle(string make, integer year, double mpg)
+Vehicle(Vehicle &)
+~Vehicle()
+getMake(): string
+getYear(): int
+getMileage(): double
+setMake(string): void
+setYear(int): void
+setYear(string): void
+setMileage(double): void
+setMileage(string): void
+displayVehicle(): void
+getNumVehicles(): static int

Relevant Material
Screenshots
Week 3: Course Proj Screenshot
Week 3: Course Proj Screenshot
Instructions
* If you want to purchase multiple products then click on “Buy Now” button which will give you ADD TO CART option.Please note that the payment is done through PayPal.
* You can also use 2CO option if you want to purchase through Credit Cards/Paypal but make sure you put the correct billing information otherwise you wont be able to receive any download link.
* Your paypal has to be pre-loaded in order to complete the purchase or otherwise please discuss it with us at support@iqrajavaid.com.
* As soon as the payment is received, download link of the solution will automatically be sent to the address used in selected payment method.
* Please check your junk mails as the download link email might go there and please be patient for the download link email. Sometimes, due to server congestion, you may receive download link with a delay.
* All the contents are compressed in one zip folder.
* In case if you get stuck at any point during the payment process, please immediately contact us at support@iqrajavaid.com and we will fix it with you.
* We try our best to reach back to you on immediate basis. However, please wait for atleast 8 hours for a response from our side. Afterall, we are humans.
* Comments/Feedbacks are truely welcomed and there might be some incentives for you for the next lab/quiz/assignment.
* In case of any query, please donot hesitate to contact us at support@iqrajavaid.com.
* MOST IMPORTANT Please use the tutorials as a guide and they need NOT to be used for any submission. Just take help from the material.
******************************************** Good Luck ***************************************************
Privacy Policy
We take your privacy seriously and will take all measures to protect your personal information.
Any personal information received will only be used to fill your order. We will not sell or redistribute your information to anyone.
Refund Policy
Incase you face any issues with the tutorial, please free to contact us on support@iqrajavaid.com
We will try our best to resolve the issue and if still persists we can discuss for a refund in case its required.
Payment Details
Lab Price = $9
Please feel free to send us your queries at: support@iqrajavaid.com

Payment methods

Add to Cart

Buy Now

View Cart

Leave a Reply