Challenge

Project 3

1)

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

Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl,
C#, OCaml, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog.
Code, Compile, Run and Debug online from anywhere in world.

*******************************************************************************/
//FILE MAIN.CPP //FILE MAIN.CPP
#include"vehicle.h"
#include<iostream>

void menudisplay()
{
cout << " 0. Quit.\n";
cout<< " 1. displayservices.\n";
cout<< " 2. Add vehicle.\n";

}
void displayservices()
{
cout<<"\n oil change or replace oil filter, replace air filter"<<endl;
cout<<"replace fuel filter, tire rotations, infotainment debug"<<endl;
cout<<"replace spark plugs, replace the cabin filter, check the level"<<endl;
cout<<" refill clutch fluid"<<endl;
cout<<"brake fluid, examine belts, wipers, hoses"<<endl;
cout<<"check the tire conditions, check the charging systems, battery"<<endl;

}
int main()
{ int user_choice;
beginning: menudisplay();
cout<<"Enter your choice in no"<<endl;
cin >> user_choice;
switch(user_choice) //switch method
{
case 0 :cout <<"Exiting the program ";
break ;
case 1 : displayservices();
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;
}
}

//FILE VECHICLE.H

#include<stdio.h>
#include <iostream>
using namespace std;
#define size 2
#define MAXKM 50000
class vehicle
{ public:
// vehicle();
// ~vehicle();
public:
string make, model,type;
enum TYPE{GAS,ELECTRIC,DIESEL};
int year;
float odometer;
virtual void setmake();
virtual void putmake();
virtual void setmodel();
virtual void putmodel();
virtual void setyear();
virtual void putyear();
virtual void setodometer();
virtual void putodometer();
};

//FILE VEHICLE.CPP

#include"vehicle.h"
void vehicle::setmake() //set method
{
cout<<"Enter make of the vehicle"<<endl; //make of the vehicle
cin >> make;
}
void vehicle::putmake() //put
{
cout<<"\t"<<make;
}
void vehicle::setmodel()
{
cout<<"\n Enter model of the vehicle"<<endl; //model of the vehicle
cin >> model;
}
void vehicle::putmodel()
{
cout<<"\t"<<model;
}
void vehicle::setyear()
{
cout<<"\n Enter manufactured year of the vehicle"<<endl; //year of the vehicle
cin >> year;
}
void vehicle::putyear()
{
cout<<"\t"<<year;
}
void vehicle::setodometer()
{
cout<<"\n Float data speedometer of the vehicle"<<endl; //odometer of the vehicle
cin >> odometer;
}
void vehicle::putodometer()
{
cout<<"\t"<<odometer;
if(odometer>50000)
cout<<"\n Tyre Rotation to be done "<<endl; //tyre rotation o
else
cout<<" \n Less than 50000 KMS -Tyre rotation can be done in next visit."<<endl;
if(odometer < 400)
cout<<"\n Battery need not be recharged"<<endl;
else
cout<<"\n Battery need to be recharged"<<endl;
}

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.