Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

need help with this app in java Write a Java program that reads in a student username (e.g. mpaulding) and a course in which they

need help with this app in java

Write a Java program that reads in a student username (e.g. mpaulding) and a course in which they would like to enroll (e.g. CS170). Use a HashMap to store the username and an ArrayList of all the courses (Strings) for which that student has enrolled. Specifically, we will create a HashMap with the following definition:

HashMap> studentEnrollments = new HashMap>( );

In a loop, prompt the user to enter their username and the course they want to enroll in. The loop will continue as long as the user does not input the word "quit".

After the loop completes, display a listing of each student's username and the courses in which they are enrolled, followed by statistics about enrollment, including the total number of students, total number of courses enrolled and the student with the most number of courses.

For example, a sample transaction with the user might be:

~~~~~~~~~~~~~~~~~Welcome to MyOCC ~~~~~~~~~~~~~~~~~

Please enter student username (or "quit" to exit): mpaulding Please enter course to enroll in: CS A170

Please enter student username (or "quit" to exit): mpaulding Please enter course to enroll in: CS A150

Please enter student username (or "quit" to exit): mpaulding Please enter course to enroll in: SPAN A180

Please enter student username (or "quit" to exit): dkeaton123 Please enter course to enroll in: THEA A105

Please enter student username (or "quit" to exit): dkeaton123 Please enter course to enroll in: THEA A107

Please enter student username (or "quit" to exit): sseagal77 Please enter course to enroll in: THEA A103

Please enter student username (or "quit" to exit): sseagal77 Please enter course to enroll in: THEA A104

Please enter student username (or "quit" to exit): quit

~~~~~~~~~~~~~~~Spring 2017 Enrollment~~~~~~~~~~~~~~~

Student: mpaulding Courses: CS A170, CS A150, SPAN A180

Student: dkeaton123 Courses: THEA A105, THEA A107

Student: sseagal77 Courses: THEA A103, THEA A104

Total students enrolled: 3 Total courses enrolled: 7 Student with most courses: mpaulding

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

Database In Depth Relational Theory For Practitioners

Authors: C.J. Date

1st Edition

0596100124, 978-0596100124

More Books

Students also viewed these Databases questions

Question

What is the purpose of the Salary Structure Table?

Answered: 1 week ago

Question

What is the scope and use of a Job Family Table?

Answered: 1 week ago