subject
Engineering, 14.11.2019 07:31 lyly214

Your java program will be reading input from a file name strinput. 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:
ira rudowsky 87654.32 f brooklyn. ny
jane doe 987609.87 f ny ny
mickey mantle 345678.30 d orlando fl
fran young 10456a.82 g boston ma
richard clark 67890.32 d
serena liams 1295609.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 comma to extract the city portion before the comma and the state after the comma
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 stroutputre.
a. for both files, each record printed should include firstname, lastname, status, salary, bonus, city and state
5. when all records have been read in, print to the screen the number of d, f and incorrect records processed

ansver
Answers: 3

Another question on Engineering

question
Engineering, 04.07.2019 18:10
Ariver flows from north to south at 8 km/h. a boat is to cross this river from west to east at a speed of 20 km/h (speed of the boat with respect to the earth/ground). at what angle (in degrees) must the boat be pointed upstream such that it will proceed directly across the river (hint: find the speed of the boat with respect to water/river)? a 288 b. 21.8 c. 326 d. 30.2
Answers: 3
question
Engineering, 04.07.2019 18:10
The drive force for diffusion is 7 fick's first law can be used to solve the non-steady state diffusion. a)-true b)-false
Answers: 1
question
Engineering, 04.07.2019 18:20
Asimple rankine cycle uses water as the working fluid. the water enters the turbine at 10 mpa and 480c while the condenser operates at 6 kpa. if the turbine has an isentropic efficiency of 80 percent while the pump has an isentropic efficiency of 70 percent determine the thermal efficiency
Answers: 1
question
Engineering, 04.07.2019 19:10
In general, how do thermosetting plastics compare to thermoplastics in mechanical and physical properties?
Answers: 3
You know the right answer?
Your java program will be reading input from a file name strinput. txt. each record contains string...
Questions
question
Mathematics, 04.06.2021 01:00
question
Social Studies, 04.06.2021 01:00
question
Mathematics, 04.06.2021 01:00
question
Geography, 04.06.2021 01:00
question
Physics, 04.06.2021 01:00
question
Mathematics, 04.06.2021 01:00
question
English, 04.06.2021 01:00
Questions on the website: 13722360