A new seat discount system is required to help managers of Qatar Railways Company (Qatar Rail) determine how much discount they have given out. Every time the system runs, the discount rate may be specified by the managers or set to a suitable default. You are thusly required to produce a console application (using Java) that is ready to open the file M:\data\seats.txt which contains the seat’s data. Upon application launch, the system should ask the managers if they wish to specify a custom discount rate, this should be in the form of a yes / no question. When the managers say yes, the system should request the discount rate as input (from the keyboard) which will then overwrite the default discount rate . When the managers say no, the system should report (to the screen) the default discount rate (i.e. like the example given below). Next, the system should loop through the seat’s data, calculating and printing (to the screen) the seat type, seat price, number of bookings, discount and income following discount, the latter two requiring some basic calculations. Finally, the running totals for the discount and income following discount should be calculated and printed before the application gracefully exits. Example Specify Custom Discount Rate [Y|N] : N Assuming Discount Rate = 20.0% Seat Type : 1ST(Table), Seat Price : QR 48.50, Bookings : 2, Discount : QR 19.40, Income : QR 77.60 Seat Type : 1ST, Seat Price : QR 44.50, Bookings : 3, Discount : QR 26.70, Income : QR 106.80 Seat Type : STD(Table), Seat Price : QR 28.50, Bookings : 3, Discount : QR 17.10, Income : QR 68.40 Seat Type : STD, Seat Price : QR 24.50, Bookings : 5, Discount : QR 24.50, Income : QR 98.00 Total Income : QR 350.80 Total Discount : QR 87.70 I have attached the image of the seats.txt file
A new seat discount system is required to help managers of Qatar Railways Company (Qatar Rail) determine how much discount they have given out. Every time the system runs, the discount rate may be specified by the managers or set to a suitable default. You are thusly required to produce a console application (using Java) that is ready to open the file M:\data\seats.txt which contains the seat’s data.
Upon application launch, the system should ask the managers if they wish to specify a custom discount rate, this should be in the form of a yes / no question. When the managers say yes, the system should request the discount rate as input (from the keyboard) which will then overwrite the default discount rate . When the managers say no, the system should report (to the screen) the default discount rate (i.e. like the example given below). Next, the system should loop through the seat’s data, calculating and printing (to the screen) the seat type, seat price, number of bookings, discount and income following discount, the latter two requiring some basic calculations.
Finally, the running totals for the discount and income following discount should be calculated and printed before the application gracefully exits.
Example
Specify Custom Discount Rate [Y|N] : N
Assuming Discount Rate = 20.0%
Seat Type : 1ST(Table), Seat Price : QR 48.50, Bookings : 2, Discount : QR 19.40, Income : QR 77.60
Seat Type : 1ST, Seat Price : QR 44.50, Bookings : 3, Discount : QR 26.70, Income : QR 106.80
Seat Type : STD(Table), Seat Price : QR 28.50, Bookings : 3, Discount : QR 17.10, Income : QR 68.40
Seat Type : STD, Seat Price : QR 24.50, Bookings : 5, Discount : QR 24.50, Income : QR 98.00
Total Income : QR 350.80
Total Discount : QR 87.70
I have attached the image of the seats.txt file
Step by step
Solved in 4 steps with 3 images
I am getting this error after running the code, what could be the issue?