Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Bartleby Related Questions Icon
Related questions
Topic Video
Question
Java program involves the use of Strings, characters and file I/O.
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 MarkThis question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
bartleby
This is a popular solution
bartleby
Trending nowThis is a popular solution!
bartleby
Step by stepSolved in 4 steps with 5 images
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
- Programming Exercise 1-7 Instructions MovieQuotelnfo.java>- Terminal + 1 class MovieQuoteInfo { public static void main(String[] args) { // Write your code here sandbox $ | 2 Write, compile, and test the MovieQuoteInfo class so that it 3 displays your favorite movie quote, the movie it comes from, the } 5 } 4 character who said it, and the year of the movie. 6 An example of the program is shown below: Rosebud, said by Charles Foster Kane in the movie Citizen Kane in 1941. Grading Write your Java code in the area on the right. Use the Run button to compile and run the code. Clicking the Run Checks button will run pre-configured tests against your code to calculate a grade. Once you are happy with your results, click the Submit button to record your score.arrow_forwardTrue or False: JavaScript is the same language as Javaarrow_forwardJava code to get name from user and disay Hello message In java please Use Scanner class object to get user inputarrow_forward
- java If you open a command window and want to see what version of the Java compiler you have installed on your computer, what would you write? If you open a command window and want to see what version of Java you have installed, what would you need to write?arrow_forwardJava Language Create Clock class and demonstrate the features of the class with the driver program. upload a single file that contains the source code with documentation for both the clock class and the driver and execution of the program. The rule for execution is that you execute enough times with sufficient data that every line in the program is executed).arrow_forwardExplain how Android and Java do work together? Explain the phases. #Note: Please give me a unique answer, no copy paste.arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Text book imageDatabase System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationText book imageStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONText book imageDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- Text book imageC How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONText book imageDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningText book imageProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
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