Answered step by step
Verified Expert Solution
Question
1 Approved Answer
PN 0 9 PLEASE WRITE IN JAVA import java.util. * ; class Midterm 2 { / / declare a static scanner to get input from
PN "PLEASE WRITE IN JAVA
import java.util.;
class Midterm
declare a static scanner to get input from user
declare a static String constant named QUIT to store the value of: quit.
declare a integer constant named COLS to store the value of:
public static void mainStringargs
declare an ArrayList of type Studentthe class that you defined at the bottom of this file
call your initStudents functionthat you defined below
declare a two dimensional integer array where :
the number of rows is the number of students
the number of columns is that your static integer constant
call your initScores functionthat you defined below
call your showStudentScores functionthat you defined below
System.out.printlnGoodbye;
define a static void function named initStudents that::
has parameter an ArrayList type Student
prompts the user to enter a student name, or quit when finished
you will use your static Scanner declaed at the top of this file to get user input
you will use your static String constant to check if quit was entered
for each student name, prompt the user to enter a student id as an integer
add the name and id to your ArrayList
define a static void function named initScores that:
has three parameters:
an ArrayList of type Student
a twpdimensional integer array
an integer whose value is the number of rows for the d array
prompts the user to enter scores for each student
you will use your static scanner declared at the top of this file to get user input
hint: you will use your static integer constant to know
how many columns are in each row of your d array
populate your d integer array with the scores
the scores for row will be the scores for student
the scores for row will be the scores for student and so on
define a static class named Student that has:
a private String to store the student name
a private Integer to store the student id
a constructor to populate the name and id
final notes: the program will work no matter how many students are entered
the program will work no matter the value of your COLS constant
This program requires you to let the user enter as many students as they want with any name, and then enter their students id number and then their three test scores. The output is places below this please check and ask any questions!
The output would be like so:
Enter a student's name, or quit when you're finished adding students: userEntersStudent
Enter student's id: userEntersIdNumber
Enter a student's name, or quit when you're finished adding students: userEntersStudent
Enter student's id: userEntersIdNumber
Enter a student's name, or quit when you're finished adding students: userEntersStudent
Enter student's id: userEntersIdNumber
Enter a student's name, or quit when you're finished adding students: quit
Enter Scores for student:
score : userEntersScore
score : userEntersScore
score : userEntersScore
Enter Scores for student:
score : userEntersScore
score : userEntersScore
score : userEntersScore
Enter Scores for student:
score : userEntersScore
score : userEntersScore
score : userEntersScore
Enter student's name to see scores, or quit to exit: userEntersStudent
The student id is : whatever number user entered for that Student student
score is: score is: Score is the average score is :
and so on and so on until the user enters quit and then the program must quit and print Goodbye
PLEASE WRITE IN JAVA"
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started