How to create the classes


Discussion:

Q: Create a class called car.

Have several variables with the 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 forward gear

Put 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 100 feet) ( sub tract 1 unit of gas per 100 feet traveled) As the car moves (determine if it needs gas)

Solution Preview :

Prepared by a verified Expert
C/C++ Programming: How to create the classes
Reference No:- TGS01937183

Now Priced at $25 (50% Discount)

Recommended (91%)

Rated (4.3/5)