Question: How do I write this code for c++ on the MAC? Computer Science l: Lab 3 This lab will deal with loops. We will construct
How do I write this code for c++ on the MAC?

Computer Science l: Lab 3 This lab will deal with loops. We will construct a short computer game. For your game, the player's goal is to reach campus by the start of class. The player starts 14 miles away and has 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. After each turn, the player is informed how much farther she must travel before reaching campus. After the last turn, the player is informed either that she has reached campus ("You win!") or that she is not at campus ("You lost!"). 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. . Report if player has won or lost Note 1: You must decide the letter or number assigned to each transport method. If the user fails to pick a valid letterumber, the program must keep asking the user for a new selection until she enters a valid letterumber. You do not lose turns by making an invalid selection. - You may wish to write the code for this error-checking AFTER you have gotten other parts of your program to work 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.) e You must use at least one if or switch statement Require the user enters one of three letters or numbers to specify the transport method
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
