Challenge

Project 3

/*

* project_3_Automobile_maintenance.c++

*

* Created on: 01-Apr-2024

* Author: CHIRAG

*/

/******************************************************************************/

output

#include <iostream> // for input/output display

using namespace std; // defining standard way of name space

#define size 2 // macros variable size declaring 2

#define MAXKM 50000 // max kilometer of the vehicel beyond which maintenance require

class vehicle // creating a class name vehicle

{ public:

// vehicle();

// ~vehicle();

public: // publicly defining string variable make,model,type for accessing outside class

string make, model,type;

enum TYPE{GAS,ELECTRIC,DIESEL}; // for type of the fuel varient

int year;

float odometer; // for odometer readings

virtual void setmake(); // to set information of make from user

virtual void putmake(); // to get information of make from user

virtual void setmodel(); // to set information of model from user

virtual void putmodel(); // to get information of model from user

virtual void setyear(); // to set information of year from user

virtual void putyear(); // to get information of year from user

virtual void setodometer(); // to set information of odometer from user

virtual void putodometer(); // to get information of odometer from user

};

void vehicle::setmake() // function to get information from user

{

cout<<"Enter make of the vehicle"<<endl;

cin >> make;

}

void vehicle::putmake() // for record

{

cout<<"\t"<<make;

}

void vehicle::setmodel() // function to get information from user

{

cout<<"\n Enter model of the vehicle"<<endl;

cin >> model;

}

void vehicle::putmodel() // for record

{

cout<<"\t"<<model;

}

void vehicle::setyear() // function to get information from user

{

cout<<"\n Enter manufactured year of the vehicle"<<endl;

cin >> year;

}

void vehicle::putyear() // for record

{

cout<<"\t"<<year;

}

void vehicle::setodometer() // function to get information from user

{

cout<<"\n Float data speedometer of the vehicle"<<endl;

cin >> odometer;

}

void vehicle::putodometer() // for record

{

cout<<"\t"<<odometer;

if(odometer>50000) // if kilometer driven by vehicle < 50000km

cout<<"\n Tyre Rotation to be done "<<endl; // tyre rotation no need to done status is pending

else

cout<<" \n Less than 50000 KMS -Tyre rotation can be done in next visit."<<endl; // if km driven is >50000 tyre rotation will require in next visiting hour

if(odometer < 400) // for odo meter reading <400km battery maintenance requirement as per condition below

cout<<"\n Battery need not be recharged"<<endl;

else

cout<<"\n Battery need to be recharged"<<endl; // else km driven is greater then 400 battery need to be recharge

}

void menudisplay() // for workshop requirement for service information or to add vehicle

{

cout << " 0. Quit.\n";

cout<< " 1. displayservices.\n";

cout<< " 2. Add vehicle.\n\n";

}

void displayservices()

{

cout<<"\n oil change or replace oil filter, replace air filter"<<endl; // service reuirement oil change replace oil filer

cout<<"replace fuel filter, tire rotations, infotainment debug"<<endl; // fuel filter

cout<<"replace spark plugs, replace the cabin filter, check the level"<<endl; // spark plug

cout<<" refill clutch fluid"<<endl; // refill clutch fluid

cout<<"brake fluid, examine belts, wipers, hoses"<<endl; // brake fluid

cout<<"check the tire conditions, check the charging systems, battery"<<endl; // battery condition as per requirement

}

int main() // main function

{

while(1) // for infinite loop

{

int user_choice; // what is require quit-service or add vehicle

beginning: menudisplay();

cout<<"Enter your choice in no"<<endl; // taking customer requirements

cin >> user_choice;

switch(user_choice)

{

case 0 :cout <<"Exiting the program \n";

break ;

case 1 : displayservices(); // display service

goto beginning; // goto beginning

case 2:

vehicle *pv=new vehicle();

pv->setmake();

pv->setmodel();

pv->setyear();

pv->setodometer();

pv->putmake();

pv->putmodel();

pv->putyear();

pv->putodometer();

goto beginning;

}

}

}

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.