Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

write a c sharp program that reads the user input for student ID and their marks for 4 courses then output a report summary for

 write a c sharp program that reads the user input for student ID and their marks for 4 courses then output a report summary for each student separately then an overall summary for how many students passed and how many didn't based on their marks. I also want the program to output who got the highest mark.

here is a sample of the output i need


here is my code to ask the user for inout and calculate each student mark and disply them. all i want to do is to print the above 3 lines

int studentId, mark1, mark2, mark3, mark4, total; float average; string grade; //adding looop to keep on asking user until it gives 0 while (true) {

Console.Write(\"please enter your student ID: \"); studentId = Convert.ToInt32(Console.ReadLine()); if (studentId == 0) break; Console.Write(\"please enter your mark for the first course : \"); mark1 = Convert.ToInt32(Console.ReadLine()); Console.Write(\"please enter your mark for the second course : \"); mark2 = Convert.ToInt32(Console.ReadLine()); Console.Write(\"please enter your mark for the third course : \"); mark3 = Convert.ToInt32(Console.ReadLine()); Console.Write(\"please enter your mark for the fourth course : \"); mark4 = Convert.ToInt32(Console.ReadLine());

total = mark1 + mark2 + mark3 + mark4; average = (total) / 4;

if (total { grade = \"F\"; } else if (average >= 40 && average { grade = \"D\"; } else if (average >= 50 && average { grade = \"C\"; } else if (average >= 60 && average { grade = \"B\"; } else { grade = \"A\"; }

Console.WriteLine(\"Hello \" + studentId + \", the summary of your marks is listed below \"); Console.WriteLine(\" First Course: \" + mark1 + \" /100 Second Course: \" + mark2 + \"/100 Third Course: \" + mark3 + \"/100 Fourth Course: \" + mark4 + \"/100 Your final average is: \" + average + \"%. Your grade is : \" + grade); if (average >= 60) { Console.WriteLine(\"Student \" + studentId + \" has passed to the next semester\"); } else { Console.WriteLine(\"Student \" + studentId + \" has not passed to the next semester\"); }

} Console.WriteLine(\"Bye..!!\");

EDIT 1

the format of the output and the calculating do not matter, all I want to know how to do is output a summary

of the user's input.

*NOTE* the program starts by asking a user to enter student id and then their marks for 4 courses then ask the user again and again until a 0 is entered for student id.

let's say for example the user entered different information for 3 students, now how can I

display which student passed and which student did not pass based on the user's input for their marks. and which student got the highest mark.




Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Java An Introduction To Problem Solving And Programming

Authors: Walter Savitch

8th Edition

0134462033, 978-0134462035

More Books

Students also viewed these Programming questions