Answer to Question #254043 in Java | JSP | JSF for dee

Question #254043

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).


1
Expert's answer
2021-10-20T16:37:49-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