Answered step by step
Verified Expert Solution
Link Copied!

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

PN09 "PLEASE WRITE IN JAVA
import java.util.*;
class Midterm2{
//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: 3
public static void main(String[]args)
{
//declare an ArrayList of type Student(the class that you defined at the bottom of this file)
// call your initStudents function(that 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 function(that you defined below)
//call your showStudentScores function(that you defined below)
System.out.println(""Goodbye"");
}
//define a static void function named initStudents that::
//has 1 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 twp-dimensional integer array
//an integer whose value is the number of rows for the 2-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 2-d array
// populate your 2-d integer array with the scores
// the scores for row 0 will be the scores for student 0
// the scores for row 1 will be the scores for student 1 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: userEntersStudent1
Enter student's id: userEntersIdNumber(123)
Enter a student's name, or quit when you're finished adding students: userEntersStudent2
Enter student's id: userEntersIdNumber(133)
Enter a student's name, or quit when you're finished adding students: userEntersStudent3
Enter student's id: userEntersIdNumber(143
)
Enter a student's name, or quit when you're finished adding students: quit
Enter Scores for student1:
score 1: userEntersScore
score 2: userEntersScore
score 3: userEntersScore
Enter Scores for student2:
score 1: userEntersScore
score 2: userEntersScore
score 3: userEntersScore
Enter Scores for student3:
score 1: userEntersScore
score 2: userEntersScore
score 3: userEntersScore
Enter student's name to see scores, or quit to exit: userEntersStudent1
The student id is : whatever number user entered for that Student (student1)
score 1 is: ____, score 2 is: _____, Score 3 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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Pro SQL Server Wait Statistics

Authors: Enrico Van De Laar

1st Edition

1484211391, 9781484211397

More Books

Students also viewed these Databases questions