1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
|
import java.io.*;
public class Assignment1 {
public static void main(String[] args) {
String studName[] = {"Aminah Binti Samad", "Putra Bin Abdul", "Muadz Bin Kassim", "Kaisara Binti Dollah", "Rahaman Bin Ismail"};
int test1[] = {90, 45, 78, 80, 60};
int test2[] = {40, 80, 78, 95, 93};
int totalMarks = {0, 0, 0, 0, 0};
String[] status = new String[5];
CalculateMarks(test1, test2, totalMarks);
DetermineStatus(Marks, status);
Display(studName, Marks, status);
}
public static void CalculateMarks(int test1[], int test2[], int Marks[])
{
for(int i = 0; i < 5; i++)
{
int temptotalMarks = 0;
Marks[i] = test1[i] + test2[i];
Marks[i] = temptotalMarks;
}
return (Marks[i]);
}
public static void DetermineMarks(int Marks[], String[] status)
{
for (int i = 0; i < 5; i++)
{
if(0 <= Marks[i] || 20<= Marks[i])
System.out.print("Cannot sit the final exam");
else if(21 >= Marks[i] || 25 <= Marks[i] )
System.out.print("Must sit the 3rd test");
else if(26 >= Marks[i] || 35 <= Marks[i] )
System.out.print("Allow to sit the final examination");
else if(36 >= Marks[i] || 40 <= Marks[i] )
System.out.print("Excluded from sitting the final examination");
}
return(status);
}
public static void Display(String studName[], int Marks; String[] status)
{
for(int i = 0; i < 5; i++)
{
System.out.print("\n Student Name : " +studName);
System.out.print("\n Student Marks : " +Marks);
System.out.print("\n Student Status : " +status);
}
return;
}
}
|