Question: In c++ language. Mission 4 : Construct a Car (Driving) Points : 50 Task Extend the functionality of Mission 3 to implement the logic for
Mission 4 : Construct a Car (Driving) Points : 50 Task Extend the functionality of Mission 3 to implement the logic for driving, which includes accelerating, braking and free-wheeling. Copy your previous solution to a new project Rules and Conditions . If the car is free-wheeling (no pedal is used), it slows down the car by 1 km/h by air resistance and rolling resistance. Braking is By a speed. Accelerating is to a speed (Remember. Every call of a method from the car correlates to 1 second) For every car the default acceleration is at most 10 km/h per second In a new further constructor of the car it should be possible to set a higher acceleration. The value has always to be in a range from 5 to 20. Correct it under minimum or above maximum . Every car brakes at most 10 km/h per second The maximum speed of a car is 250 km/h and of course it cannot have a negative speed The consumption for a driving car is be taken from these ranges 1-60 km/h -> 0.0020 liter/second 61 - 100 km/h -> 0.0014 liter/second 101 - 140 km/h -> 0.0020 liter/second o 141 - 200 km/h-> 0.0025 liter/second 201 - 250 km/h -> 0.0030 liter/second When the car brakes or freewheels with getting slower, there is no fuel consumption as in modern cars, when the car "powers" the engine.) for convenience the accelerations and brakings are always linear and consumption is only for the speed at the end of every second No considering on higher consumption while accelerating within a second Code (Additional) class Car void Brakeby(int speed); // car #2 void Accelerate(int speed); // car #2 void Freewheel(); // car #2 ); Class DrivingInformationDisplay // car #2 { int actualSpeed; Mission 4 : Construct a Car (Driving) Points : 50 Task Extend the functionality of Mission 3 to implement the logic for driving, which includes accelerating, braking and free-wheeling. Copy your previous solution to a new project Rules and Conditions . If the car is free-wheeling (no pedal is used), it slows down the car by 1 km/h by air resistance and rolling resistance. Braking is By a speed. Accelerating is to a speed (Remember. Every call of a method from the car correlates to 1 second) For every car the default acceleration is at most 10 km/h per second In a new further constructor of the car it should be possible to set a higher acceleration. The value has always to be in a range from 5 to 20. Correct it under minimum or above maximum . Every car brakes at most 10 km/h per second The maximum speed of a car is 250 km/h and of course it cannot have a negative speed The consumption for a driving car is be taken from these ranges 1-60 km/h -> 0.0020 liter/second 61 - 100 km/h -> 0.0014 liter/second 101 - 140 km/h -> 0.0020 liter/second o 141 - 200 km/h-> 0.0025 liter/second 201 - 250 km/h -> 0.0030 liter/second When the car brakes or freewheels with getting slower, there is no fuel consumption as in modern cars, when the car "powers" the engine.) for convenience the accelerations and brakings are always linear and consumption is only for the speed at the end of every second No considering on higher consumption while accelerating within a second Code (Additional) class Car void Brakeby(int speed); // car #2 void Accelerate(int speed); // car #2 void Freewheel(); // car #2 ); Class DrivingInformationDisplay // car #2 { int actualSpeed
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
