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
  • Question 2 Use a switch statement to write the following program: Using C++ The program prompts...

    Question 2 Use a switch statement to write the following program: Using C++ The program prompts the user for a letter grade (of type char). The list of valid letter grades is: A B C D E F The program should consider both lower and upper case The program will then display the following messages: For grade ‘A’: display “Excellent” For grade ‘B’: display “Good” For Grade ‘C’: display “Average” For grade ‘D’ or ‘E’: display “Below Average” For Grade...

  • 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...

  • USING PYTHON - Write a program that calls a function that prompts the user to enter...

    USING PYTHON - Write a program that calls a function that prompts the user to enter a real number. The function should verify that the user entered a valid real number, and should prompt the user to re-enter any invalid input. After a valid real number has been entered, the function should return the number as a number. To test your function, from a main function, call the function two separate times and print the sum of the two numbers...

  • 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...

  • Write a C program that allows a user to enter up to 30 student id’s and...

    Write a C program that allows a user to enter up to 30 student id’s and 3 grades per student. It will then compute and display a report of the students averages, and then a statement of the class average for those grades. The following is a sample run that demonstrates what your program should look like: Please enter your school name: Cape Tech Welcome to the Cape Tech Grade Calculator Enter the number of students to process (0 -...

  • 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....

  • Write a program that asks the user to enter five test scores. The program should display...

    Write a program that asks the user to enter five test scores. The program should display a letter grade for each score and the average test score. Design the following functions in the program: calcAverage—This function should accept five test scores as arguments and return the average of the scores. determineGrade—This function should accept a test score as an argument and return a letter grade for the score (as a String), based on the following grading scale: Round the average...

  • I've built a C++ program that calculates the user's class average based on three test. Can...

    I've built a C++ program that calculates the user's class average based on three test. Can somebody show me how to get the program to look for invalid input? #include <iostream> #include <string> #include <iomanip> using namespace std; int main() { //variables int score_1; //test 1 input from user int score_2; //test 2 input from user int score_3; //test 3 input from user int highest; // the higher score of test 1 & 2 int course_average; //average for class //Introduce...

  • 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...

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