# data[].attributes.body
Start

read n

set i=0, highest=0, lowest=100, t_excellent=0, t_average=0, t_weak=0, sum=0, average

repeat while i<n

read name[i], mark[i]

if mark[i] > highest

highest = mark[i]

if mark[i] < lowest

lowest = mark[i]

if mark[i] >= 80

t_excellent = t_excellent +1

else if mark[i] >= 50

t_average = t_average +1

else

t_weak = t_weak +1

end if

sum = sum + mark[i]

i = i+1

end repeat

average = sum/n

display highest mark, lowest mark

set i = 0

repeat while i < n

if mark[i] = = highest

print name, i

end if

i = i+1

end repeat

set i = 0

repeat while i < n

if mark[i] = = lowest

print name, i

end if

i = i+1

end repeat

display t_excellent, t_average, t_weak, average mark

Stop

# data[].attributes.body
/*Assignment SC025 Session 2020/2021
Author name: Nurain Rasyidah Binti Mohd Rusli
Class: F2T10
This program will summarize student's performance*/

import java.util.Scanner ;
class F2P10NurainRasyidah{
public static void main(String[] args){
Scanner sc=new Scanner (System.in);

System.out.println("Welcome to Nurain Rasyidah Information System ");
int n;
System.out.print("\nEnter number of student: ");
n = sc.nextInt();
sc.nextLine();

String name[] =new String[n];
double mark[]=new double[n];
int i, t_excellent=0, t_average=0, t_weak=0;
double highest=0, lowest=100, sum=0, average;

i=0;
while (i<n)
{
System.out.print("\nEnter student's name: ");
name[i]=sc.nextLine();
System.out.print("\nEnter student's mark: ");
mark[i]=sc.nextDouble();

if(mark[i]>highest)
highest=mark[i];
if(mark[i]<lowest)
lowest=mark[i];
if(mark[i]>=80)
t_excellent=t_excellent+1;
else if(mark[i]>=50)
t_average=t_average+1;
else
t_weak=t_weak+1;

sum=sum+mark[i];
i=i+1;
sc.nextLine();
}

average=sum/n;

System.out.println("\nHighest mark: "+highest);
System.out.println("\nLowest mark: "+lowest);

i=0;
while(i<n)
{
if(mark[i]==highest)
System.out.println("\nStudent with the highest mark is "+name[i]+" present at index "+i);
i=i+1;
}

i=0;
while(i<n)
{
if(mark[i]==lowest)
System.out.println("\nStudent with the lowest mark is "+name[i]+" present at index "+i);
i=i+1;
}

System.out.println("\nTotal number of EXCELLENT student is: "+ t_excellent);
System.out.println("\nTotal number of AVERAGE student is: "+ t_average);
System.out.println("\nTotal number of WEAK student is: "+ t_weak);
System.out.println("\nAVERAGE MARK is: "+ average);

}}