Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Exercise 2: more branches Your goal is to build a simple menu system: Ask the us

ID: 3750569 • Letter: E

Question

Exercise 2: more branches Your goal is to build a simple menu system: Ask the user "What do you want to do tonight?", with the options a. Go to the movies (Response: "I know just the movie to seel") b. Eat out (Response: "Great! I've been wanting to try that new Tuvaluan restaurant!") c. Hang out at the Mall (Response: "You bring the cashl") d. Go watch the Dodgers (Response: "Take me out to the ball game...") Any other choice should get the response: "Nothing suits you, then? I guess we'll just stay and programI" Your menu must be "user friendly" -i.e. it should understand either 'a'or A'as a user input. Use compound boolean expressions to handle this. DO NOT USE A SWITCH STATEMENT!! DO NOT copy and paste from Google Docs or any other fancy word editing program. Not al characters translate easily and sometimes there are hidden characters. This is especially true for characters like apostrophes

Explanation / Answer

#include<iostream>
using namespace std;
int main()
{
char response;
cout<<"What do you want to do tonight?"<<endl;
cout<<"a. Go to the movie"<<endl;
cout<<"b. Eat out"<<endl;
cout<<"c. Hang out at the Mall"<<endl;
cout<<"d. Go watch the Dodgers"<<endl;
cin>>response;
if(response=='a'||response=='A')
cout<<"I know just the movies to see!";
else if(response=='b'||response=='B')
cout<<"Great! I've been waiting to try that new Tuvaluan Restaurant!";
else if(response=='c'||response=='C')
cout<<"You bring the cash!";
else if(response=='d'||response=='D')
cout<<"Take me out to the ball game...";
else
cout<<"Not a valid choice!";
}