Answer to Question #200494 in C# for Wise Tshikovhela

Question #200494

Write a program that does the following for 15 students:

• Reads in 3 marks for each student (marks must be between 0 and 100)

• Calculates and displays the highest mark for each student.


Update your solution to also read in the name of each student, and when displaying the overall highest mark, the name of the relevant student should also be displayed.


Update your solution to make use of the getMark method (written for task 3 of this prac, code copied to this solution).


You can also consider creating other user defined methods to update your solution.


1
Expert's answer
2021-05-31T00:52:15-0400
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
 
public class Exercise12
    {
        static void Main(string[] args)
        {
    double rl,phy,che,ca,total;
    double per;
    string nm,div;

    Console.Write("\n\n");
    Console.Write("Calculate the total, percentage and division to take marks of three subjects:\n");
    Console.Write("-------------------------------------------------------------------------------");
    Console.Write("\n\n");


    Console.Write("Input the Roll Number of the student :");
    rl = Convert.ToInt32(Console.ReadLine());

    Console.Write("Input the Name of the Student :");
    nm = Console.ReadLine();

    Console.Write("Input  the marks of Physics : ");
    phy= Convert.ToInt32(Console.ReadLine());
    Console.Write("Input  the marks of  Chemistry : ");
    che = Convert.ToInt32(Console.ReadLine());
    Console.Write("Input  the marks of Computer Application : ");
    ca = Convert.ToInt32(Console.ReadLine());

    total = phy+che+ca;
    per = total/3.0;
    if (per>=60)
	 div="First";
    else
	if (per<60&&per>=48)
	    div="Second";
	else
	    if (per<48&&per>=36)
		div="Pass";
	     else
		div="Fail";

       Console.Write("\nRoll No : {0}\nName of Student : {1}\n",rl,nm);
       Console.Write("Marks in Physics : {0}\nMarks in Chemistry : {1}\nMarks in Computer Application : {2}\n",phy,che,ca);
       Console.Write("Total Marks = {0}\nPercentage = {1}\nDivision = {2}\n",total,per,div);
}
}

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

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS