How to do this code in c Please help me with this assignment
How to do this code in c#, Please help me with this assignment i already posted this question four times but yet no help.....
You’ll prompt the user to press the enter key to end the program and exit after displaying their grades. Assume proper input for the grades and that the user will pass in grades between (and including) 0 and 100.
Here is another set of values: 99 55 14 96 70 82 75 83 45 96 74 77
86 84 100 96 86 82 83 84 72 86 85 74
71 90 84 73 77 96 84 84 76 75
(I don\'t know what i am missing it gives me error, also i don\'t know how to make a graph look alike, exactly as above )here is my code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Assignment03
{
class Program
{
static void Main(string[] args)
{
int A=0, B=0, C=0, D=0, F=0;
for (int i = 0; i < args.Length; i++)
{
if (int.Parse(args[i]) < 60)
{
F++;
}
else if (int.Parse(args[i]) < 70)
{
D++;
}
else if (int.Parse(args[i]) < 80)
{
C++;
}
else if (int.Parse(args[i]) < 90)
{
B++;
}
else if (int.Parse(args[i]) < 100)
{
A++;
}
{
Console.Write(int.Parse(args[i]));
Console.ReadLine();
}
for (int j = 100; j > args.Length; j--)
{
Console.WriteLine(\"\\t\\tStudent Math Graph \");
Console.WriteLine(int.Parse(args[j]));
Console.WriteLine(\"\ |\");
Console.ReadLine();
}
}
Student Math Graph 7 I 6 I S I 3 I 2 I 1 I Class had 7 A Grades 6 B Grades 3 C Grades 1 D Grades 2 F Grades Press any key to endSolution
Program find working program below.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Assignment03
{
class Program
{
static void Main(string[] args)
{
int A=0, B=0, C=0, D=0, F=0;
for (int i = 0; i < args.Length; i++)
{
if (int.Parse(args[i]) <= 60)
{
F++;
}
else if (int.Parse(args[i]) <= 70)
{
D++;
}
else if (int.Parse(args[i]) <= 80)
{
C++;
}
else if (int.Parse(args[i]) <= 90)
{
B++;
}
else if (int.Parse(args[i]) <= 100)
{
A++;
}
{
Console.Write(int.Parse(args[i]));
Console.ReadLine();
}
}
int maxNumberOfGrades = A;
if(B>maxNumberOfGrades){
maxNumberOfGrades = B;
}
if(C>maxNumberOfGrades){
maxNumberOfGrades = C;
}
if(D>maxNumberOfGrades){
maxNumberOfGrades = D;
}
if(F>maxNumberOfGrades){
maxNumberOfGrades = F;
}
Console.WriteLine(\"\\t\\tStudent Math Graph \");
for (int j = maxNumberOfGrades; j > 0; j--)
{
//Console.WriteLine(int.Parse(args[j]));
Console.Write(\"\ |\");
if(A>=j){
Console.Write(\" \");
Console.Write(\"*\");
}else{
Console.Write(\" \");
}
if(B>=j){
Console.Write(\" \");
Console.Write(\"*\");
}
else{
Console.Write(\" \");
}
if(C>=j){
Console.Write(\" \");
Console.Write(\"*\");
}else{
Console.Write(\" \");
}
if(D>=j){
Console.Write(\" \");
Console.Write(\"*\");
}else{
Console.Write(\" \");
}
if(F>=j){
Console.Write(\" \");
Console.Write(\"*\");
}else{
Console.Write(\" \");
}
Console.WriteLine(\"\");
}
Console.WriteLine(\"-----------------\");
Console.WriteLine(\" A B C D F\");
Console.WriteLine(\"Class had \" + A + \" A Grades\");
Console.WriteLine(\" \" + B + \" B Grades\");
Console.WriteLine(\" \" + C + \" C Grades\");
Console.WriteLine(\" \" + D + \" D Grades\");
Console.WriteLine(\" \" + F + \" E Grades\");
Console.WriteLine(\"Press any key to end.\");
Console.ReadKey();
}
}
}



