Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions Icon

Related questions

Topic Video
Question

Java program involves the use of Strings, characters and file I/O.

[画像:Your Java program will be reading input from a file name strīnput.txt. Each record contains String firstname String lastName String strSalary (which will be converted to a double if it's valid – see below) char status String cityState (city and state and combine together but separated by a comma) Sample input: John Smith 87654.32 F Brooklyn, NY Jamie Doe 987609.87 F NY,NY Mike Mantle 345678.30 D Orlando,FL Frank Young 10456.82 G Boston, MA Richard Clark 67890.32 D Washington,DC Jack Şmithson 23489A.82 D Houston, TX Bob Regan1295609.87 D Denver,Co Read from the file one record at a time and process as follows: 1. Any record whose status code is neither D or F should be written to the screen indicating the error. The next record should be read in. 2. If the status code is D or F, validate the salary that it contains only digits and one decimal point 3 positions from the right (indicating cents). a. If the salary is invalid, print the entire record to the screen, indicating the error (char at position x is not a digit or period is missing or period is in the wrong position). b. If the salary is valid, convert it to a double. c. If the status code is D, compute the bonus (double) as 12.5% of salary and 18% if the status code is F. 3. Separate the cityState into two individual Strings named city and state. Use the position of the comma to help extract the city portion before the comma and the state after the comma (use indexOf to find the comma and substring to extract the two parts) 4. Each record that has a status of D should be written to a file named stroutputD and those record with status of F should be written to a file named stroutputF. a. For both files, each record printed should include firstName, lastName, status, salary, bonus, city and state (without the comma) 5. When all records have been read in, print to the screen the number of D, F and incorrect records processed. 6. Submit your code, the output on the screen and the output in the two files. ]
expand button
Transcribed Image Text:Your Java program will be reading input from a file name strīnput.txt. Each record contains String firstname String lastName String strSalary (which will be converted to a double if it's valid – see below) char status String cityState (city and state and combine together but separated by a comma) Sample input: John Smith 87654.32 F Brooklyn, NY Jamie Doe 987609.87 F NY,NY Mike Mantle 345678.30 D Orlando,FL Frank Young 10456.82 G Boston, MA Richard Clark 67890.32 D Washington,DC Jack Şmithson 23489A.82 D Houston, TX Bob Regan1295609.87 D Denver,Co Read from the file one record at a time and process as follows: 1. Any record whose status code is neither D or F should be written to the screen indicating the error. The next record should be read in. 2. If the status code is D or F, validate the salary that it contains only digits and one decimal point 3 positions from the right (indicating cents). a. If the salary is invalid, print the entire record to the screen, indicating the error (char at position x is not a digit or period is missing or period is in the wrong position). b. If the salary is valid, convert it to a double. c. If the status code is D, compute the bonus (double) as 12.5% of salary and 18% if the status code is F. 3. Separate the cityState into two individual Strings named city and state. Use the position of the comma to help extract the city portion before the comma and the state after the comma (use indexOf to find the comma and substring to extract the two parts) 4. Each record that has a status of D should be written to a file named stroutputD and those record with status of F should be written to a file named stroutputF. a. For both files, each record printed should include firstName, lastName, status, salary, bonus, city and state (without the comma) 5. When all records have been read in, print to the screen the number of D, F and incorrect records processed. 6. Submit your code, the output on the screen and the output in the two files.
Expert Solution
Check Mark
Knowledge Booster
Background pattern image
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
    Recommended textbooks for you
    Text book image
    Database System Concepts
    Computer Science
    ISBN:9780078022159
    Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
    Publisher:McGraw-Hill Education
    Text book image
    Starting Out with Python (4th Edition)
    Computer Science
    ISBN:9780134444321
    Author:Tony Gaddis
    Publisher:PEARSON
    Text book image
    Digital Fundamentals (11th Edition)
    Computer Science
    ISBN:9780132737968
    Author:Thomas L. Floyd
    Publisher:PEARSON
    Text book image
    C How to Program (8th Edition)
    Computer Science
    ISBN:9780133976892
    Author:Paul J. Deitel, Harvey Deitel
    Publisher:PEARSON
    Text book image
    Database Systems: Design, Implementation, & Manag...
    Computer Science
    ISBN:9781337627900
    Author:Carlos Coronel, Steven Morris
    Publisher:Cengage Learning
    Text book image
    Programmable Logic Controllers
    Computer Science
    ISBN:9780073373843
    Author:Frank D. Petruzella
    Publisher:McGraw-Hill Education