Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please read it carefully coz this is the second time to post it. The prev. code

ID: 3773719 • Letter: P

Question

Please read it carefully coz this is the second time to post it. The prev. code was completely irrelated!

This class is so basic so no need to use advanced C++ codes) (We almost just need: Use of functions and re-use of functions whenever possible, Use of arrays.( no vectors) ,Use of files,Use of loops.) - In this C++ program you are requested to implement a simple cars’ management system. The system should allow a user to perform a set of tasks through the following menu. 1-Add a car 2-Delete a car 3-Update car 4-Find car 5-List cars 6-Show statistics 7-Exit The system has to keep looping until the user select the Exit option. The system has to store cars’ data in a text file called “cars.txt”. This file will play the role of cars’ database. Just an example: Brand Model Price Toyota Corolla 53000 Nissan Patrol 200000 Toyota Camry 80000 Nissan Sunny 42000 Chevrolet Impala 61000 Chevrolet Malibu 65000 …. The data has to be read from the file when the program start and stored back in the file when the program ends. For each menu option you have to implement the following requirements: Add a car For each car you add you have to read the following details: ID, Brand name, Model name, price. ID is a positive integer with exactly 4 digits. price is an integer with only possible values. The Brand name and model names are strings built out of the English alphabet characters excluding the space character (no spaces). Each field you read for a cars has to be validated before it is accepted. Not that the car ID has to be unique among all cars. For storing the list of all cars in your program, you can use parallel arrays or vectors. Delete a car For this option the user has to enter the ID of the car to delete. If the ID is not found, a message is displayed to tell the user that the car does not exist. Update car For this option the user has to enter the car ID to update. If the car exists, the system displays each field of the car and request from the user if he wants to update it. If the user answers yes the system requests the new value for the field. Find car For this option the user has to enter the car ID. The details of the car with the entered ID is displayed if it is found, otherwise a message is displayed to tell the user the car does not exist. List cars Displays cars by price in increasing order, each field is displayed in a separate column with a width of 10 characters. Show statistics. Displays for each brand of cars in the database, the number of cars of that brand. Exit Asks the user to confirm exiting the program.

Explanation / Answer

#include "stdafx.h" #include #include #include using namespace std; class Car { private: int YearModel; int Speed; string Make; public: Car(int, string, int); string getMake(); int getModel(); int getSpeed(); int Accelerate(); int Brake(); void displayMenu(); }; Car::Car(int YearofModel, string Makeby, int Spd) { YearModel = YearofModel; Make = Makeby; Speed = Spd; } string Car::getMake() { return Make; } int Car::getModel() { return YearModel; } int Car::getSpeed() { return Speed; } int Car::Accelerate() { Speed = Speed + 5; return Speed; } int Car::Brake() { Speed = Speed - 5; return Speed; } void displayMenu() { cout
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote