Challenge

Project 3

1.

#include <iostream>

#include <vector>

#include <string>

// Enum for car types

enum class CarType {

Petrol,

Diesel,

Gas,

Electric,

};

// Enum for maintenance tasks

enum class MaintenanceTask {

OilChange,

ReplaceOilFilter,

ReplaceAirFilter,

ReplaceFuelFilter,

TireRotations,

InfotainmentDebug,

ReplaceSparkPlugs,

ReplaceCabinACFilter,

CheckFluidLevel,

ExamineBelts,

CheckTireConditions,

CheckChargingSystem,

};

class Vehicle {

public:

Vehicle(const std::string& make, const std::string& model, int year, int odometer)

: make(make), model(model), year(year), odometer(odometer) {}

const std::string& getMake() const { return make; }

const std::string& getModel() const { return model; }

int getYear() const { return year; }

int getOdometer() const { return odometer; }

void addMaintenanceTask(MaintenanceTask task) {

maintenanceTasks.push_back(task);

}

void listMaintenanceTasks() const {

for (const MaintenanceTask& task : maintenanceTasks) {

std::cout << "Maintenance Task: " << static_cast<int>(task) << std::endl;

}

}

private:

std::string make;

std::string model;

int year;

int odometer;

std::vector<MaintenanceTask> maintenanceTasks;

};

int main() {

// Create vehicles of different types

Vehicle petrolCar("Toyota", "Corolla", 2020, 5000);

Vehicle dieselCar("Ford", "F-150", 2019, 7000);

Vehicle electricCar("Tesla", "Model S", 2022, 3000);

// Add maintenance tasks to the vehicles

petrolCar.addMaintenanceTask(MaintenanceTask::OilChange);

petrolCar.addMaintenanceTask(MaintenanceTask::ReplaceOilFilter);

dieselCar.addMaintenanceTask(MaintenanceTask::TireRotations);

electricCar.addMaintenanceTask(MaintenanceTask::CheckChargingSystem);

// List maintenance tasks for the vehicles

std::cout << "Petrol Car Maintenance Tasks:" << std::endl;

petrolCar.listMaintenanceTasks();

std::cout << "Diesel Car Maintenance Tasks:" << std::endl;

dieselCar.listMaintenanceTasks();

std::cout << "Electric Car Maintenance Tasks:" << std::endl;

electricCar.listMaintenanceTasks();

return 0;

}

2.a)

#include <iostream>

#include <vector>

#include <string>

// Enum for car types

enum class CarType {

Petrol,

Diesel,

Gas,

Electric,

};

// Enum for maintenance tasks

enum class MaintenanceTask {

OilChange,

ReplaceOilFilter,

ReplaceAirFilter,

ReplaceFuelFilter,

TireRotations,

InfotainmentDebug,

ReplaceSparkPlugs,

ReplaceCabinACFilter,

CheckFluidLevel,

ExamineBelts,

CheckTireConditions,

CheckChargingSystem,

};

class Vehicle {

protected:

std::string make;

std::string model;

int year;

int odometer;

public:

Vehicle(const std::string& make, const std::string& model, int year, int odometer)

: make(make), model(model), year(year), odometer(odometer) {}

const std::string& getMake() const { return make; }

const std::string& getModel() const { return model; }

int getYear() const { return year; }

int getOdometer() const { return odometer; }

void addMaintenanceTask(MaintenanceTask task) {

maintenanceTasks.push_back(task);

}

void listMaintenanceTasks() const {

for (const MaintenanceTask& task : maintenanceTasks) {

std::cout << "Maintenance Task: " << static_cast<int>(task) << std::endl;

}

}

private:

std::vector<MaintenanceTask> maintenanceTasks;

};

int main() {

// Create vehicles of different types

Vehicle petrolCar("Toyota", "Corolla", 2020, 5000);

Vehicle dieselCar("Ford", "F-150", 2019, 7000);

Vehicle electricCar("Tesla", "Model S", 2022, 3000);

// Add maintenance tasks to the vehicles

petrolCar.addMaintenanceTask(MaintenanceTask::OilChange);

petrolCar.addMaintenanceTask(MaintenanceTask::ReplaceOilFilter);

dieselCar.addMaintenanceTask(MaintenanceTask::TireRotations);

electricCar.addMaintenanceTask(MaintenanceTask::CheckChargingSystem);

// List maintenance tasks for the vehicles

std::cout << "Petrol Car Maintenance Tasks:" << std::endl;

petrolCar.listMaintenanceTasks();

std::cout << "Diesel Car Maintenance Tasks:" << std::endl;

dieselCar.listMaintenanceTasks();

std::cout << "Electric Car Maintenance Tasks:" << std::endl;

electricCar.listMaintenanceTasks();

return 0;

}

b)

#include <iostream>

#include <vector>

#include <string>

// Enum for car types

enum class CarType {

Petrol,

Diesel,

Gas,

Electric,

};

// Enum for maintenance tasks

enum class MaintenanceTask {

OilChange,

ReplaceOilFilter,

ReplaceAirFilter,

ReplaceFuelFilter,

TireRotations,

InfotainmentDebug,

ReplaceSparkPlugs,

ReplaceCabinACFilter,

CheckFluidLevel,

ExamineBelts,

CheckTireConditions,

CheckChargingSystem,

};

class Vehicle {

protected:

std::string make;

std::string model;

int year;

int odometer;

public:

Vehicle(const std::string& make, const std::string& model, int year, int odometer)

: make(make), model(model), year(year), odometer(odometer) {}

const std::string& getMake() const { return make; }

void setMake(const std::string& newMake) { make = newMake; }

const std::string& getModel() const { return model; }

void setModel(const std::string& newModel) { model = newModel; }

int getYear() const { return year; }

void setYear(int newYear) { year = newYear; }

int getOdometer() const { return odometer; }

void setOdometer(int newOdometer) { odometer = newOdometer; }

void addMaintenanceTask(MaintenanceTask task) {

maintenanceTasks.push_back(task);

}

void listMaintenanceTasks() const {

for (const MaintenanceTask& task : maintenanceTasks) {

std::cout << "Maintenance Task: " << static_cast<int>(task) << std::endl;

}

}

private:

std::vector<MaintenanceTask> maintenanceTasks;

};

int main() {

// Create vehicles of different types

Vehicle petrolCar("Toyota", "Corolla", 2020, 5000);

Vehicle dieselCar("Ford", "F-150", 2019, 7000);

Vehicle electricCar("Tesla", "Model S", 2022, 3000);

// Modify vehicle details using setter functions

petrolCar.setMake("Honda");

petrolCar.setModel("Civic");

petrolCar.setYear(2021);

petrolCar.setOdometer(6000);

// Add maintenance tasks to the vehicles

petrolCar.addMaintenanceTask(MaintenanceTask::OilChange);

petrolCar.addMaintenanceTask(MaintenanceTask::ReplaceOilFilter);

dieselCar.addMaintenanceTask(MaintenanceTask::TireRotations);

electricCar.addMaintenanceTask(MaintenanceTask::CheckChargingSystem);

// List maintenance tasks for the vehicles

std::cout << "Petrol Car Maintenance Tasks:" << std::endl;

petrolCar.listMaintenanceTasks();

std::cout << "Diesel Car Maintenance Tasks:" << std::endl;

dieselCar.listMaintenanceTasks();

std::cout << "Electric Car Maintenance Tasks:" << std::endl;

electricCar.listMaintenanceTasks();

return 0;

}

c)

#include <iostream>

#include <vector>

#include <string>

// Enum for car types

enum class CarType {

Petrol,

Diesel,

Gas,

Electric,

};

// Enum for maintenance tasks

enum class MaintenanceTask {

OilChange,

ReplaceOilFilter,

ReplaceAirFilter,

ReplaceFuelFilter,

TireRotations,

InfotainmentDebug,

ReplaceSparkPlugs,

ReplaceCabinACFilter,

CheckFluidLevel,

ExamineBelts,

CheckTireConditions,

CheckChargingSystem,

};

class Vehicle {

protected:

std::string make;

std::string model;

int year;

int odometer;

public:

Vehicle(const std::string& make, const std::string& model, int year, int odometer)

: make(make), model(model), year(year), odometer(odometer) {}

const std::string& getMake() const { return make; }

void setMake(const std::string& newMake) { make = newMake; }

const std::string& getModel() const { return model; }

void setModel(const std::string& newModel) { model = newModel; }

int getYear() const { return year; }

void setYear(int newYear) { year = newYear; }

int getOdometer() const { return odometer; }

void setOdometer(int newOdometer) { odometer = newOdometer; }

void addMaintenanceTask(MaintenanceTask task) {

maintenanceTasks.push_back(task);

}

void listMaintenanceTasks() const {

for (const MaintenanceTask& task : maintenanceTasks) {

std::cout << "Maintenance Task: " << static_cast<int>(task) << std::endl;

}

}

void checkTireRotation() const {

std::cout << "Tire rotation check done." << std::endl;

}

void getCarInformation() const {

std::cout << "Make: " << make << ", Model: " << model

<< ", Year: " << year << ", Odometer: " << odometer << std::endl;

}

private:

std::vector<MaintenanceTask> maintenanceTasks;

};

int main() {

// Create vehicles of different types

Vehicle petrolCar("Toyota", "Corolla", 2020, 5000);

Vehicle dieselCar("Ford", "F-150", 2019, 7000);

Vehicle electricCar("Tesla", "Model S", 2022, 3000);

// Modify vehicle details using setter functions

petrolCar.setMake("Honda");

petrolCar.setModel("Civic");

petrolCar.setYear(2021);

petrolCar.setOdometer(6000);

// Add maintenance tasks to the vehicles

petrolCar.addMaintenanceTask(MaintenanceTask::OilChange);

petrolCar.addMaintenanceTask(MaintenanceTask::ReplaceOilFilter);

dieselCar.addMaintenanceTask(MaintenanceTask::TireRotations);

electricCar.addMaintenanceTask(MaintenanceTask::CheckChargingSystem);

// List maintenance tasks for the vehicles

std::cout << "Petrol Car Maintenance Tasks:" << std::endl;

petrolCar.listMaintenanceTasks();

std::cout << "Diesel Car Maintenance Tasks:" << std::endl;

dieselCar.listMaintenanceTasks();

std::cout << "Electric Car Maintenance Tasks:" << std::endl;

electricCar.listMaintenanceTasks();

// Perform maintenance activities

petrolCar.checkTireRotation();

petrolCar.getCarInformation();

return 0;

}

d)

#include <iostream>

#include <vector>

#include <string>

// Enum for car types

enum class CarType {

Petrol,

Diesel,

Gas,

Electric,

};

// Enum for maintenance tasks

enum class MaintenanceTask {

OilChange,

ReplaceOilFilter,

ReplaceAirFilter,

ReplaceFuelFilter,

TireRotations,

InfotainmentDebug,

ReplaceSparkPlugs,

ReplaceCabinACFilter,

CheckFluidLevel,

ExamineBelts,

CheckTireConditions,

CheckChargingSystem,

};

// Enum for fuel types

enum class FuelType {

GAS,

DIESEL,

ELECTRIC,

};

class Vehicle {

protected:

std::string make;

std::string model;

int year;

int odometer;

FuelType fuelType;

public:

Vehicle(const std::string& make, const std::string& model, int year, int odometer, FuelType fuelType)

: make(make), model(model), year(year), odometer(odometer), fuelType(fuelType) {}

const std::string& getMake() const { return make; }

void setMake(const std::string& newMake) { make = newMake; }

const std::string& getModel() const { return model; }

void setModel(const std::string& newModel) { model = newModel; }

int getYear() const { return year; }

void setYear(int newYear) { year = newYear; }

int getOdometer() const { return odometer; }

void setOdometer(int newOdometer) { odometer = newOdometer; }

FuelType getFuelType() const { return fuelType; }

void setFuelType(FuelType newFuelType) { fuelType = newFuelType; }

void addMaintenanceTask(MaintenanceTask task) {

maintenanceTasks.push_back(task);

}

void listMaintenanceTasks() const {

for (const MaintenanceTask& task : maintenanceTasks) {

std::cout << "Maintenance Task: " << static_cast<int>(task) << std::endl;

}

}

void checkTireRotation() const {

std::cout << "Tire rotation check done." << std::endl;

}

void getCarInformation() const {

std::cout << "Make: " << make << ", Model: " << model

<< ", Year: " << year << ", Odometer: " << odometer

<< ", Fuel Type: " << static_cast<int>(fuelType) << std::endl;

}

private:

std::vector<MaintenanceTask> maintenanceTasks;

};

int main() {

// Create vehicles of different types

Vehicle petrolCar("Toyota", "Corolla", 2020, 5000, FuelType::GAS);

Vehicle dieselCar("Ford", "F-150", 2019, 7000, FuelType::DIESEL);

Vehicle electricCar("Tesla", "Model S", 2022, 3000, FuelType::ELECTRIC);

// Modify vehicle details using setter functions

petrolCar.setMake("Honda");

petrolCar.setModel("Civic");

petrolCar.setYear(2021);

petrolCar.setOdometer(6000);

// Add maintenance tasks to the vehicles

petrolCar.addMaintenanceTask(MaintenanceTask::OilChange);

petrolCar.addMaintenanceTask(MaintenanceTask::ReplaceOilFilter);

dieselCar.addMaintenanceTask(MaintenanceTask::TireRotations);

electricCar.addMaintenanceTask(MaintenanceTask::CheckChargingSystem);

// List maintenance tasks for the vehicles

std::cout << "Petrol Car Maintenance Tasks:" << std::endl;

petrolCar.listMaintenanceTasks();

std::cout << "Diesel Car Maintenance Tasks:" << std::endl;

dieselCar.listMaintenanceTasks();

std::cout << "Electric Car Maintenance Tasks:" << std::endl;

electricCar.listMaintenanceTasks();

// Perform maintenance activities

petrolCar.checkTireRotation();

petrolCar.getCarInformation();

return 0;

}

e)

#include <iostream>

#include <vector>

#include <string>

// Enum for car types

enum class CarType {

Petrol,

Diesel,

Gas,

Electric,

};

// Enum for maintenance tasks

enum class MaintenanceTask {

OilChange,

ReplaceOilFilter,

ReplaceAirFilter,

ReplaceFuelFilter,

TireRotations,

InfotainmentDebug,

ReplaceSparkPlugs,

ReplaceCabinACFilter,

CheckFluidLevel,

ExamineBelts,

CheckTireConditions,

CheckChargingSystem,

};

// Enum for fuel types

enum class FuelType {

GAS,

DIESEL,

ELECTRIC,

};

class Vehicle {

protected:

std::string make;

std::string model;

int year;

int odometer;

public:

Vehicle(const std::string& make, const std::string& model, int year, int odometer)

: make(make), model(model), year(year), odometer(odometer) {}

virtual FuelType getType() = 0; // Pure virtual method

const std::string& getMake() const { return make; }

void setMake(const std::string& newMake) { make = newMake; }

const std::string& getModel() const { return model; }

void setModel(const std::string& newModel) { model = newModel; }

int getYear() const { return year; }

void setYear(int newYear) { year = newYear; }

int getOdometer() const { return odometer; }

void setOdometer(int newOdometer) { odometer = newOdometer; }

void addMaintenanceTask(MaintenanceTask task) {

maintenanceTasks.push_back(task);

}

void listMaintenanceTasks() const {

for (const MaintenanceTask& task : maintenanceTasks) {

std::cout << "Maintenance Task: " << static_cast<int>(task) << std::endl;

}

}

void checkTireRotation() const {

std::cout << "Tire rotation check done." << std::endl;

}

void getCarInformation() const {

std::cout << "Make: " << make << ", Model: " << model

<< ", Year: " << year << ", Odometer: " << odometer << std::endl;

}

private:

std::vector<MaintenanceTask> maintenanceTasks;

};

class PetrolCar : public Vehicle {

public:

PetrolCar(const std::string& make, const std::string& model, int year, int odometer)

: Vehicle(make, model, year, odometer) {}

FuelType getType() override { return FuelType::GAS; }

};

class DieselCar : public Vehicle {

public:

DieselCar(const std::string& make, const std::string& model, int year, int odometer)

: Vehicle(make, model, year, odometer) {}

FuelType getType() override { return FuelType::DIESEL; }

};

class ElectricCar : public Vehicle {

public:

ElectricCar(const std::string& make, const std::string& model, int year, int odometer)

: Vehicle(make, model, year, odometer) {}

FuelType getType() override { return FuelType::ELECTRIC; }

};

int main() {

// Create vehicles of different types

PetrolCar petrolCar("Toyota", "Corolla", 2020, 5000);

DieselCar dieselCar("Ford", "F-150", 2019, 7000);

ElectricCar electricCar("Tesla", "Model S", 2022, 3000);

// Add maintenance tasks to the vehicles

petrolCar.addMaintenanceTask(MaintenanceTask::OilChange);

petrolCar.addMaintenanceTask(MaintenanceTask::ReplaceOilFilter);

dieselCar.addMaintenanceTask(MaintenanceTask::TireRotations);

electricCar.addMaintenanceTask(MaintenanceTask::CheckChargingSystem);

// List maintenance tasks for the vehicles

std::cout << "Petrol Car Maintenance Tasks:" << std::endl;

petrolCar.listMaintenanceTasks();

std::cout << "Diesel Car Maintenance Tasks:" << std::endl;

dieselCar.listMaintenanceTasks();

std::cout << "Electric Car Maintenance Tasks:" << std::endl;

electricCar.listMaintenanceTasks();

// Get the fuel type for each vehicle

std::cout << "Petrol Car Fuel Type: " << static_cast<int>(petrolCar.getType()) << std::endl;

std::cout << "Diesel Car Fuel Type: " << static_cast<int>(dieselCar.getType()) << std::endl;

std::cout << "Electric Car Fuel Type: " << static_cast<int>(electricCar.getType()) << std::endl;

return 0;

}

  1. Menu should be as below,

<< " 0. Quit.\n"

<< " 1. List inventory.\n"

<< " 2. Add vehicle.\n"

<< " 3. Update vehicle\n"

<< " 4. Remove vehicle\n"

<< " 5. Tire Rotation\n"

<< " 6. Oil Change\n"

#include <iostream>

#include <vector>

#include <string>

enum class FuelType {

GAS,

DIESEL,

ELECTRIC,

};

enum class MaintenanceTask {

OilChange,

ReplaceOilFilter,

ReplaceAirFilter,

ReplaceFuelFilter,

TireRotations,

InfotainmentDebug,

ReplaceSparkPlugs,

ReplaceCabinACFilter,

CheckFluidLevel,

ExamineBelts,

CheckTireConditions,

CheckChargingSystem,

};

class Vehicle {

protected:

std::string make;

std::string model;

int year;

int odometer;

FuelType fuelType;

public:

Vehicle(const std::string& make, const std::string& model, int year, int odometer, FuelType fuelType)

: make(make), model(model), year(year), odometer(odometer), fuelType(fuelType) {}

virtual FuelType getType() const = 0; // Pure virtual method

const std::string& getMake() const { return make; }

void setMake(const std::string& newMake) { make = newMake; }

const std::string& getModel() const { return model; }

void setModel(const std::string& newModel) { model = newModel; }

int getYear() const { return year; }

void setYear(int newYear) { year = newYear; }

int getOdometer() const { return odometer; }

void setOdometer(int newOdometer) { odometer = newOdometer; }

FuelType getFuelType() const { return fuelType; }

void setFuelType(FuelType newFuelType) { fuelType = newFuelType; }

void addMaintenanceTask(MaintenanceTask task) {

maintenanceTasks.push_back(task);

}

void listMaintenanceTasks() const {

for (const MaintenanceTask& task : maintenanceTasks) {

std::cout << "Maintenance Task: " << static_cast<int>(task) << std::endl;

}

}

void checkTireRotation() const {

std::cout << "Tire rotation check done." << std::endl;

}

void performOilChange() {

std::cout << "Oil change performed." << std::endl;

}

void recharge() {

std::cout << "Recharging..." << std::endl;

}

void getCarInformation() const {

std::cout << "Make: " << make << ", Model: " << model

<< ", Year: " << year << ", Odometer: " << odometer

<< ", Fuel Type: " << static_cast<int>(fuelType) << std::endl;

}

private:

std::vector<MaintenanceTask> maintenanceTasks;

};

class PetrolCar : public Vehicle {

public:

PetrolCar(const std::string& make, const std::string& model, int year, int odometer)

: Vehicle(make, model, year, odometer, FuelType::GAS) {}

FuelType getType() const override { return FuelType::GAS; }

};

class DieselCar : public Vehicle {

public:

DieselCar(const std::string& make, const std::string& model, int year, int odometer)

: Vehicle(make, model, year, odometer, FuelType::DIESEL) {}

FuelType getType() const override { return FuelType::DIESEL; }

};

class ElectricCar : public Vehicle {

public:

ElectricCar(const std::string& make, const std::string& model, int year, int odometer)

: Vehicle(make, model, year, odometer, FuelType::ELECTRIC) {}

FuelType getType() const override { return FuelType::ELECTRIC; }

};

class VehicleManagement {

private:

std::vector<Vehicle*> vehicles;

public:

void listInventory() const {

std::cout << "Inventory:\n";

for (const Vehicle* vehicle : vehicles) {

vehicle->getCarInformation();

std::cout << "Fuel Type: " << static_cast<int>(vehicle->getType()) << std::endl;

std::cout << "Maintenance Tasks:\n";

vehicle->listMaintenanceTasks();

}

}

void addVehicle(Vehicle* vehicle) {

vehicles.push_back(vehicle);

}

void updateVehicle(int index, Vehicle* vehicle) {

if (index >= 0 && index < vehicles.size()) {

vehicles[index] = vehicle;

}

}

void removeVehicle(int index) {

if (index >= 0 && index < vehicles.size()) {

delete vehicles[index];

vehicles.erase(vehicles.begin() + index);

}

}

};

int main() {

VehicleManagement vehicleManager;

while (true) {

std::cout << "Menu:\n"

<< "0. Quit.\n"

<< "1. List inventory.\n"

<< "2. Add vehicle.\n"

<< "3. Update vehicle.\n"

<< "4. Remove vehicle.\n"

<< "5. Tire Rotation.\n"

<< "6. Oil Change.\n"

<< "7. Recharge.\n"

<< "Enter your choice: ";

int choice;

std::cin >> choice;

if (choice == 0) {

break;

}

switch (choice) {

case 1:

vehicleManager.listInventory();

break;

case 2: {

std::cout << "Enter the vehicle type (1 - Petrol, 2 - Diesel, 3 - Electric): ";

int vehicleType;

std::cin >> vehicleType;

std::string make, model;

int year, odometer;

std::cout << "Enter make: ";

std::cin >> make;

std::cout << "Enter model: ";

std::cin >> model;

std::cout << "Enter year: ";

std::cin >> year;

std::cout << "Enter odometer reading: ";

std::cin >> odometer;

Vehicle* newVehicle = nullptr;

if (vehicleType == 1) {

newVehicle = new PetrolCar(make, model, year, odometer);

} else if (vehicleType == 2) {

newVehicle = new DieselCar(make, model, year, odometer);

} else if (vehicleType == 3) {

newVehicle = new ElectricCar(make, model, year, odometer);

}

if (newVehicle) {

vehicleManager.addVehicle(newVehicle);

std::cout << "Vehicle added.\n";

} else {

std::cout << "Invalid vehicle type.\n";

}

break;

}

case 3: {

int index;

std::cout << "Enter the index of the vehicle to update: ";

std::cin >> index;

if (index >= 0 && index < vehicleManager.vehicles.size()) {

std::string make, model;

int year, odometer;

std::cout << "Enter make: ";

std::cin >> make;

std::cout << "Enter model: ";

std::cin >> model;

std::cout << "Enter year: ";

std::cin >> year;

std::cout << "Enter odometer reading: ";

std::cin >> odometer;

Vehicle* updatedVehicle = nullptr;

if (vehicleManager.vehicles[index]->getType() == FuelType::GAS) {

updatedVehicle = new PetrolCar(make, model, year, odometer);

} else if (vehicleManager.vehicles[index]->getType() == FuelType::DIESEL) {

updatedVehicle = new DieselCar(make, model, year, odometer);

} else if (vehicleManager.vehicles[index]->getType() == FuelType::ELECTRIC) {

updatedVehicle = new ElectricCar(make, model, year, odometer);

}

if (updatedVehicle) {

vehicleManager.updateVehicle(index, updatedVehicle);

std::cout << "Vehicle updated.\n";

} else {

std::cout << "Invalid vehicle type.\n";

}

} else {

std::cout << "Invalid index.\n";

}

break;

}

case 4: {

int index;

std::cout << "Enter the index of the vehicle to remove: ";

std::cin >> index;

if (index >= 0 && index < vehicleManager.vehicles.size()) {

vehicleManager.removeVehicle(index);

std::cout << "Vehicle removed.\n";

} else {

std::cout << "Invalid index.\n";

}

break;

}

case 5:

// Implement tire rotation

break;

case 6:

// Implement oil change

break;

case 7:

// Implement recharge

break;

default:

std::cout << "Invalid choice. Please try again.\n";

}

}

return 0;

}

<< " 7. Recharge\n"

Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.