Question

"basic stamp 2" I’m having a hard time making a code with conditional statements. Please can...

"basic stamp 2"

I’m having a hard time making a code with conditional statements.
Please can you help me out
Basically it is
Since I have three options which are
A or B or C

I want to to pick let’s say B, so that means I want to open just this one. But I can’t seem to master the IF and ELSE codes as I know I need this ones in the loop

Please provide me the code

will give tumbs up
0 0
Add a comment Improve this question Transcribed image text
Answer #1

I am assuming you are using C or C++ programming language.

I am giving you simple example

Problem Statement

                 You are playing a game in which you will be asked to enter your choice three times and each time you must enter one option A, B or C.

If the user enters other than A,B or C ,then Give message as “Sorry your entry is not valid”

Test Case

For 1st time user enters option A

Expected Output

   You have entered option A in attempt 1

C++ code

#include <iostream>

#include <string.h> // for using strcmp

//

using namespace std;

int main()

{

   

for (int i=1;i<=3;i++) // for 3 times for the game

{

char choice;

cout<<"Enter your choice :"<<endl;

cin>>choice ;

if(choice== 'A')

    cout<<"You have entered option A in attempt " <<i<<endl;

else if(choice== 'B') // for choice B

    cout<<"You have entered option B in attempt " <<i<<endl;

else if(choice== 'C') // for choice B

    cout<<"You have entered option C in attempt " <<i<<endl;

   else

        cout<< "Sorry your entry is not valid "<<endl;

   

  

   

}

}

Add a comment
Know the answer?
Add Answer to:
"basic stamp 2" I’m having a hard time making a code with conditional statements. Please can...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • basic stamp 2.0 please what code or what should i look for in creating a code...

    basic stamp 2.0 please what code or what should i look for in creating a code for a cocktail maker with two glasses options to serve basically a code that will allow me to put in the exact amount of drink into a customers desire glass. i already made the actual physical item with some components BUT now i need a code and we are required to use only basic stamp sofware ONLY just provide with code!!! OR what should...

  • Please help me code the following in: JAVA Please create the code in as basic way...

    Please help me code the following in: JAVA Please create the code in as basic way as possible, so I can understand it better :) Full points will be awarded, thanks in advance! Program Description Write a program that demonstrates the skills we've learned throughout this quarter. This type of project offers only a few guidelines, allowing you to invest as much time and polish as you want, as long as you meet the program requirements described below. You can...

  • can someone help me fix my jeopardy dice game I am having a hard time figuring...

    can someone help me fix my jeopardy dice game I am having a hard time figuring out what i am doing wrong #include #include using namespace std; //this function makes a number between 1 and 6 come out just like a dice int rollDie() { return (rand() % 6+1); } //this function asks the user with a printed statement if they want to roll the dice and gives instructions for yes and no (y/n) void askYoNs(){ cout<<"Do you want to...

  • Jack Adam’s mind wandered as he sat outside Bill Squire’s office awaiting his yearly performance review…...

    Jack Adam’s mind wandered as he sat outside Bill Squire’s office awaiting his yearly performance review… [Jack thinking.] Well, it’s 8:25. Five more minutes to go. Fifteen years with the company, and this new district manager, Squire, couldn’t even call and request this meeting personally. These annual performance appraisals are tough enough, and here I’ve got a bad sales record for the past 12 months. Surely he’ll be able to understand that the sales decreases were a result of the...

  • Hi. Could you help me with the code below? I need to validate the code below, using expressions that can carry out the actions or that make appropriate changes to the program’s state, using conditiona...

    Hi. Could you help me with the code below? I need to validate the code below, using expressions that can carry out the actions or that make appropriate changes to the program’s state, using conditional and iterative control structures that repeat actions as needed. The unit measurement is missing from the final output and I need it to offer options to lbs, oz, grams, tbsp, tsp, qt, pt, and gal. & fl. oz. Can this be added? The final output...

  • Can you please help me with creating this Java Code using the following pseudocode? Make Change C...

    Can you please help me with creating this Java Code using the following pseudocode? Make Change Calculator (100 points + 5 ex.cr.)                                                                                                                                  2019 In this program (closely related to the change calculator done as the prior assignment) you will make “change for a dollar” using the most efficient set of coins possible. In Part A you will give the fewest quarters, dimes, nickels, and pennies possible (i.e., without regard to any ‘limits’ on coin counts), but in Part B you...

  • The flight attendant had to ask her twice, “Anything to drink, ma’am?” “Oh, sorry. Water, no...

    The flight attendant had to ask her twice, “Anything to drink, ma’am?” “Oh, sorry. Water, no ice, please,” said Noelle Freeman, the CFO of Franklin Climate Systems. Watching the clouds out her window at 30,000 feet, she’d been deep in thought. She was on her way home from two days in Arkansas visiting her company’s largest facility. Franklin was in the business of designing, engineering, and manufacturing climate control systems for cars and SUVs. This is a division of FB...

  • **JAVA PLEASE!!** CSE205 Assignment 2 ASCII Terrain Generator 5Opts Topics: Arrays Multidimensional Arrays Metho...

    **JAVA PLEASE!!** CSE205 Assignment 2 ASCII Terrain Generator 5Opts Topics: Arrays Multidimensional Arrays Methods Loops and Conditionals Description The goal of this assignment is for you to produce a simple procedurally generated terrain map out of ASCII character symbols. This will be done through simple probability distributions and arrays Use the following Guideline s: Give identifiers semantic meaning and make them easy to read (examples numStudents, grossPay, etc) Keep identifiers to a reasonably short length. User upper case for constants....

  • Hi, Kindly assist with my project management assignment below using the attached case study Question 1 Update the project charter for the remainder of the project in response to Adams’ memo (lines 241...

    Hi, Kindly assist with my project management assignment below using the attached case study Question 1 Update the project charter for the remainder of the project in response to Adams’ memo (lines 241 through 246). Question 2 Prepare a plan for the remainder of the project in response to Adams’ memo (lines 241 through 246). Your answers to the above will be assessed in terms of the level of communication displayed, the insights and inferences drawn, and your ability to...

  • Hello! Could you please write your own four paragraph (5-6 sentences per paragraph) take away or...

    Hello! Could you please write your own four paragraph (5-6 sentences per paragraph) take away or reflection of the below information? Please complete in 24 hours if possible. Thank you! RIS BOHNET THINKS firms are wasting their money on diversity training. The problem is, most programs just don’t work. Rather than run more workshops or try to eradicate the biases that cause discrimination, she says, companies need to redesign their processes to prevent biased choices in the first place. Bohnet...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT