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

New Perspectives on HTML5, CSS3, and JavaScript
6th Edition
ISBN:9781305503922
Author:Patrick M. Carey
Publisher:Patrick M. Carey
Chapter1: Getting Started With Html5: Creating A Website For A Food Vendor
Section1.3: Visual Overview: Lists And Hypertext Links
Problem 5QC
icon
Related questions
Question

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
Transcribed Image Text: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
Expert Solution
steps

Step by step

Solved in 4 steps with 3 images

Blurred answer
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question

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
Transcribed Image Text:➡ 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
Solution
Bartleby Expert
SEE SOLUTION
Knowledge Booster
Study of Characters
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
New Perspectives on HTML5, CSS3, and JavaScript
New Perspectives on HTML5, CSS3, and JavaScript
Computer Science
ISBN:
9781305503922
Author:
Patrick M. Carey
Publisher:
Cengage Learning
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
Computer Science
ISBN:
9780357392676
Author:
FREUND, Steven
Publisher:
CENGAGE L
Np Ms Office 365/Excel 2016 I Ntermed
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:
9781337508841
Author:
Carey
Publisher:
Cengage