adspace
Write a program for the problem: the array of inetegers
indicating the marks of the students is given, U have to
calculate the percentile of the students aaccording to this
rule: the percentile of a student is the %of no of student
having marks less then him. For eg: suppose Student Marks A
12 B 60 C 80 D 71 E 30 F 45 percentile of C = 5/5 *100 =
100 (out of 5 students 5 are having marks less then him)
percentile of B = 3/5*100 = 60% (out of 5, 3 have markses
less then him) percentile of A = 0/5*100 = 0%.
Answer Posted / Varunesh Pandey
Java code for calculating the percentile of students based on their marks would look like this:nn```javanpublic class StudentMarks {n public static void main(String[] args) {n int[] marks = {12, 60, 80, 71, 30, 45};n for (int i = 0; i < marks.length; i++) {n int count = 0;n for (int j = 0; j < marks.length; j++) {n if (marks[i] > marks[j]) {n count++;n }n }n double percentile = ((double)count / (marks.length - 1)) * 100;n System.out.println("Percentile of student with mark " + marks[i] + ": " + percentile + "%");n }n }n}n```
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is the first argument of the string array in main method?
What is the resourcebundle class?
What if I write static public void instead of public static void?
What is the java api?
Are jvm’s platform independent?
What do you understand by casting in java language? What are the types of casting?
what is reflection api? How are they implemented?
Can we extract main method from another class?
What is the locale class?
How does java handle integer overflows and underflows?