Homework 04

Due 03/01/2024 by 11:55PM

Pothole Driving

 

Objective: 

Write a game where you are a car, represented by the character ‘X’, trying to avoid pots holes in order to get home. As visibility is very low, the car can only move one space at a time, and if the space is a pothole, then the player loses, and the game is over. However, if they manage to reach home, the player won, and the game is over.

 

Requirements:

 

 

Example Dialog:

*The following Example Dialog demonstrates the interactions between a user and ONE possible implementation of the required software’s front-end / user interface. The software’s front-end / user interface may be implemented in MANY different ways and will receive full credit as long as it meets the most minimal of the above requirements. While you may use the example dialog as a guide, it is strongly encouraged to create the front-end / user interface in your own way. *

Key

Unhighlighted Text

Program’s Output

Highlighted Text

User’s Input

 

Welcome to Pothole Driving!  Get home while avoiding potholes!

X_________

__________

__________

__________

__________

__________

__________

__________

__________

_________^

Enter either a -1, 0, or 1 in the X or 9 to quit

1

Enter either a -1,0, or 1 in the Y

1

__________

_X________

__________

__________

__________

__________

__________

__________

__________

_________^

Enter either a -1, 0, or 1 in the X or 9 to quit

0

Enter either a -1,0, or 1 in the Y

1

__________

__________

_X________

__________

__________

__________

__________

__________

__________

_________^

Enter either a -1, 0, or 1 in the X or 9 to quit

-1

Enter either a -1,0, or 1 in the Y

1

OH NO! POTHOLE!

Would you like to play again?

No

Goodbye!

 

Finally:

Upload the solution’s source file (.JAVA extension) to the CSCE Dropbox