Question

Create a new NetBeans project called PS1Gradebook. Your program will simulate the design of a student...

Create a new NetBeans project called PS1Gradebook. Your program will simulate the design of a student gradebook using a two-dimensional array. It should allow the user to enter the number of students and the number of assignments they wish to enter grades for. This input should be used in defining the two-dimensional array for your program. For example, if I say I want to enter grades for 4 students and 5 assignments, your program should define a 4 X 5 array. Your program should allow the user to then enter the appropriate number of grades and store them within the two dimensional array. Your program should include an additional method that will display these values in a matrix form, with the student names on the left and the assignment names as the column header. After displaying the matrix, add a second method that will display each student’s grade average. Your programs output should be appropriately formatted and look like the following: Note: Your output will vary based off the dimensions of the array.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

import java.util.Scanner;
//class PS1Gradebook
public class PS1Gradebook {
  
  
   //method to show student data in matrix
   public static void showData(int [][]studentData, String[] studentNames) {
      
       System.out.println("Student Data: ");
      
       for(int i = 0 ; i < studentData.length ; i ++) {
           //adding \t for data formatting
           System.out.print(studentNames[i] + " ==>\t\t");
           for (int j = 0 ; j < studentData[i].length ; j ++) {
               System.out.print(studentData[i][j] +"\t\t ");
           }
           System.out.println();
       }
   }
  
   //method to calculate the average grade
   public static void showAverage(int [][] studentData, String[] studentNames) {
      
       System.out.println("\n\n-----Avgerage-----");
       for(int i = 0 ; i < studentData.length ; i ++) {
           int sum = 0;
           System.out.print(studentNames[i] + " ==> ");
           for (int j = 0 ; j < studentData[i].length ; j ++) {
               sum += studentData[i][j];
           }
           System.out.println("\t\t"+sum/studentData[i].length);
       }
   }

  
   public static void main(String[] args) {
       int numberOfStudents = 0;
   int numberOfAssignments = 0;

       //scanner object to read user input
   Scanner sc = new Scanner(System.in);
  
   //readng number of students and number of assignments
   System.out.print("Enter Number of student: ");
   numberOfStudents = sc.nextInt();

   System.out.print("Enter Number of assignments: ");
   numberOfAssignments = sc.nextInt();
  
  
   //declaring array
   int studentData [][] = new int[numberOfStudents][numberOfAssignments];

   String[] studentNames = new String[numberOfStudents];

   System.out.println("Enter The Student Data: ");
  
   //populating the 2d array.
   for(int i = 0 ; i < numberOfStudents ; i ++)
   {
   System.out.print("Name: ");
   studentNames[i] = sc.next();
  
   System.out.println("Enter Grades: ");
   for(int j = 0 ; j < numberOfAssignments ; j ++)
   {
   studentData[i][j] = sc.nextInt();
   }
   sc.nextLine();
   }
  
   showData(studentData, studentNames);
   showAverage(studentData, studentNames);
  
   sc.close();
   }

}

IF THERE IS ANYTHING THAT YOU DO NOT UNDERSTAND OR NEED MORE HELP THEN PLEASE MENTION IT IN THE COMMENTS SECTION.

Add a comment
Know the answer?
Add Answer to:
Create a new NetBeans project called PS1Gradebook. Your program will simulate the design of a student...
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
  • Java - In NetBeans IDE: • Create a class called Student which stores: - the name...

    Java - In NetBeans IDE: • Create a class called Student which stores: - the name of the student - the grade of the student • Write a main method that asks the user for the name of the input file and the name of the output file. Main should open the input file for reading . It should read in the first and last name of each student into the Student’s name field. It should read the grade into...

  • Write a program that performs the following: 1. Presents the user a menu where they choose...

    Write a program that performs the following: 1. Presents the user a menu where they choose between:              a. Add a new student to the class                           i. Prompts for first name, last name                           ii. If assignments already exist, ask user for new student’s scores to assignments              b. Assign grades for a new assignment                           i. If students already exist, prompt user with student name, ask them for score                           ii. Students created after assignment will need to...

  • using C# Write a program which calculates student grades for multiple assignments as well as the...

    using C# Write a program which calculates student grades for multiple assignments as well as the per-assignment average. The user should first input the total number of assignments. Then, the user should enter the name of a student as well as a grade for each assignment. After entering the student the user should be asked to enter "Y" if there are more students to enter or "N" if there is not ("N" by default). The user should be able to...

  • using java Program: Please read the complete prompt before going into coding. Write a program that...

    using java Program: Please read the complete prompt before going into coding. Write a program that handles the gradebook for the instructor. You must use a 2D array when storing the gradebook. The student ID as well as all grades should be of type int. To make the test process easy, generate the grade with random numbers. For this purpose, create a method that asks the user to enter how many students there are in the classroom. Then, in each...

  • Design and code a JAVA program called ‘Grades’. ? Your system should store student’s name, and...

    Design and code a JAVA program called ‘Grades’. ? Your system should store student’s name, and his/her course names with grades. ? Your system should allow the user to input, update, delete, list and search students’ grades. ? Each student has a name (assuming no students share the same name) and some course/grade pairs. If an existing name detected, user can choose to quit or to add new courses to that student. ? Each student has 1 to 5 courses,...

  • c++ Instructions Overview In this programming challenge you will create a program to handle student test...

    c++ Instructions Overview In this programming challenge you will create a program to handle student test scores.  You will have three tasks to complete in this challenge. Instructions Task 1 Write a program that allocates an array large enough to hold 5 student test scores. Once all the scores are entered, the array should be passed to a function that sorts them in ascending order. Another function should be called that calculates the average score. The program should display the...

  • [JAVA/chapter 7] Assignment: Write a program to process scores for a set of students. Arrays and...

    [JAVA/chapter 7] Assignment: Write a program to process scores for a set of students. Arrays and methods must be used for this program. Process: •Read the number of students in a class. Make sure that the user enters 1 or more students. •Create an array with the number of students entered by the user. •Then, read the name and the test score for each student. •Calculate the best or highest score. •Then, Calculate letter grades based on the following criteria:...

  • In this homework, you will design a program to perform the following task: Write a program...

    In this homework, you will design a program to perform the following task: Write a program that would allow a user to enter student names and Final grades (e.g. A,B,C,D,F) from their courses. You do not know how many students need to be entered. You also do not know how many courses each of the students completed. Design your program to calculate the Grade Point Average (GPA) for each student based on each of their final grades. The program should...

  • Write C++ program (studentsGpa.cpp) uses dynamic allocation to create an array of strings. It asks the...

    Write C++ program (studentsGpa.cpp) uses dynamic allocation to create an array of strings. It asks the user to enter a number and based on the entered number it allocates the array size. Then based on that number it asks the user that many times to enter student’s names. What you need to do:  Add another array of doubles to store the gpa of each student as you enter them  You need to display both the student’s name and...

  • Write a program that asks the user for a student name and asks for grades until...

    Write a program that asks the user for a student name and asks for grades until the user enters a non-number input, it should then ask if the user wants to enter another student, and keep doing the process until the user stops adding students. The student’s must be stored in a dictionary with their names as the keys and grades in a list. The program should then iterate over the dictionary elements producing the min, max, and mean of...

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