Problem

A Video Arcade Car Racing GameYou are writing software that controls a car racing game. At...

A Video Arcade Car Racing Game

You are writing software that controls a car racing game. At the start of the game, the drivers choose their cars, and each car races down a simulated course through either a city or country landscape. Each car has a brake, accelerator, gears, and a steering wheel. Methods for all cars include:

  void accelerate(int x)  void brake(int x)

where x is a number from 1 to 10 indicating how far down the accelerator/brake pedal is pressed

  void turn(int x)

where x is an angle ranging from –180 to 180.

  void gear(int x)

where x is a gear from 0 to 4, 0 meaning reverse.

Different cars respond differently to these methods. For example, a large, heavy car does not accelerate or brake as quickly as a light car. A really fast car has a higher maximum speed than a slower car. Cars become damaged in the race, and damaged cars respond differently when accelerating, braking, and turning.

A driver can choose from hundreds of different cars. Every car has a color, a length, a maximum speed, a damage value, and a weight. Some cars have extra features such as guns, oil sprayers, or tire cutters—and methods are required to manipulate these features.

You would like to add cars to the game with minimum change in software. Design a hierarchy that enables the easy addition of new types of cars. The hierarchy should use Car at the top level, with SUV (big, strong, relatively slow), Formula1Racer (light and fast, fragile), StockCar (all around performer), and FunnyCar (very fast, not easily controlled, very fragile) extending Car. Indicate all classes, methods, attributes, and method signatures of each class.

Be sure to indicate which classes are abstract and which methods in these classes are abstract.

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
Solutions For Problems in Chapter 12
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT