Question

In: Computer Science

Write a program that calculates the student's final grade for a test with 20 multiple questions...

Write a program that calculates the student's final grade for a test with 20 multiple questions using C# .net Framework.

se an array of integers to store the test scores (0-incorrect answer, 1-correct answer). Initialize it as follows:

int [] scores = {1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1};

3. If the student answered the question right, add 5 points to the running total. If the student didn’t answer correctly subtract .5 points from the running total.

4. The running total is initialized with 5 points (so the student receives 5 points extra credit).

5. To define the final grade use the grading scale below

Score

Grade

90+

A

80-89

B

70-79

C

60-69

D

<60

F

6. Write a helper method displayScoreGrade()that displays the score and calculated grade.

     private static void displayGrade(double score, char grade){

        //printing the score;

        //printing the grade;

        ...         

     }

  Call the method from the main method.

Solutions

Expert Solution

Code -


using System;
class HelloWorld {
//function to display Grade
private static void displayGrade(double score, char grade){
//calculate grade according to score
if(score>=90 && score <=100){
grade = 'A';
}
else if(score>=80 && score <=89){
grade = 'B';
}
else if(score>=70 && score <=79){
grade = 'C';
}
else if(score>=60 && score <=69){
grade = 'D';
}
else {
grade = 'F';
}
//print the grade in Console
Console.WriteLine("Total marks is "+score+" grade is "+grade );
}
static void Main() {
//SCORE ARRAY
int [] scores = {1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1};
int i;
//define sum by 5
double sum=5;
char grade='A';
//read the score from array and add marks to sum for correct answer
for(i=0;i<scores.Length;i++){
//correct answer check
if(scores[i] == 1){
sum+=5;
}
//incorrect answer check
else{
sum-=0.5;
}
}
//call function to dislay grade
displayGrade(sum,grade);

}
}

Screenshots -


Related Solutions

Question: How do I write a program in C# that calculates a student's final grade for...
Question: How do I write a program in C# that calculates a student's final grade for a test with 20 multiple questions using arrays and helper methods? Instructions: (0-incorrect answer, 1-correct answer) If the student answered the question right, add .5 points to the running total. If the student didn’t answer correctly subtract .5 points from the running total. The running total is initialized with 5 points (so the student receives 5 points extra credit). To define the final grade...
Create the pseudocode solution to a program that calculates the final score and letter grade for...
Create the pseudocode solution to a program that calculates the final score and letter grade for one student. Please use the following grading system: 9 Homework Assignments – 100 points each 10 points 11 Quizzes – 100 points each 5 points 5 Projects – 100 points each 10 points 6 Discussion posts – 100 points each 10 points 4 Exams – 100 points each 65 points A = 90 – 100% B = 80 – 89% C = 70 –...
Create a small program that calculates the final grade in this course, given the different assignments...
Create a small program that calculates the final grade in this course, given the different assignments and exams you will be required to take. The program should ask for all the grades through the semester, and as a final output it should compute the weighted average as well as give the final letter grade. You should use the syllabus for this course to calculate the final grade. • Five assignments worth 30 points each. • Three projects worth 100 points...
C# CODE C# 1) Write a program that calculates a student's GPA. Remember, an A is...
C# CODE C# 1) Write a program that calculates a student's GPA. Remember, an A is worth 4 points, a B is worth 3 points, a C is worth 2 points, a D is worth 1 point, and an F is worth 0 points. For the purposes of this assignment, assume that all classes carry the same number of credit hours. 2) Use a sentinel-controlled loop to gather a variable number of letter grades. This should terminate the loop if...
Write a C program that calculates a student grade in the C Programming Class. Ask the...
Write a C program that calculates a student grade in the C Programming Class. Ask the user to enter the grades for each one of the assignments completed in class: Quiz #1 - 25 points Quiz #2 - 50 points Quiz #3 - 30 points Project #1 - 100 points Project #2 - 100 points Final Test - 100 points The total of the quizzes count for a 30% of the total grade, the total of the projects counts for...
Write a C program that calculates the average grade for a specified number of students from...
Write a C program that calculates the average grade for a specified number of students from each student's test1 and test2 grades. The program must first ask the user how many students there are. Then, for each student, the program will ask the user for the test1 grade (grade #1) and test2 grade (grade #2). The program should be able to handle up to 100 students, each with 2 grades (test1 and test2). Use a two-dimensional float array to store...
C++ Description: You will write a program that reads students names followed by their final grade....
C++ Description: You will write a program that reads students names followed by their final grade. It will output the names and their grade, followed by the corresponding letter grade. It will also print the name of the students(s) with the highest grade Student data will be stored in a struct called studentType which has 4 members: fName lName score letterGrade Assume there are 20 students Your main() function will only have variable definitions and function calls You MUST have...
/******************************************************************************** * INSTRUCTIONS * * This program calculates the total fee charged for multiple accounts *...
/******************************************************************************** * INSTRUCTIONS * * This program calculates the total fee charged for multiple accounts * * Fix the errors so the program compiles and can produce the following output * * How many accounts do you have?: 2 * * Enter number of checks for account 1: 10 * * Enter number of checks for account 2: 10 * * The sum of the fees for 2 accounts is $22.00 * *********************************************************************************/ import java.util.Scanner; public class BankCharges { public...
PLEASE DESCING A FLOWCHART IN FLOWGORITHM Test Average and Grade Write a program that asks the...
PLEASE DESCING A FLOWCHART IN FLOWGORITHM Test Average and Grade Write a program that asks the user to enter five test scores. The program should display a letter grade for each the five test score and the average test score. Design the following functions in the program : -calAverge 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...
Develop a program that calculates the final score and the average score for a student from...
Develop a program that calculates the final score and the average score for a student from his/her (1)class participation, (2) test, (3) assignment, (4) exam, and (5) practice scores. The user should enter the name of the student and scores ranging from 0 to 100 for each grading item. The final score is the sum of all grading items. The average score is the average of all grading items. Here is a sample output of the program: Enter the Student's...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT