Answer to Question #4890 in C# for tim

Question #4890
Write a program to calculate and display your average and grade. Allow the user to enter five
scores. After values are entered, and the average calculated, test the result to determine whether
an A, B, C, D, D, F should be recorded. The scoring rubric is as follows: A- 90 – 100; B- 80-89;
C- 70-79; D- 60-69; F < 60. Use methods.
1
Expert's answer
2011-10-27T10:31:57-0400
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace StudentGrade
{
class Program
{
static void Main(string[] args)
{
CalculateGrade();

}

private static void CalculateGrade()
{

float score, sum = 0, avg = 0; int i;
for (i = 1; i <= 5; i++)
{
Console.WriteLine("Enter your :{0} Score", i);
score = float.Parse(Console.ReadLine());
sum = sum + score;
}
avg = sum / (i - 1);
Console.WriteLine("Average:" + avg);
if (avg >= 90 && avg <= 100)
Console.WriteLine(" Grade: A");
else if (avg >= 80 && avg <= 89)
Console.WriteLine(" Grade: B");
else if (avg >= 70 && avg <= 79)
Console.WriteLine(" Grade: C");
else if (avg >= 60 && avg <= 69)
Console.WriteLine(" Grade: D");
else
Console.WriteLine(" Grade: F");
Console.Read();
}
}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

Assignment Expert
12.12.13, 14:18

Unfortunately, your question requires a lot of work and cannot be done for free. Submit it with all requirements as an assignment to our control panel and we'll assist you.

serena saldana
12.12.13, 08:26

how to Create a Web application that enables the user to enter first name, last name, and e-mail address. Accept those values and store them in a text file. Add validation controls to all three controls to ensure each has a value before loading it to the file. Confirm that the values are written to the file in c#

Paul
15.02.12, 21:33

What if you do not use the "for" method, is there an alternative method that you can use?

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS