Answer to Question #256329 in Java | JSP | JSF for Dolly

Question #256329

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

33

45

19

27

                                                                                                        

Enter class size: 3

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

 

Output1:

Student              Semester mark        Qualifies for Exam?

---------                -------------------                -----------------------

John             66                    YES

Harry                   50                    YES

Uushona             38                     NO




1
Expert's answer
2021-10-25T04:19:14-0400
package continuous_assessment;

import java.util.Scanner;

public class Continuous_assessment {
 
 public static void main(String[] args) {
 Scanner scan = new Scanner(System.in);
 System.out.println(" Enter class size:\n");
 int n = scan.nextInt();
 double marks[][] = new double[n][5];
 String [] name = new String[n];
 for(int i=0; i<n; i++){
 System.out.println(" Enter student name:\n");
 String na = scan.next();
 System.out.printf(" Enter %s's semester marks", na);
 name[i] = na;
 for(int j=0; j<5; j++){
 if(j==0 || j==1 || j==2){
 marks[i][j]=scan.nextInt() * 0.2;
 }
 else if(j==3){
 marks[i][j]=scan.nextInt() * 0.1;
 }
 else if(j==4){
 marks[i][j]=scan.nextInt() * 0.3;
 }
 
 }
 }
 
 double [] mean = new double[5];
 for(int i=0; i<n; i++){
 double sum = 0;
 for(int j=0; j<5; j++){
 sum += marks[i][j];
 }
 mean[i] = sum;
 }
 for(int i=0; i<n; i++){
 System.out.println(mean[i]);
 }
 }
 
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS