Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
1.7 kB
1
Indexable
Never
#include<iostream>
using namespace std;

class vehicle{
	public:
		string fuel, num;
		int km,s,sl;
		
		vehicle()
		{
			cout<<"\nStatus of fuel: ";
		    cin>>fuel;
	        cout<<"\nEnter the vehicle number: ";
	    	cin>>num;
	    	cout<<"\nEnter the distance travelled: ";
	    	cin>>km;
	    	cout<<"\nEnter speed: ";
	    	cin>>s;
	    	cout<<"Enter speed limit: ";
	    	cin>>sl;
		}
		
};


class car: public vehicle{
	public:
		car(){
			if(fuel=="full"&&km<2000){
		    	cout<<"\nYour vehicle is in good condition.";
			}
			else{
		    	cout<<"\nYour vehicle needs servicing!!\n\n";
			}
			if(s>sl){
			cout<<"Slow down BITCH!!\n\a";
			cout<<"Slow down BITCH!!\n\a";
			cout<<"Slow down BITCH!!\n\a";
			cout<<"Slow down BITCH!!\n\a";
			cout<<"Slow down BITCH!!\n\a";
			cout<<"Slow down BITCH!!\n\a";
	    	}
	    	else{
	    	cout<<"Carry on BITCH";
	    }
		}			
};

class truck: public vehicle{
	public:
		truck(){
			if(fuel=="full"&&km<5000){
				cout<<"\nYour vehicle is in good condition.";
			}
			else{
				cout<<"\nYour vehicle needs servicing!!\n\n";
			}
			if(s>sl){
				cout<<"Slow down BITCH!!\n\a";
				cout<<"Slow down BITCH!!\n\a";
				cout<<"Slow down BITCH!!\n\a";
				cout<<"Slow down BITCH!!\n\a";
				cout<<"Slow down BITCH!!\n\a";
				cout<<"Slow down BITCH!!\n\a";
	    	}
	    	else{
	    		cout<<"Carry on BITCH";
	    	}
			}
		
};

int main(){
	int n;
	cout<<"Choose your Vehicle:\n1.Car\n2.Truck\n";
	cin>>n;
	
	if(n==1){
		car c;
	}
	else if(n==2){
		truck t;
	}
	else{
		cout<<"\nInvalid response:";
	}
	
	return 0;
	
}