Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java Question 36 TicketsRUs needs an application to calculate ticket prices. There are three ticket prices: Orchestra $90 each Mezzanine $75 each Balcony $50 each

Java Question 36

TicketsRUs needs an application to calculate ticket prices. There are three ticket prices: Orchestra $90 each Mezzanine $75 each Balcony $50 each There is also a 20% discount on matinee performances . Your application has the GUI shown below. image text in transcribed With the following named components:

Component

Type

Purpose

txtNum

JTextField

Input for number of tickets

chkMatinee

JCheckBox

Check if matinee performance

radOrchestra

JRadioButton

Check for orchestra tickets

radMezzanine

JRadioButton

Check for mezzanine tickets

radBalcony

JRadioButton

Check for balcony tickets

btnCalc

JButton

Click to calculate price

txtEach

JTextField

Displays price of each ticket

txtTotal

JTextField

Displays total price

Clicking the CalcPrice button should determine the price per ticket and the total price based on the users input and display in txtEach and txtTotal. You should make sure the number of tickets is entered and a ticket type is selected, otherwise give an error message. The action listener for btnCalc is set up as follows. btnCalc.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { calcPrice(); //write the code for this method } }); Write the calcPrice method that is called by the action listener. This class method has access to all of the GUI components. You DO NOT HAVE TO CODE THE GUI. ONLY write the code for this method which does all the work. The header for the method is: private void calcPrice()

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Database 19c DBA By Examples Installation And Administration

Authors: Ravinder Gupta

1st Edition

B09FC7TQJ6, 979-8469226970

More Books

Students also viewed these Databases questions

Question

1. How will you, as city manager, handle these requests?

Answered: 1 week ago

Question

1. Identify the sources for this conflict.

Answered: 1 week ago

Question

3. How would you address the problems that make up the situation?

Answered: 1 week ago