Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help writing this code in java using entry level code. Write a program that generates a file with 1000 student records, as detailed

I need help writing this code in java using entry level code.

Write a program that generates a file with 1000 student records, as detailed below. Then, your program will ask the user for student last names until the user quits. Finally, the records for the students entered will be displayed.

Details

: Generate 1000 lines of student data and write them to a file called studentList.txt, inside your project directory. Each line of your file should contain the Strings FirstName and LastName in a numbered sequence, followed by class level (freshman, sophomore, junior, or senior), followed by a GPA between 2.00 (inclusive) and 4.00 (inclusive). The class level and GPA should be chosen randomly. Here are the first few possible lines of your file:

FirstName1 LastName1 freshman 3.12

FirstName2 LastName2 sophomore 2.87

FirstName3 LastName3 senior 3.03

Note: The GPA should be rounded to two decimal places, so consider using printf.

Next, set up a sentinel loop to collect student last names from the user, and store them in an ArrayList that stores Strings only. See Sample Output.

Finally, you should read in the file you created above, and print the record for each student in your ArrayList. My suggestion is to set up a loop to read your file, and each time through the body use an array to store the current line of the file using the split() method (remember to include a delimiter). Then, you check if the current last name is in your ArrayList, and if so, print the record.

Your output should match the Sample Output below, with the data corresponding to your own student file, of course.

image text in transcribed

Sample Output: Enter a student last name, quit' when finished: LastName5 Enter a student last name, 'quit' when finished: LastName 578 Enter a student last name, 'quit' when finished: LastName 35 Enter a student last name, 'quit' when finished: quit Student Report: FirstName FirstName56 LastName56 sophomore 2.94 FirstName578 LastName578 senior 3.23 BUILD SUCCESSFUL (total time 18 seconds) 35 LastName 3s senior 3.65

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 Processing

Authors: David M. Kroenke

12th Edition International Edition

1292023422, 978-1292023427

More Books

Students also viewed these Databases questions

Question

List the functions that are served by short-term memory.

Answered: 1 week ago