Please I need help with this Lanuage C Write OO Program Cre

Please I need help with this! Lanuage: C++

Write OO Program.

******************************************************************************************************************************

Create a class called CAR.

Have several variables - use necessary variables that store

      gas level, amount of gas, gear car is in, car in motion.. etc

Have functions that do:

Check the battery level

Check the gas level

Turn right, Left,

Go Straight

Put car in forward gear

Put car in backward gear

Start Car (function should check if batter is good and you have gas)

        Example: If good then print message \"car started\", if not \"print car not started because ....\"

Park Car

Move car # number of feet. (Car uses 1 unit of gas per 50 feet)

   (subtract 1 unit of gas per 50 feet traveled)

As the car moves (determine if it needs gas)

Note: as you instruct the computer to perform a command in the main function, have your

function print out messages for each action.

Have a dashboard/Interface in which the user can make interactive/Live choices on how to drive the car.

Solution

using namespace std;
#include<iostream>
#include<stdio.h>
#include<ctype.h>
class Car{
   public:
           int batteryLevel;
           int gasLevel;
           float amountOfGas;
           int gear;
           int direction;
           bool motion;
           int feetCovered;
           void startCar(Car);
           void parkCar();
           void moveCar(Car);
           int gasCheck(Car);
           int batteryCheck(Car);
       //   int getGasLevel(int);
           int getBatteryLevel(int);
};
void Car::startCar(Car c){
  
   if(amountOfGas==0){
       cout<<\"Car can not be started as there is no gas\"<<endl;
   }else{
       cout<<\"Continue your journey you have enough gas to go ahead\"<<endl;
       }
   }
void Car::parkCar(){
   cout<<\"Car is at Parking Area\";
}
void Car::moveCar(Car c){
   cout<<\"How many feets it moves\"<<endl;
   cin>>feetCovered;
   amountOfGas-=float(1/feetCovered);
  
   if(amountOfGas==0){
       cout<<\"Car can not be started as there is no gas\"<<endl;
   }else{
       cout<<\"Continue your journey you have enough gas to go ahead\"<<endl;
   }
}
int Car::getBatteryLevel(int batteryLevel){
   if(batteryLevel>10){
       return 0;
   }else if(batteryLevel<=10&&batteryLevel>=1){
       return 1;
   }
   else{
       return 2;
   }
}  
  
int main(){
   Car c;
   cout<<\"Car\'s Functionlity \"<<endl;
   int ch;
   while(ch!=-1){
  
   cout<<\"Enter the battery Level between 1-10 and 0 for no battery\";
   cin>>c.batteryLevel;
   int checkBattery=c.getBatteryLevel(c.batteryLevel);
   if(checkBattery==0){
       cout<<\"Enjoy Your Journey Battery is Full\"<<endl;
   }else if(checkBattery==1){
       cout<<\"Battery is in average Mode\"<<endl;
   }
   else{
       cout<<\"You can not start car as Battery is discharged\"<<endl;
       exit(0);
   }
   cout<<\"Enter the Gas Level\"<<endl;
   cin>>c.gasLevel;

   cout<<\"Enter the direction in which you want to go\";
   cout<<\"Enter 1 for Straight\"<<endl;
   cout<<\"Enter 2 for Left\"<<endl;
   cout<<\"Enter 3 for Right\"<<endl;
   cout<<\"Enter 4 for Back\"<<endl;
   cout<<\"Enter choice for direction\";
   cin>>c.direction;
   cout<<\"\ Enter the gear which you want backward or forward\"<<endl;
   cout<<\"Enter 1 for Forward\"<<endl;
   cout<<\"Enter 2 for Backward\"<<endl;
   cin>>c.gear;
   c.startCar(c);
   c.parkCar();
   cout<<\"Enter -1 for Exit\"<<endl;
   cin>>ch;
   }
}

Please I need help with this! Lanuage: C++ Write OO Program. ***************************************************************************************************
Please I need help with this! Lanuage: C++ Write OO Program. ***************************************************************************************************
Please I need help with this! Lanuage: C++ Write OO Program. ***************************************************************************************************

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site