Professional Documents
Culture Documents
h>
#include<iostream>
#include<string.h>
using namespace std;
class Car
{
protected:
string brandname;
string color;
double odometer;
double newprice;
public:
Car()
{
brandname="";
color="";
odometer=0.0;
newprice=0.0;
}
void set_data()
{
cout<<"Enter Brand Name:"<<endl;
cin>>brandname;
cout<<"Enter Color:"<<endl;
cin>>color;
cout<<"Enter New Price"<<endl;
cin>>newprice;
}
double getpriceafteruse()
{
return newprice*(1-odometer/600000);
}
void updatemileage(double distance)
{
odometer=distance;
}
void get_data()
{
OUTPUT: