Go back to In Class Lab A where you created a Game Menu.
Modify your code so that the user can input one of the four choices.
Use an if/else statement so that depending on the user’s choice, the correct game will play. If the user inputs a 4 (Exit), your code exits without playing any game.
For the MATH and MADLIBS choices, use your code from Lab 1. For the CHOOSE YOUR OWN ADVENTURE choice, write the code. Write a cohesive story that allows the user to make decisions as to what to do next, and display the story accordingly. For example, you might ask the user if he/she wants to take the A, F, or B train. Depending on the answer, ask another question. Here is a sample output for this question, but you can make yours very different!
Hello! You are at Atlantic Ave in Brooklyn! Please let me know if you are taking the F, Q or B train!
B
Great! Enter 1 to go to Manhattan or 2 to go to Coney Island
2
Wow! You are looking toward a terrific adventure!
You are off the train now! Do you want to go jogging on the beach or to the amusement park (enter ‘jogging’ or ‘amusement’)?
amusement
Have fun! How much money do you want to spend? Once I know that, I will give you a choice of rides! Then you will be on your own!
20.00
OK! Choose the Bumper Cars or the Rolling Thunder Roller Coaster!
I've written a simple story for first choice. Complete the rest of the stories. I've provided template for the same
Code
#include <bits/stdc++.h>
using namespace std;
void story1(){
int choice;
char ch;
cout<<"Hello!! You are in Atlantic ocean. You chose a boat or submarine?(b/s): ";
cin>>ch;
if(ch=='b'){
cout<<"You are on a boat!! You see a shark. What to do next? Fight(f) or run(r)? ";
cin>>ch;
if(ch=='f'){
cout<<"You lose!! You are dead!! Game over!!\n";
}
else if(ch=='r'){
cout<<"You lose!! Shark was faster!! Game over!!\n";
}
else{
cout<<"Invalid choice! Game over!!\n";
}
}
else if(ch=='s'){
cout<<"You are on a submarine!! You see a whale. What to do next? Quit(q) or run(r)? ";
cin>>ch;
if(ch=='q'){
cout<<"You were eaten by whale!! Game over!!\n";
}
else if(ch=='r'){
cout<<"You lose!! Whale was faster!! Game over!!\n";
}
else{
cout<<"Invalid choice! Game over!!\n";
}
}
else{
cout<<"Invalid choice! Game over!!\n";
}
}
void story2(){
//complete your story
}
void story3(){
//complete your story
}
int main(){
cout<<"1. Atlantic Adventure\n";
cout<<"2. Pirate Attack\n";
cout<<"3. Adventure of Tom\n";
cout<<"4. Exit\n";
cout<<"Enter your choice: ";
int choice;
cin>>choice;
if(choice==1){
story1();
}
else if(choice==2){
story2();
}
else if(choice==3){
story3();
}
}
Go back to In Class Lab A where you created a Game Menu. Modify your code...
Written in Python In this lab, you are to build a trivia game. The game should present each question – either in order or randomly – to the player, and display up to four possible answers. The player is to input what they believe to be the correct answer. The game will tell the player if they got it right or wrong and will display their score. If they got it right, their score will go up. If they got...
Modify your PredictGPA.java file from Lab 2 to create a method called GPA that takes a string argument (the grade) and returns the corresponding value (ie 4.0 for an A, 3.33 for a B+, etc). Use this method call to reduce the “redundant” code that you had in Lab 2. The program must otherwise still run correctly as to the directions in Lab 2 and compute the GPA after using the method calls to determine the appropriate grade values. Trying...
Using python 3.7.3 Challenge: Rock, Paper, Scissors GamePDF Description: Create a menu-driven rock, paper, scissors game in Python 3 that a user plays against the computer with the ability to save and load a game and its associated play statistics. Purpose: The purpose of this challenge is to assess the developer’s ability to create an interactive application with data persistence in Python 3. Requirements: Create a Rock, Paper, Scissors game in Python named rps.py according to the requirements specified in...
You will create your own silly story based on information provided by the user. For example, the parts in bold were entered by the user. For ideas see: Mad Libs. My Silly Story name: Frank Zhang whole number: 345 body part: stomach noun: cup floating point number: 1.23 clothing article: hat destination: Colorado goal: degree The resulting story is: Congratulations! Today is your 345 day. You're off to Colorado! You're off and away! You have brains in your stomach, You...
Create the game hangman using c code: Program description In the game of hangman, one player picks a word, and the other player has to try to guess what the word is by selecting one letter at a time. If they select a correct letter, all occurrences of the letter are shown. If no letter shows up, they use up one of their turns. The player is allowed to use no more than 10 incorrect turns to guess what the...
For your Project, you will develop a simple battleship game. Battleship is a guessing game for two players. It is played on four grids. Two grids (one for each player) are used to mark each players' fleets of ships (including battleships). The locations of the fleet (these first two grids) are concealed from the other player so that they do not know the locations of the opponent’s ships. Players alternate turns by ‘firing torpedoes’ at the other player's ships. The...
Using C programming REQUIREMENTS: This program is a letter guessing game where a simple Al opponent generates a secret letter for the user to guess. The user must be able to take turns guessing the secret letter, with the Al responding to the user's guesses. After successfully guessing, the user must be allowed to play again. The Al must count how many turns the user has taken. Here is an example of a game in progress where the human user...
How can you solve this problem using if statements? CSCI 206 Lab Date: 27 March 2020 Lab 8 - Coffee Switches Due: 2 April 2020 Please submit your lab on Moodle. Since we are not meeting Friday, March 27, you must fill out your attendance assignment in your lecture section on Moodle. There is now a new category called Friday Attendance. Please go there and do the attendance assignment to be marked for attendance. Notes: . Carefully read and adhere...
For this lab you will write a Java program that plays the dice game High-Low. In this game a player places a bet on whether the sum of two dice will come up High (totaling 8 or higher), Low (totaling 6 or less) or Sevens (totaling exactly 7). If the player wins, they receive a payout based on the schedule given in the table below: Choice Payout ------ ------ High 1 x Wager Low 1 x Wager Sevens 4 x...
In java language here is my code so far! i only need help with the extra credit part For this project, you will create a Rock, Paper, Scissors game. Write a GUI program that allows a user to play Rock, Paper, Scissors against the computer. If you’re not familiar with Rock, Paper, Scissors, check out the Wikipedia page: http://en.wikipedia.org/wiki/Rock-paper-scissors This is how the program works: The user clicks a button to make their move (rock, paper, or scissors). The program...