This program should be written in C
... Error: The numeric grade must be less than or equal to 100. ...
Answer to the above question as follows-
we have to use nested if-else structure.
A nested if else means an if statement within another if statement.
These are considered to be faster than if-else-if ladder.
Required code for C language is as follows
#include <stdio.h>
int main() {
int n; // declaring variable n to store numeric grade
value
char grade; // declaring character grade to store
letter grade value
//Input
printf("Enter your numeric grade.\n");
scanf("%d",&n); // takng input from the user
//Evaluation
if( n>100 || n<0 ){ // check if invalid numeric
grade
printf("\n\n\n"); // print in desired format
printf(" Error: The numeric grade must be less than or
equal to 100.");
printf("\n\n\n");
exit(0); // exit from the program
}
else{
if ( n >= 90)
{
grade = 'A'; // assign grade A
}
else
{
if (n >= 80 && n <= 89)
{
grade = 'B'; // assign grade B
}
else
{
if (n >= 70 && n <= 79)
{
grade = 'C'; // assign grade C
}
else
{
if (n >= 60 && n <= 69)
{
grade = 'D'; // assign grade D
}
else
{
grade = 'F'; // assign grade F
}
}
}
}
}
//Output
printf("\nYour letter grade is %c\n",grade); //Display
the letter grade
return 0;
}
Screenshot of the executed code is as follows-
Screenshot of the tested output are-
Please COMMENT if you have any queries regarding the solution.
Please THUMBS UP and UPVOTE if you find the answer helpful and satisfactory.
Thank You !!!
This program should be written in C Thoroughly following the Code Conventions, write an efficient program,...
Write a grading program for the following grading policies:- a. There are two quizzes, each graded on the basis of 10 points. b. There is one midterm exam and one final exam, each graded on the basis of 100 points. c. The final exam counts for 50 percent of the grade, the midterm counts for 25 percent and the two quizzes together count for a total of 25 percent. Grading system is as follows:- >90 A >=80 and <90 B...
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....
Write a C++ program that will provide a user with a grade range if they enter a letter grade. Your program should contain one function. Your function will accept one argument of type char and will not return anything (the return type will be void), but rather print statements to the console. Your main function will contain code to prompt the user to enter a letter grade. It will pass the letter grade entered by the user to your function....
In C Langage Write a grading program for a class with the following grading policies:- a. There are two quizzes, each graded on the basis of 10 points. b. There is one midterm exam and one final exam, each graded on the basis of 100 points. c. The final exam counts for 50 percent of the grade, the midterm counts for 25 percent and the two quizzes together count for a total of 25 percent. Grading system is as follows:-...
using if/switch statements (C++) Write a grading program for a class with the following grading policies: There are two quizzes, each graded on the basis of 10 points There is one midterm exam and one final exam, each graded on the basis of 100 points The final exam counts for 50% of the grade, the midterm counts for 25% and the two quizzes together count for a total of 25%. (Do not forget to normalize the quiz scores. They should...
Test Scores and Grade Write a program that has variables to hold three test scores. The program should ask the user to enter three test scores and then assign the values entered to the variables. The program should display the average of the test scores and the letter grade that is assigned for the test score average. Use the grading scheme in the following table: Test Score Average Letter Grade 90–100 A 80–89 B 70–79 C 60–69 D Below 60...
Java Program: In this project, you will write a program called GradeCalculator that will calculate the grading statistics of a desired number of students. Your program should start out by prompting the user to enter the number of students in the classroom and the number of exam scores. Your program then prompts for each student’s name and the scores for each exam. The exam scores should be entered as a sequence of numbers separated by blank space. Your program will...
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: Score Letter Grade...
Create a MIPS program that does the following: 4. Determine the letter grade a. Use the floating point calculated average to determine the letter grade. You will need to research the instructions to use to do comparisons with floating point numbers. (see Course Resources) b. Use the following chart: 90 - 100 80 - 89 70 - 79 ............. 60 - 69.............. <60 ..................... ............... 5. Display a message and the letter grade. 6. Your output should look similar to...
Write a Java program that reads a file until the end of the file is encountered. The file consists of an unknown number of students' last names and their corresponding test scores. The scores should be integer values and be within the range of 0 to 100. The first line of the file is the number of tests taken by each student. You may assume the data on the file is valid. The program should display the student's name, average...