Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Computer Science 1 : Java Programming Dr. David Cline Program : Hospital Record Sorting Sorting is one of the most common applications of computer science.

image text in transcribed
image text in transcribed
Computer Science 1 : Java Programming Dr. David Cline Program : Hospital Record Sorting Sorting is one of the most common applications of computer science. In this program, you will read in patient records from a file, sort them based on one of the fields of the records using Java's built-in sorting routines, and then write the sorted list to the console. Things you will learn Creating simple classes .Comparators and Java's sorting routines Reading input from files and formatting output. Specification In this assignment, you will implement a Patient Record sorter program. Your program must include the following elements: . A class called "Patient" to hold a patient record. 2. Different comparators to compare the different attributes of Patient. Patient records will be specified in a file, one record per line. Each line of the file will have five comma-separted fields with no spaces between them. The fields will be: lastName, firstName, age, insuranceCompany, roomNum, in that order. An example file is shown below Franklin, Benjamin, 74,bebs of oklahoma, 18 Hamilton, Alexander,199,aetna, 25 Thatcher, Margaret, 65,aflack, 3 Nixon, Richard, 45, kaiser permanente,7 The program must take two command line arguments: the name of a file containing patient records. the name of a field (attribute) of the records on which to sort, which must be one of first, last, age, room, insurance I. 2. your name and the program name, followed by a When run, your program must first print out formatted, sorted list of the records from the file, pr output must be aligned, with a header printed above them, and reasonable spacing between columns The numbers must be right aligned, and the word fields must be left aligned. inted to the console. The fields of the formatted If there are not enough command line arguments, or if the specified file cannot be found, the should print out a usage statement and exit. It must not crash. program

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

Readings In Database Systems

Authors: Michael Stonebraker

2nd Edition

0934613656, 9780934613651

More Books

Students also viewed these Databases questions