@asoushu4

Are you sure you want to delete the question?

If your question is resolved, you may close it.

Leaving a resolved question undeleted may help others!

We hope you find it useful!

C++

Q&A

C++

このリクワイアメントに沿ったコードどうすれば作れますか。Create a class called ACAR.
Have several variables - use necessary variables that store
gas tank size, amount of gas currently in tank, gear car is in, direction car is going ( Forward, backward, left, right ).. etc
Have functions that do: ( Create a Dashboard/Menu listing options: Have 'User' select an option, and the programs calls and executes the appropriate function - and updates the appropriate variables )
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 battery 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 from the MENU, have it print out messages for each action, and its results.
Be sure to: Have a dashboard/Interface in which the user can make interactive/Live choices on how to drive the car.
NOTE: These functions will interact with the variables and other functions.

発生している問題・エラー

出ているエラーメッセージを入力:特にないです。

例)

NameError (uninitialized constant World)

または、問題・エラーが起きている画像をここにドラッグアンドドロップ

該当するソースコード

ソースコードを入力

例)

def greet
  puts Hello World
end

自分で試したこと

#include
using namespace std;

class ACAR{
int GasTankSize = 100;
int AmountOfGasCurrentlyInTank = 80;
int GearCarIsIn;
int BatteryLevel = 50;
string DirectionCarIsGoing;

void CheckTheBatterylevel(){}
    
void CheckTheGaslevel(){}
    
void TurnRight(){}

void TurnLeft(){}

void GoStraight(){}

void PutCarInForwardGear(){}

void PutCarInBackwardGear(){}

void StartCar(){
    if (BatteryLevel > 0 && AmountOfGasCurrentlyInTank > 0){
        cout << "Your car started "<< endl;
        }
    else if (BatteryLevel == 0 || AmountOfGasCurrentlyInTank == 0){
        cout << "Your car is not started" << endl;
        if (BatteryLevel == 0){
            cout << " your battery is empty" << endl;
        }
        else if (AmountOfGasCurrentlyInTank == 0){
            cout << " your gas is empty" << endl;
        }
    }

}

int main(){
    
};
0 likes

1Answer

Comments

  1. @asoushu4

    Questioner

    お金要求されて見れないんですよ。。。見れました?

  2. お金要求されました?
    Googleアカウントでログインできませんか?

    chegg.png
  3. @asoushu4

    Questioner

    アカウントは作ったのですが、ダメみたいです。。。

Your answer might help someone💌