Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In java Lab 09- 30 points For today's lab you will be doing two exercises pertaining to GUls. This will demonstrate your comprehension of basic

In java
image text in transcribed
image text in transcribed
Lab 09- 30 points For today's lab you will be doing two exercises pertaining to GUls. This will demonstrate your comprehension of basic GUI development. Remember to follow along with our lecture notes and use the textbook for reference Part 1 (15 points) Write a graphical application that produces a restaurant bill. YOU WILL NOT BE GRADED ON LAYOUT/AESTHETICS, unless it is unreadable. Instead, focus ON FUNCTIONALITY AND ADHERANCE TO REQUIREMENTS only. Provide buttons for ten popular dishes or drink items. You decide on the items and their prices. Optionally, you can use accompanying labels or set the text of the button (8 points, see some implementation options below) Provide text fields and a button for entering less popular items and prices. The item will be a separate field from its price, and you will require a button. (3points) In a text area, show the bill as items are entered. Have a button ("Calculate") that adds sometax and a preset tip, and calculates the total bill after theuser clicks a finish/calculate bill button. (4 points) Since we have not learned layouts yet, simply add all your components to a single panel and set your frame height and width such that the program appears the most readable and intuitive. Button Implementation options There are different ways you can design and implement your buttons. We describe three options here, in order of points that reflect the better designs. Best option Full Points (8/8) Advanced (best way of doing it) that won't require you to compare buttons at all (no if statement. All of these JComponents are extendable, so, Extend JButton to make your own restaurant button. Give it instance variables that you need for your calculations Now, when the ActionListener ActionPerformed method is pushed, you can check ifthe source is an instanceOf YourNewButtonType, cast it to that YourNewButtonType, and use its getters to get the information you need. This is for full points and will make your lives a lot easier as well as teach an important lesson. Advanced option (6 2) Use the parameter of theActionPerformed method (Event) to find out which button is the source of the event using Event-getSource0. Then compare that to your buttons, which should be instance variables, to find out which button was pushed, and act accordingly. HINT: THIS IS POSSIBLE BECAUSE YOU WILL HAVE MADE YOUR Action Listener in a specific way that that can see these instance variables

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

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2014 Nancy France September 15 19 2014 Proceedings Part 2 Lnai 8725

Authors: Toon Calders ,Floriana Esposito ,Eyke Hullermeier ,Rosa Meo

2014th Edition

3662448505, 978-3662448502

More Books

Students also viewed these Databases questions