Create a java program that initialize a two dimensional array with the continuous assessment marks used to determine the semester mark for PRG510S exam qualification, The system should also create an array of student names in correspondence to the marks (Note: the appropriate weights of each individual assessment are given under corresponding headings and both the marks and student names are read from the user input).
test1
(Weight 20%)
test2
(Weight 20%)
labs
(Weight 20%)
in_class exercise
(Weight 10%)
assignment
(Weight 30%)
John
50
60
79
89
63
Harry
41
52
68
56
40
Uushona
30
20
52
38
47
Sililo
23
Enter class size: 4
Enter student name:John
Enter John’s semester marks: 50 60 79 89 63
Enter student name:Harry
Enter Harry’s semester marks: 41 52 68 56 40
Enter student name:Uushona
Enter Uushona’s semester marks: 30 20 52 38 47
Enter student name:Sililo
Enter Sililo’s semester marks: 23 33 45 19 27
import java.io.*;
import java.util.*;
class Student
{
Scanner sc=new Scanner(System.in);
String name;
int marks[];
Student()
{
System.out.print("Enter Student Name: ");
name=sc.next();;
getMarks();
}
public void getMarks()
{
marks=new int[5];
System.out.print("Enter "+name+"'s"+" Semester marks: ");
marks[0]=sc.nextInt();
marks[1]=sc.nextInt();
marks[2]=sc.nextInt();
marks[3]=sc.nextInt();
marks[4]=sc.nextInt();
System.out.println(name+": "+"\n"+marks[0]+"\n"+marks[1]+"\n"+marks[2]+"\n"+marks[3]+"\n"+marks[4]);
}
}
class Main
{
public static void main(String args[])
{
System.out.println("Enter the number of students: ");
Scanner input=new Scanner(System.in);
int n=input.nextInt();
Student s[]=new Student[n];
for(int i=0;i<n;i++)
s[i]=new Student();
}
}
Comments
Leave a comment