Your lecturer wishes to store the exam marks for java, and perform an analysis of the marks. The marks are expressed as a percentage. There are 15 students that wrote the exam. write the java program that will input the marks for each student and store in an array called Supp. The input must be validated before being stored. Also determine and display the highest and lowest mark. the inputs are: 15,27,38,2,98,42,87,92,99,13,5,72,67,2,1. This is for an assignment and its really urgent, if you could please help me. thanx
1
Expert's answer
2012-04-28T11:01:27-0400
import java.util.Scanner;
public class Main { public static void main(String[] args) { & Scanner in = new Scanner(System.in); & int n; & System.out.print("Enter number of students: "); & n = in.nextInt(); & int []supp = new int[n]; & System.out.print("Enter "+n+" marks: "); & for (int i=0;i<n;i++){ & double temp; & temp=in.nextDouble(); & if ((temp%1!=0)||(temp<0)){ & System.out.println("Mark error "+temp+" try again!"); & i--; & } & else supp[i]=(int)temp; & } & int max=0; & int min=Integer.MAX_VALUE; & for (int i=0;i<n;i++){ & if (supp[i]>max) & max=supp[i]; & if (supp[i]<min) & min=supp[i]; & } & System.out.println("The lowest mark: "+min); & System.out.println("The higest mark: "+max); }
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
Finding a professional expert in "partial differential equations" in the advanced level is difficult.
You can find this expert in "Assignmentexpert.com" with confidence.
Exceptional experts! I appreciate your help. God bless you!
Comments
You're welcome. We are glad to be helpful. If you really liked our service please press like-button beside answer field. Thank you!
Thanx it helped alot
Leave a comment