Question: Write a java program that calculates reimbursement values and satisfies the following. 1 reads and writes data to a file. one output and input file
Write a java program that calculates reimbursement values and satisfies the following.
1 reads and writes data to a file. one output and input file
2 the first line of the data file will contain the number, an integer, of data values to process. after the first line of the data file, each line will contain a real number representing the number of miles. use a for loop to process the mileage values. do not use an array.
3 use an if/else if statement and the scale below to calculate the the mileage reimbursement if the imput value is >0
4 the main method should contain all the variables, do not use a seperate class for storage . use the following methods at least
-method to print heading for the table
- method to output summary information
- also write two leftpad methods, one to return a string consisting of a real number with one decimal place padded on the left to a specified width and one where the real number has two decimal places.
5 there should be one line of output for each mileage value processed, use a table form for the output. the table should have a heading for the table and for each of the columns. the columns of the table should be lined up by the decimal point, each detail line of the table will contain the number of miles to one decimal place and the reimbursement amount to two decimal places. if the input value is <=0, then output 5 stars in place of the reimbursement amount
6 after all the data tables have been processed, print the total of the reimbursement values, the number of mileage values processed, and the number of mileage values tghat were >=0.
the data file with data to use for the program is as follows. 10, 40.2, 799.6, -8.6, 499.5, 500.2, 5000, 2999.4, 0, 1500.1, 1239.8
reimbursement scale
up to 500 miles 15 cents per mile
500 - 1000miles $75 plus 12 cents for each mile over 500
1000 - 1500miles $135 plus 10 cents for each mile over 1000
1500 - 2000 $185 plus 8 cents per mile over 1500
2000 - 3000 $225 plus 6 cents for each mile over 2000
>3000 $285 plus 5 cents for each mile over 3000
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
