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
![seats.txt - Notepad
File Edit Format View Help
1ST (Table)
48.50
2
1ST
44.50
3
STD (Table)
28.50
3
STD
24.50
5
Windows (CRLF)
Ln 15, Col 2
I
100%
X](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F305fc7ad-7709-41dd-8aa9-116916a708ff%2F2ece8ae2-172e-44b9-845b-517fd5583202%2Frd99lo_processed.png&w=3840&q=75)
![](/static/compass_v2/shared-icons/check-mark.png)
Step by step
Solved in 4 steps with 3 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
I am getting this error after running the code, what could be the issue?
![➡ eclipse-workspace - SeatSystem/src/SeatSystem.java - Eclipse IDE
File Edit Source Refactor Navigate Search Project Run Window Help
TO
Aphabetical_...
Forloop_Stru...
public static void main(String[] args) {
System.out.println("-- Seat Discount System--");
String customDiscountChoice = "N";
double DEFAULT_DISCOUNT_RATE = 20.0;
Scanner scanner = new Scanner(System.in);
TIGUIAAAAAb
>
> Hello
>
>
Package... X
>
>
>
20202020202020202020
FenceLength
HadenPoundConve
Lab04
LandCalculation
Part2-Task1
Part2-Task2
A
Part2-Task3
Part2-Task4
Part2-Task5
ProgramOne
RectangleArea
SeatSystem
> JRE System Libra
✓ src
src
src_Task1
>src Task3
> src_Task4
Q
> (default packa
seats.txt
Sequential Executio
StockCommission
> Supplementary Task
☐ Task1
>Task 1.1
> Task1.2
Task2
>Task2.1
☐ Task3
>Task3.1
6:
Loop.java
60
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
310
}
#
System.out.print("\nSpecify Custom Discount Rate[Y/N]: ");
customDiscountChoice = scanner.nextLine();
}
NOT
if (customDiscountChoice.equals IgnoreCase("y")) {
} else {
Nestfor_Loo...
System.out.print("Specify Discount Rate(%): ");
DEFAULT_DISCOUNT_RATE= scanner.nextDouble();
scanner.close();
System.out.print("\n");
readDispalyFileContents (DEFAULT_DISCOUNT_RATE);
ChessBoard.java
System.out.print("Assuming Discount Rate = " + DEFAULT_DISCOUNT_RATE + "%\n");
public static void readDispalyFileContents (double discountRate) {
✓
ArraySort.java
Seat Type: 1ST (Table), Seat Price:QR 48.50, Bookings: 2, Discount:QR 19.40, Income: QR 77.60
Exception in thread "main" java.lang.Number FormatException: For input string: "1ST"
SeatSystem.java X
at java.base/jdk.internal.math.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:2054)
at java.base/jdk.internal.math.FloatingDecimal.parseDouble (FloatingDecimal.java:110)
at java.base/java.lang.Double. parseDouble (Double.java:651)
at SeatSystem.readDispalyFileContents (SeatSystem.java:44)
at SeatSystem.main(Seat System.java:26)
seats.txt
XX
1010 Floating Deci...
8P
I
Q
»
0
8
Problems @ Javadoc Declaration Console X
N 2 ✓ 9 ▾▾ - 8
<terminated> SeatSystem [Java Application] C:\Users\Worker\.p2\pool\plugins\org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_17.0.4.v20220903-1038\jre\bin\javaw.exe (Oct 20, 2022, 11:17:54 PM - 11:17:58 PM) [pid: 24172
&
11:19 PM
10/20/2022
X
-O](https://content.bartleby.com/qna-images/question/305fc7ad-7709-41dd-8aa9-116916a708ff/35a1da58-a84a-43cf-a80f-62e50ac636c0/fmpmer_thumbnail.png)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)