Question

Write a C++ program that will provide a user with a grade range if they enter a letter grade. Your program should contain one
0 0
Add a comment Improve this question Transcribed image text
Answer #1

:: O .. ~ * dhe TDM-GCC 4.9.2 64-bit Release v C:\Users\LENOVU\Documents Untitledc++.cpp - [Executing) - Dev-C++ 5.11 File Ed

 #include <iostream> using namespace std; int main() {    char grade; cout << "\nEnter the letter for grade: "; cin >> grade; switch (grade) { case 'A': /* Marks between 90-100 */ cout << "\nYour numeric grade was between 90 and 100"<< endl; break; case 'B': /* Marks between 80-89 */ cout << "\nYour numeric grade was between 80 and 89"<< endl; break; case 'C': /* Marks between 70-79 */ cout << "\nYour numeric grade was between 70 and 79"<< endl;; break; case 'D': /* Marks between 60-69 */ cout << "\nYour numeric grade was between 60 and 69"<< endl; break; case 'E': cout<< "\nYour numeric grade was below 60"<< endl; default: cout << "\nInvalid letter grade"<< endl; break; } return 0; }

CODE:

#include <iostream>

using namespace std;

int main()

{

   char grade;
cout << "\nEnter the letter for grade: ";

cin >> grade;
  
switch (grade)

{
case 'A':

/* Marks between 90-100 */
cout << "\nYour numeric grade was between 90 and 100"<< endl;
break;
  
case 'B':

/* Marks between 80-89 */
cout << "\nYour numeric grade was between 80 and 89"<< endl;
break;

case 'C':

/* Marks between 70-79 */
cout << "\nYour numeric grade was between 70 and 79"<< endl;;
break;

case 'D':

/* Marks between 60-69 */

cout << "\nYour numeric grade was between 60 and 69"<< endl;

break;

case 'E':
  
cout<< "\nYour numeric grade was below 60"<< endl;

default:

cout << "\nInvalid letter grade"<< endl;
break;
}

return 0;
}

Add a comment
Know the answer?
Add Answer to:
Write a C++ program that will provide a user with a grade range if they enter...
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
  • Matlab a) Write a MATLAB code that takes the grade letters from the user and provide him/her with the GPA for that seme...

    Matlab a) Write a MATLAB code that takes the grade letters from the user and provide him/her with the GPA for that semester Enter your grades (letters): AABBC (input) Your GPA is 3.2 output) b) Write a Matlab user defined function to that takes a letter grade and return a numeric grade as shown in the table below. Any other value should give an error message (Invalid Grade). You function name should be Letter2Grade Use the following information to calculate...

  • This is in C++. Example: You will write a program that will prompt the user to...

    This is in C++. Example: You will write a program that will prompt the user to enter a grade out of 100 and then show them what the equivalent grade points value is. The main() function will handle the input and output tasks, but the actual conversion will occur in a function called GradePoints(). GradePoints Specifications This function is strictly a processing function, meaning that there are no console input or output steps in the actual function. Consider that this...

  • Part I Create a Java program that inputs a grade from the user. The grade input...

    Part I Create a Java program that inputs a grade from the user. The grade input from the user will be an integer. Once the input is stored, use an if-else-if block of code to determine the letter grade of the inputted integer grade. Do not use a bunch of if statements by themselves to solve this problem. You will print an error message for inputs greater than 100 and for inputs less than 0. Both errors must be handled...

  • SOLVE IN PYTHON:Exercise #1: Design and implement a program (name it AssignGrades) that stores and processes...

    SOLVE IN PYTHON:Exercise #1: Design and implement a program (name it AssignGrades) that stores and processes numeric scores for a class. The program prompts the users to enter the class size (number of students) to create a single-dimensional array of that size to store the scores. The program prompts the user to enter a valid integer score (between 0 and 100) for each student. The program validates entered scores, rejects invalid scores, and stores only valid scores in the array....

  • Java programming only Create a Java program that inputs a grade from the user. The grade input from the user will be an...

    Java programming only Create a Java program that inputs a grade from the user. The grade input from the user will be an integer. Once the input is stored, use an if-else-if block of code to determine the letter grade of the inputted integer grade. Do not use a bunch of if statements by themselves to solve this problem. You will print an error message for inputs greater than 100 and for inputs less than 0. Both errors must be...

  • C Programming Quesition (Structs in C): Write a C program that prompts the user for a...

    C Programming Quesition (Structs in C): Write a C program that prompts the user for a date (mm/dd/yyyy). The program should then take that date and use the formula on page 190 (see problem 2 in the textbook) to convert the date entered into a very large number representing a particular date. Here is the formula from Problem 2 in the textbook: A formula can be used to calculate the number of days between two dates. This is affected by...

  • 1. Create a program that takes a numerical score and outputs a letter grade. 2. In...

    1. Create a program that takes a numerical score and outputs a letter grade. 2. In this program, create two void functions titled makeScore and theGrade with an int argument. 3. The function makeScore should have a Reference parameter and theGrade should have a Value parameter. Note: Specific numerical scores and letter grades are listed below: 90-100 = Grade A 80-89 = Grade B 70-79 = Grade C 60-69 = Grade D 0-59 = Grade F 4. The function makeScore...

  • Java Programming Language Edit and modify from the given code Perform the exact same logic, except...

    Java Programming Language Edit and modify from the given code Perform the exact same logic, except . . . The numeric ranges and corresponding letter grade will be stored in a file. Need error checking for: Being able to open the text file. The data makes sense: 1 text line of data would be 100 = A. Read in all of the numeric grades and letter grades and stored them into an array or arraylist. Then do the same logic....

  • In C++ write a program that will read three strings from the user, a phrase, a...

    In C++ write a program that will read three strings from the user, a phrase, a letter to replace, and a replacement letter. The program will change the phrase by replacing each occurrence of a letter with a replacement letter. For example, if the phrase is Mississippi and the letter to replace is 's' the new phrase will be "miizzizzippi". in the function, replace the first parameter is a modifiable string, the second parameter is the occurrence of a letter...

  • 14.3: More Sentences Write a program that allows a user to enter a sentence and then...

    14.3: More Sentences Write a program that allows a user to enter a sentence and then the position of two characters in the sentence. The program should then report whether the two characters are identical or different. When the two characters are identical, the program should display the message: <char> and <char> are identical! Note that <char> should be replaced with the characters from the String. See example output below for more information. When the two characters are different, the...

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