Question

In: Computer Science

Please use a switch statement to tell the user that his work is great, good, satisfactory,...

Please use a switch statement to tell the user that his work is great, good, satisfactory, or he barley passed based on his grade (A : great work, B : good, C: satisfactory, D: Barley passed) This program must be in C++ and must be able to run.

Thank you and I hope you have a great day!

Solutions

Expert Solution

#include<iostream>
using namespace std;
int main()
{
   char grade;
   cout<<" A,B,C,D enter you grade from this options"<<endl;
   scanf("%c",&grade);
   switch(grade) //grade contains input from user switch statment matches that input with given cases, case which is match is gegts executed
   {
      case 'A': cout<<"great work"<<endl;
             break;
      case 'B':cout<<"good "<<endl;
             break;
      case 'C':cout<<"Satisfactory"<<endl;
             break;
      case 'D':cout<<"Barley passed"<<endl;
             break;
      default:
             cout<<"please enter correct grade";//if grade is other than A,B,C,D
             break;
     }
     return 0;
}


Related Solutions

USING THE SWITCH STATEMENT - Write a java program that asks the user to enter the...
USING THE SWITCH STATEMENT - Write a java program that asks the user to enter the number of their favorite month of the year – obviously, that would be 1 – 12. Write a switch statement that takes the number and converts it to the fully spelled out name [ex. 3 would be MARCH] . Be sure to build in error message to catch any invalid data entries such as 0 or 13 etc. Print out the number that was...
Please review “The World of Work.” What are your own plans for achieving a satisfactory work–life...
Please review “The World of Work.” What are your own plans for achieving a satisfactory work–life balance after graduating from college? Based on the research in this section, how realistic do you think your goals are?
Write a program using switch statement that asks user to enter the month number and then...
Write a program using switch statement that asks user to enter the month number and then it prints out the number of days for that month. For simplicity reasons have your program print 28 days for February no matter if it is a leap year or not. Your program should also handle any invalid month numbers that user could enter (hint use default for the switch). Use a while loop to allow user to test for different month entries till...
Python #Use an input statement to ask the user for his/her age (no prompt) and assign...
Python #Use an input statement to ask the user for his/her age (no prompt) and assign the user entry to a variable #Convert the user input to an integer and assign to a variable #Write if-elif-else statements with the following conditions and actions #Important: For each Action below, use the same variable name for the rating in all the if, elif, and else statements #Condition: user input less than or equal to 9 Action: assign the letter G as a...
Write a program using the switch statement to calculate geometric quantities. Prompt the user to enter...
Write a program using the switch statement to calculate geometric quantities. Prompt the user to enter a radius. Then present a menu of choices for quantities to be calculated from that radius:                         A         Area of a Circle                         C         Circumference of a Circle                         S          Surface Area of a Sphere                         V         Volume of a Sphere Prompt the user to enter the character corresponding to the quantity to be calculated. Use a switch statement to handle the calculations. Use...
Use a switch statement to write a function that returns TRUE if a character is a...
Use a switch statement to write a function that returns TRUE if a character is a consonant and returns FALSE otherwise.
“There is no luck. Only good marketing” Please provide your opinion about this statement. Please use...
“There is no luck. Only good marketing” Please provide your opinion about this statement. Please use examples and academic sources to support your discussion. - Discussion in 300 words - Use at least 2 examples to illustrate your discussion - Use at least2 academic sources to support your argument.
Add logic to tell me to switch to unlimited if I go over $75. Use C++...
Add logic to tell me to switch to unlimited if I go over $75. Use C++ /******************************************************************************* ** Program Name: Verizons Monthly Bill Calculator. ** File Name: file a03.cpp. ** Author: Natassha Quiroz ** Date: October 18, 2020 (updated 10/20/20) ** Assignment: 03 ** Description: The purpose of this program is to calculate the consumers monthly cell ** phone bill based on data usage. ** Sources: Lecture slides, lecture videos and practice programs from lecture video. *******************************************************************************/ #include <iostream> #include...
WRITTEN IN C PLEASE. Write a switch statement that tests the value of the char variable...
WRITTEN IN C PLEASE. Write a switch statement that tests the value of the char variable response and performs the following actions: if response is y, the message Your request is being processed is printed if response is n, the message Thank you anyway for your consideration is printed if response is h, the message Sorry, no help is currently available is printed for any other value of response, the message Invalid entry; please try again is printed
Please write a Java program using a for loop with a switch statement to enter 5...
Please write a Java program using a for loop with a switch statement to enter 5 quiz scores. Each should be out of ten points and give the corresponding grade A, B , C etc.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT