Question

In: Computer Science

Write a program that determines a student’s grade. The program will read three types of scores...

Write a program that determines a student’s grade. The program will read three types of scores
(quiz, mid-term, and final scores) and determine the grade based on the following rules:
-if the average score =90% =>grade=A
-if the average score >= 70% and <90% => grade=B
-if the average score>=50% and <70% =>grade=C
-if the average score<50% =>grade=F

Using Switch Statement

Need to code to be simple to understand. No pointers should be used

Solutions

Expert Solution

Required Program in C ++ -->


#include <iostream>
#include <conio.h>
using namespace std;
int main()
{
int quiz, miterm, final; //declare variables
cin>>quiz; //read quiz marks
cin>>miterm; //read miterm marks
cin>>final; //read final marks
float average =(quiz+miterm+final)/3; //find the average of the three
int x = average/10; //store the value of average when divided by 10 in integer format
switch(x){ //switch for x
case 0:
case 1:
case 2:
case 3:
case 4: cout<<"Grade = F"; //if case 0,1,2,3,4 then display F
break; //break
case 5:
case 6: cout<<"Grade = C"; //if case 5,6 then display C
break; //break
case 7:
case 8: cout<<"Grade = B"; //if case 7,8 then display B
break; //break
case 9:
case 10: cout<<"Grade = A"; //if case 9,10 then display A
break; //break
default:cout<<"Please Enter correct marks"; //if any other, then ask the user to enter correct values
}
return 0;
}

if marks are -> 50, 100, 50 -> then its average will be 200/3 = 66.67

and when 66.67 is divided by 10, its integer value will be 6, and then case 6 will be executed which will display C.


Related Solutions

Lab 3.4 Write a program that determines a student’s grade. The student will enter a grade...
Lab 3.4 Write a program that determines a student’s grade. The student will enter a grade and the program will determine if that grade is an A, B, C, D, or E. The student can only enter number 0-100. A = 90-100 B = 80-89 C = 70-79 D= 60-69 E = 59 or less Save the file as Lab3.4 and submit the file. Use https://repl.it/ THIS LANGUAGE IS PYTHON Thank you :)
Write a c++ program that given a set of letter grade/credit hour combiniation, determines the grade...
Write a c++ program that given a set of letter grade/credit hour combiniation, determines the grade point average (GPA) Each A is worth 4 points. Each B is worth 3 points. Each C is worth 2 points. Each D is worth 1 point, and Each F is worth 0 points. The total quality points earned is the sum of the product of letter grade points and associated course credit hours. The GPA is the quotient of the quality points divided...
c++ class homework Topics If/Else If statement Description Write a program that determines a student’s final...
c++ class homework Topics If/Else If statement Description Write a program that determines a student’s final grade in the course. The course had three tests (100 points each) and four assignments (also 100 points each). All the test scores make up 70% of the grade and all the assignments 30% of the grade. The program asks the user to input one by one each of the test scores and each of the assignment scores. From these scores, it computes the...
write a program that will display student grade if scores is greater than or equal to...
write a program that will display student grade if scores is greater than or equal to 70 to display A or else if score is less than or equal to 70 and greater than or equal to 60 display B if scores is less than 60 or greater than 50 display C else display fail.
Program 5A: Determine which student has the highest grade Write a Java program that determines which...
Program 5A: Determine which student has the highest grade Write a Java program that determines which student has the highest grade. You will ask the user to enter the number of students. Then you will ask for each student and their grade. You will output the name and grade of the student with the highest grade. You will NOT use an array for this assignment. Call your class Program5A, so your filename will be Program5A.java. It is essential for grading...
(Please write in C++) Write a program that reads in a line consisting of a student’s...
(Please write in C++) Write a program that reads in a line consisting of a student’s name, Social Security number, user ID, and password. The program outputs the string in which all the digits of the Social Security number and all the characters in the password are replaced by x. (The Social Security number is in the form 000-00-0000, and the user ID and the password do not contain any spaces.) Your program should not use the operator [ ]...
(C++) Write a program to read from a grade database (data.txt). The database (text file) has...
(C++) Write a program to read from a grade database (data.txt). The database (text file) has students names, and grades for 10 quizzes.Use the given function prototypes to write the functions. Have main call your functions. The arrays should be declared in main() and passed to the functions as parameters. This is an exercise in parallel arrays, int and char 2 dim arrays. Function prototypes: int readData(ifstream &iFile, int scores[][10], char names[][30]); This functions takes the file stream parameter inFile...
Write a program that prompts the user to enter the number of students and each student’s...
Write a program that prompts the user to enter the number of students and each student’s name and score, and finally displays the student with the highest score and the student with the second-highest score. Use the next() method in the Scanner class to read a name rather using the nextLine() method. This is my code , but i get this error Enter the number of students: Exception in thread "main" java.util.InputMismatchException    at java.util.Scanner.throwFor(Scanner.java:871)    at java.util.Scanner.next(Scanner.java:1494)    at...
Write a program that translates a letter grade into a number grade. Letter grades are A,...
Write a program that translates a letter grade into a number grade. Letter grades are A, B, C, D, and F, possibly followed by + or -. Their numeric values are 4, 3, 2, 1 and 0. There is no F+ or F-. A “+” increases the numeric value by 0.3, a “–“ decreases it by 0.3. However, an A+ has value 4.0.4 pts Enter a Letter grade: B- The numeric value is 2.7 Your code with comments A screenshot...
write a Java program Write a program to assign a letter grade according to the following...
write a Java program Write a program to assign a letter grade according to the following scheme: A: total score >= 90 B: 80 <= total score < 90 C: 70 <= total score < 80 D: 60 <= total score < 70 F: total score < 60 Output - the student's total score (float, 2 decimals) and letter grade Testing - test your program with the following input data: test1 = 95; test2 = 80; final = 90; assignments...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT