Question

Wilbur Wright College CIS 142 C++ Programming Language Prof. Gustavo Alatta Lab #4 Points: 100 1.1. Create an application tha

create an application that calculates the grades of students
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Solution:

Test.java

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Test{

    //Driver function
    public static void main(String[] args) throws IOException {
        String[] studentNames = new String [5];
        Double[][] studentGrades = new Double[5][5];
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        System.out.println("Enter all 5 student details");
        for(int i = 0; i< 5; i++){
            System.out.println("\nEnter Student "+(i+1)+" Details : ");
            System.out.print("Name : ");
            studentNames[i] = br.readLine();
            for(int j = 0; j < 5; j++){
                System.out.print("Grade("+(j+1)+") : ");
                studentGrades[i][j] = Double.parseDouble(br.readLine());
            }
        }

        //Print the heading of output
        System.out.println("\n\nName\t\t\tGrade1\t\tGrade2\t\tGrade3\t\tGrade4\t\tGrade5\t\tAverage");
        
        //Print the desirable output
        for(int i = 0; i < 5; i++){
            double avg = (studentGrades[i][0] + studentGrades[i][1] + studentGrades[i][2] + studentGrades[i][3] + studentGrades[i][4])/5;
            System.out.printf ("%-15s\t%3.2f\t\t%3.2f\t\t%3.2f\t\t%3.2f\t\t%3.2f\t\t%3.2f%n", studentNames[i], studentGrades[i][0],
                    studentGrades[i][1], studentGrades[i][2], studentGrades[i][3], studentGrades[i][4], avg);
        }
    }
}

Output:

Run: Test c: Program Files\Java\jdk1.8.0_201\bin\java.exe.. Enter all 5 student details Enter Student 1 Details: Name : Gust

NOTE:

  • In given question image, Average values were wrong, Please find the correct values of average in above output image.
Add a comment
Know the answer?
Add Answer to:
create an application that calculates the grades of students Wilbur Wright College CIS 142 C++ Programming...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Using C programming For this project, you have been tasked to read a text file with student grade...

    Using C programming For this project, you have been tasked to read a text file with student grades and perform several operations with them. First, you must read the file, loading the student records. Each record (line) contains the student’s identification number and then four of the student’s numerical test grades. Your application should find the average of the four grades and insert them into the same array as the id number and four grades. I suggest using a 5th...

  • The Computer Science Instructor has just completed compiling all the grades for the C++ Programming class....

    The Computer Science Instructor has just completed compiling all the grades for the C++ Programming class. The grades were downloaded into a file titled ‘studentGrades.txt’ (attached). Write a C++ Program that reads this file and calculates the following as described : The final semester numeric and letter grade (using 10 point scale) Calculated as follows: Labs 1-6 (worth 50% of final grade) Lab 7 is extra credit (worth 2 % of final grade OR replaces lowest lab grade – Select...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT