Question: In this assignment, you will be writing a very simple program that reads staff info from input.txt, calculate their monthly payments for the month of

In this assignment, you will be writing a very simple program that reads staff info from input.txt, calculate their monthly payments for the month of November, and stores the calculated payments into NovPayments.txt.

Whenever you felt some info is missing but should have been provided, use your best judgment.

Requirements:

Your program should handle all of the RELEVANT exceptions (including NumberFormatException, and IOException).

A method called openFile

Receives a string as its input argument,

Prints that string to console,

Receives a file name from the user, open that file,

Returns a BufferedInput object.

By handling relative exception(s), this method keeps asking for file names, printing appropriate error message, till user enters the correct file name (in our case input.txt).

A method called run, that:

Receives nothing, and has no return type.

Uses openFile method and looks at every line of the input.txt

Based on the below rules, writes into NovPayments.txt

Rules:In input.txt file, each line has this structure: firstName,lastName,hoursWorked,hourlyPayment

hoursWorked is an integer and hourlyPayment is a double (although both of them had to be converted to string to be stored in this file)

In output.txt file, each line has this structure: firstName,lastName,payment

payment = hoursWorked*hourlyPayment

Below, find a sample input.txt (left) and the corresponding NovPaments.txt (right). Test your program for the below input & output.

input.txt below

Minta,Lofton,150,$8

Terrel,Metzer,162,$9.2

Pouya,Rahmati,12F,$2.3

Roxie,Galyean,120,$8.4

Output txt below

Minta,Lofton,$1200

Terrel,Metzer,$1490.4

Pouya,Rahmati,Error!!!

Roxie,Galyean,$1008

Note that you are supposed to handle all exceptions, so if there was a data entry, or any other types of error in any given line your code should not crash.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!