ITE 233 Northern Virginia Community College Programming Worksheet

Toll Fee Application (Continued)1. Create a new Java GUI class, “TollFee4”. The GUI is an exact copy of the GUI you create on the
“TollFee3”.
a) Modify this class by adding a process of writing the data to a text file when the “Pay ”
button is clicked. Name your file as “receipt.txt”.
b) Modify the class by adding a process of reading the data from the text file, “receipt.txt”,
and display the content in the file using print statements when “Print Receipt” button is
clicked.
Figure f) Input information and pop-up box
Figure g) Content is saved in the receipt.txt file.
Figure h) When the “Print Receipt” button is clicked, the content in the file is printed.
2. Create a new Java GUI class, “TollFee5”. The GUI is an exact copy of the GUI you create on the
“TollFee4”. Modify this class so that when the “Pay” button is clicked, it also includes the fee in
the pop-up box and write the fee to the receipt.txt.
The fees for “Regular Tolls” of each type of vehicle are as followed:
Vehicle Type
Fee ($)
2 Axels
3.00
3 or More Axels
4.00
Motorcycle
1.00
The fees for “Peak Weekends” are additional $3.00 more from the fee of “Regular Tolls” of that
particular vehicle type.
Figure i) Pop-up box when 3 or More Axels and Regular Tolls are selected.
Figure j) receipt.txt
Figure k) Pop-up box when 3 or More Axels and Peak Weekends are selected.
Figure l) receipt.txt
Solution: GasStation1.java
Solution: GasStation2.java
Solution: AmountException.java
Solution: GasStation3.java
Solution: GasStation4.java
Solution: GasStation5.java
Toll Fee Application (Continued)
1. Create a new Java GUI class, “TollFee4”. The GUI is an exact copy of the GUI you create on the
“TollFee3”.
a) Modify this class by adding a process of writing the data to a text file when the “Pay ”
button is clicked. Name your file as “receipt.txt”.
b) Modify the class by adding a process of reading the data from the text file, “receipt.txt”,
and display the content in the file using print statements when “Print Receipt” button is
clicked.
Figure f) Input information and pop-up box
Figure g) Content is saved in the receipt.txt file.
Figure h) When the “Print Receipt” button is clicked, the content in the file is printed.
2. Create a new Java GUI class, “TollFee5”. The GUI is an exact copy of the GUI you create on the
“TollFee4”. Modify this class so that when the “Pay” button is clicked, it also includes the fee in
the pop-up box and write the fee to the receipt.txt.
The fees for “Regular Tolls” of each type of vehicle are as followed:
Vehicle Type
Fee ($)
2 Axels
3.00
3 or More Axels
4.00
Motorcycle
1.00
The fees for “Peak Weekends” are additional $3.00 more from the fee of “Regular Tolls” of that
particular vehicle type.
Figure i) Pop-up box when 3 or More Axels and Regular Tolls are selected.
Figure j) receipt.txt
Figure k) Pop-up box when 3 or More Axels and Peak Weekends are selected.
Figure l) receipt.txt
Page |1
Assume that a local government has asked you to develop a simple program, which allows a clerk to
perform cashier tasks at its tollbooths. The program must allow the clerk to select a type of vehicle
and type of fee to determine the fee for that particular vehicle. Three buttons (Pay, Print Receipt and
Clear) must be included in the GUI for the clerk to perform the tasks accordingly.
To develop the program, please follow the steps below.
1. Create a Java GUI class, “TollFee1”. The GUI must contain the components as shown below.
However, the layout can be different. You can come up with your own design.
Types of vehicles are “2 Axels”, “3 or More Axels” and “Motorcycle”.
Content of the drop box are “Regular Tolls” and “Peek Weekends”.
Figure a) GUI
Page |2
2. Create a new Java GUI class, “TollFee2”. The GUI is an exact copy of the GUI you create on
“TollFee1”.
a) Add ActionListener to the “Pay” button so that it displays a pop up box containing the
information as shown below.
b) Add ActionListener to the “Clear” button so that it unchecked all of type of vehicle and
reset the drop box to “Regular Tolls”.
Figure b) Pop-up box with information appears when “Pay” button is clicked. First type of
vehicle is checked and “Regular Tolls” is selected.
Figure c) Pop-up box with information appears when “Pay” button is clicked. Second type of
vehicle is checked and “Peek Weekends” is selected.
Page |3
Figure d) Pop-up box with information appears when “Pay” button is clicked. Third type of
vehicle is checked and “Regular Tolls” is selected.
Page |4
3. Create the following Java Exception class
a) VehicleException
This class must include two constructors. One that displays a default error message,
“Error: Select a type of vehicle!!!”. The other allows the error message to be changed.
b) Create a new Java GUI, “TollFee3” The GUI is an exact copy of the GUI you create on the
“TollFee2”. Modify this class by adding the exception you create above to detect the
following:
If none of the vehicle types is checked, the program must throw the VehicleException
and pop-up the default error message.
Figure e) “Pay” button is clicked while none of the vehicle types is checked.

Calculate your order
275 words
Total price: $0.00

Top-quality papers guaranteed

54

100% original papers

We sell only unique pieces of writing completed according to your demands.

54

Confidential service

We use security encryption to keep your personal data protected.

54

Money-back guarantee

We can give your money back if something goes wrong with your order.

Enjoy the free features we offer to everyone

  1. Title page

    Get a free title page formatted according to the specifics of your particular style.

  2. Custom formatting

    Request us to use APA, MLA, Harvard, Chicago, or any other style for your essay.

  3. Bibliography page

    Don’t pay extra for a list of references that perfectly fits your academic needs.

  4. 24/7 support assistance

    Ask us a question anytime you need to—we don’t charge extra for supporting you!

Calculate how much your essay costs

Type of paper
Academic level
Deadline
550 words

How to place an order

  • Choose the number of pages, your academic level, and deadline
  • Push the orange button
  • Give instructions for your paper
  • Pay with PayPal or a credit card
  • Track the progress of your order
  • Approve and enjoy your custom paper

Ask experts to write you a cheap essay of excellent quality

Place an order