For this C++ hw do the following: Your game, the player’s goal is to reach campus exactly. The player starts 14 miles away and has up to 4 turns to reach campus. At each turn the play can ride either use a Bus, a Subway, or a Jetpack: Riding a Bus moves the player forward 2 miles each turn. Riding a Subway moves the player forward 5 miles each turn Riding a Jetpack moves the player forward 10 mile each turn. Example:You are 14 mile(s) from campus!How do you wish to travel? (1 bus, 2 subway, 3 jetpack) The player chooses one. After each turn, the player is informed how much farther she must travel before reaching campus. Winning/Losing: After the last turn, if the player has reached campus exactly ("You have won!")    Otherwise, explain the problem:  "You have over-shot your target!" or "You haven't reached your target!"    And then write “You lose!” The game will operate as follows: Report how far the user is from campus – the player starts 14 mile away For each turn: o Ask user to select transport method (Bus, Subway, or Jetpack) o Report the user’s new distance from campus o If the player has reached campus or passed campus and it is not the fourth turn, end the game early – This is a more challenging step! Make sure the rest of your game works before working on this step. ALSO: Check that the user input is valid (1-3). If the user fails to pick a valid number, the program must keep asking the user for a new selection until a valid number is entered. ALSO-  you do not lose turns by making an invalid selection.     Use this wording:      Invalid choice, try again! Requirements: You must use a loop (while, do-while, or for) to loop through the 4 turns. (The loop can include a condition to allow ending early, if you so choose.) You must use at least one if or switch statement Require the user enters one of three numbers to specify the transport method Example Output: You are 14 mile(s) from campus! How do you wish to travel? (1 bus, 2 subway, 3 jetpack) 2 You are 9 mile(s) from campus! How do you wish to travel? (1 bus, 2 subway, 3 jetpack) 1 You are 7 mile(s) from campus! How do you wish to travel? (1 bus, 2 subway, 3 jetpack) 1 You are 5 mile(s) from campus! How do you wish to travel? (1 bus, 2 subway, 3 jetpack) 2 You are 0 mile(s) from campus! You have won!

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

For this C++ hw do the following:

Your game, the player’s goal is to reach campus exactly.

The player starts 14 miles away and has up to 4 turns to reach campus.

At each turn the play can ride either use a Bus, a Subway, or a Jetpack:

  • Riding a Bus moves the player forward 2 miles each turn.
  • Riding a Subway moves the player forward 5 miles each turn
  • Riding a Jetpack moves the player forward 10 mile each turn.

Example:
You are 14 mile(s) from campus!
How do you wish to travel? (1 bus, 2 subway, 3 jetpack)

The player chooses one.

After each turn, the player is informed how much farther she must travel before reaching campus.

Winning/Losing: After the last turn, if the player has reached campus exactly ("You have won!")

   Otherwise, explain the problem:  "You have over-shot your target!" or "You haven't reached your target!"

   And then write “You lose!”

The game will operate as follows:

  • Report how far the user is from campus – the player starts 14 mile away
  • For each turn:

o Ask user to select transport method (Bus, Subway, or Jetpack)

o Report the user’s new distance from campus

o If the player has reached campus or passed campus and it is not the fourth turn, end the game early – This is a more challenging step! Make sure the rest of your game works before working on this step.

ALSO:

Check that the user input is valid (1-3).

If the user fails to pick a valid number, the program must keep asking the user for a new selection until a valid number is entered. ALSO-  you do not lose turns by making an invalid selection.

    Use this wording:      Invalid choice, try again!

Requirements:

  • You must use a loop (while, do-while, or for) to loop through the 4 turns. (The loop can include a condition to allow ending early, if you so choose.)
  • You must use at least one if or switch statement
  • Require the user enters one of three numbers to specify the transport method

Example Output:

You are 14 mile(s) from campus!

How do you wish to travel? (1 bus, 2 subway, 3 jetpack) 2

You are 9 mile(s) from campus!

How do you wish to travel? (1 bus, 2 subway, 3 jetpack) 1

You are 7 mile(s) from campus!

How do you wish to travel? (1 bus, 2 subway, 3 jetpack) 1

You are 5 mile(s) from campus!

How do you wish to travel? (1 bus, 2 subway, 3 jetpack) 2

You are 0 mile(s) from campus!

You have won!

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 1 images

Blurred answer
Knowledge Booster
Mathematical functions
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education