# Java Program to Convert Percentages to Percentile for Your Java Course Unit Test Marks

#### Aim:

Rank Your Class: To write a java program to convert percentages to percentile for your Java course Unit test marks.

#### Algorithm:

1. Obtain the number of students in the class N.
2. Get the students sessional 1, sessionsl 2, internal lab, external lab, end semester marks.
3. Find total marks with suitable weightage on each examinations.
4. Rank the students based on the total marks.
5. Find percentile of each students.
6. All computations with respect to students should be done in a single class students.
7. Queries on students details and percentiles should be done from Main class.

#### Program:

```import java.util.*;
import java.lang.*;
class Student
{
String name=new String() ;
float mark[]=new float[5];
float res;
Student(String name)
{
this.name=name;
}
void getData()
{
Scanner put=new Scanner(System.in);
for(int i=0;i<5;i++)
{
int a=put.nextInt();
mark[i]=(float)a/100;
}
}
public void calculate()
{
res=mark[0]*15+mark[1]*15+mark[2]*20+mark[3]*15+mark[4]*35;
}
}
public class Main
{
public static void main(String []args)
{
int n;
System.out.println("ENTER THE NO OF STUDENTS");
Scanner put=new Scanner(System.in);
n=put.nextInt();
Student ob []=new Student[n];
for(int i=0;i<n;i++)
{
System.out.println("ENTER THE STUDENT NAME :");
String name1=put.next();
ob [i]=new Student(name1);
System.out.println("ENTER THE MARKS :");
ob[i].getData();
ob[i].calculate();
}
for(int i=0;i<n-1;i++)
{
for(int j=0;j<n-i-1;j++)
{
if(ob[j].res<=ob[j+1].res)
{
float temp=ob[j].res;
ob[j].res=ob[j+1].res;
ob[j+1].res=temp;
String n1=ob[j].name;
ob[j].name=ob[j+1].name;
ob[j+1].name=n1;
}
}
}
System.out.println("NAME"+"  "+"RANK"+"  "+"MARK");
int x=0;
for(int i=0;i<n;i++)
{
if(ob[i].res>=40){x++;
System.out.println(ob[i].name+"  "+x+"     "+ob[i].res);
}
else
System.out.println(ob[i].name+"  "+"F"+"  "+ob[i].res);
}
}
}
```

#### Execution:

```ENTER THE NO OF STUDENTS: 2
ENTER THE STUDENT NAME: XXXX
ENTER THE MARKS :
98
99
ENTER THE STUDENT NAME: YYYY
ENTER THE MARKS :
87
89
NAME       RANK      MARK
XXXX        1        98.5
YYYY        2        88.0
```