Question

: YOU MUST USE SWITCH STATEMENTS TO SOLVE THE NEXT TWO PROBLEMS DO NOT USE LOOPS!...

: YOU MUST USE SWITCH STATEMENTS TO SOLVE THE NEXT TWO PROBLEMS

DO NOT USE LOOPS!

For this problem you must run the program to show all of your menu options working, just like with Problem 1, you will have a screen shot for every menu option and then you will have a screen shot for entering a value that is not part of the menu option.

Write a program that displays the following menu to the user: Welcome to learning basic Spanish! Please select the phrase you would like to learn today from the following choices: 1. 2. 3. 4. 5. 6. Quit Enter your choice (1-6): Note: The numbers above are blank, because you are to select FIVE English phrases form the table found below. When the user selects a menu option, the Spanish translation should be displayed to them. Do not worry about displaying accent marks. If the user enters 6, the program should end. Input Validation: Display an error message if the user enters a number outside the range of 1 through 6 when selecting an item from the menu.

Good morning. Buenos días.

Good afternoon. Buenas tardes.

Good evening. (greeting) Buenas noches.

I am fine. Estoy bien.

Nice to meet you. Mucho gusto.

See you later. Hasta luego.

Homework Answers

Answer #1

Here I am providing the answer for the above problem:

Code:

#include <stdio.h>
int main()
{
int ch;
printf("Welcome to learning basic Spanish!\nPlease select the phrase you would like to learn today from the following choices: 1. 2. 3. 4. 5. 6.\nQuit Enter your choice (1-6):");
scanf("%d",&ch);
switch(ch)
{
case 1:
printf("Good morning. Buenos días.\n");
break;
case 2:
printf("Good afternoon. Buenas tardes.\n");
break;
case 3:
printf("Good evening. (greeting) Buenas noches.\n");
break;
case 4:
printf("I am fine. Estoy bien.\n");
break;
case 5:
printf("Nice to meet you. Mucho gusto.\n");
break;
case 6:
printf("See you later. Hasta luego.\n");
break;
default:
printf("This number is not in the range of 1-6.\n");
}
}

Screenshot of Code:

Output:

1.


2.

3.

4.

5.

6.Error Case:

Hoping that the above answer will help you...Thank you...

Know the answer?
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
Similar Questions
Selection control structure The if statement The switch statement (optional) Relational operators and logical operators Use...
Selection control structure The if statement The switch statement (optional) Relational operators and logical operators Use of relational and logical operators to check numeric ranges User friendly Use of user friendly user prompt and simple input validation Use of meaningful output labels and format Use of output manipulators Working with string type Use of getline() Project Description There are two main systems for measuring distance, weight and temperature, the Imperial System of Measurement and the Metric System of Measurement. Most...
For this assignment, you will be creating a simple “Magic Number” program. When your program starts,...
For this assignment, you will be creating a simple “Magic Number” program. When your program starts, it will present a welcome screen. You will ask the user for their first name and what class they are using the program for (remember that this is a string that has spaces in it), then you will print the following message: NAME, welcome to your Magic Number program. I hope it helps you with your CSCI 1410 class! Note that "NAME" and "CSCI...
Use C++ to implement the following program about Prime Factorization of a Number. Do BOTH parts...
Use C++ to implement the following program about Prime Factorization of a Number. Do BOTH parts of the problem or you will lose points. Provide comments to explain each step. a. Write a function that takes as a parameter a positive integer and returns a list (array) of the prime factors of the given integer. For example, if the parameter is 20, you should return 2 2 5. b. Write a function that tests the above function by asking the...
This is a Java program Program Description You work for a local cell phone company and...
This is a Java program Program Description You work for a local cell phone company and have been asked to write a program to calculate the price of a cell phone data plan being purchased by a customer. The program should do the following tasks: Display a menu of the data plans that are available to be purchased. Read in the user’s selection from the menu.  Input Validation: If the user enters an invalid option, the program should display an error...
USE C++!!!! Encryption and Decryption are two cryptographic techniques. Encryption is used to transform text to...
USE C++!!!! Encryption and Decryption are two cryptographic techniques. Encryption is used to transform text to meaningless characters, and decryption is used to transform meaningless characters into meaningful text. The algorithm that does the encryption is called a cipher. A simple encryption algorithm is Caesar cipher, which works as follows: replace each clear text letter by a letter chosen to be n places later in the alphabet. The number of places, n, is called the cipher key. For example, if...
You will write a program that loops until the user selects 0 to exit. In the...
You will write a program that loops until the user selects 0 to exit. In the loop the user interactively selects a menu choice to compress or decompress a file. There are three menu options: Option 0: allows the user to exit the program. Option 1: allows the user to compress the specified input file and store the result in an output file. Option 2: allows the user to decompress the specified input file and store the result in an...
How much money do you think you would earn in a period of 30 days if...
How much money do you think you would earn in a period of 30 days if you were paid as follows: one cent for the first day, two cents for the second day, four cents for the third day, eight cents for the fourth day, and so on (i.e. your salary doubles each day)? Do you think you would make very little money, just a few dollars, at the end of the 30-day period? Let us write a program to...
The premise of this project is to make a basic GUI and code for the game...
The premise of this project is to make a basic GUI and code for the game Keno. The specifics of the gui and game are below. Description: In this project you will implement the popular casino and state lottery game, Keno. This is a somewhat simple game to understand and play which should allow you to focus on learning GUI development in JavaFX and trying your hand at event driven programing. Implementation Details: You may add as many classes, data...
C++ PROGRAM SPECIFICATION For the assignment, we will use the previous assignment’s program that determines whether...
C++ PROGRAM SPECIFICATION For the assignment, we will use the previous assignment’s program that determines whether a college class room is in violation of fire law regulations regarding the maximum room capacity and add more logic to that program. We will need to make the following enhancements… The program should now determine the number of classes, and should do so by generating a unique, random number. Replace taking user input for the number of rooms with a computer generated number...
The second assignment will use C++ syntax and control flow stuctures (e.g. loops, switch statements, functions,...
The second assignment will use C++ syntax and control flow stuctures (e.g. loops, switch statements, functions, const int variables, structs, the standard library, enums, array, etc.) to create a pattern drawing application. A user of your application will be able to select a shape to draw that will be printed out to standard output using std::cout. This application will draw a fixed size 8x8 pattern. The patterns your application will support are: filled, half-left filled, banded, checkered, a square, an...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT