CST242 Project 3: Chapter 13
Tip Calculator App
-
Create a new JavaFX (not FXML)
project which is a modification of
instructions in the textbook for Exercise 13.6 with two classes TipCalculator
(the JavaFX class) and Order
-
Create the Tip Calculator as follows:
-
Start with an Order class with two instance variables, item
a
String
and price a double
; include two constructors,
a no-parameter constructor that passes default values empty String and zero (0) to the second
constructor which then calls the set methods for item and price; the set method
for price validates that price is greater than zero (0); include get methods for both instance
variables; there is no need for a toString()
method
-
Instantiate ten objects from the Order class in the
start()
method of
the JavaFX application from which two ObservableList
objects should be
instantiated: (a) an ObservableList of String
s populated from the get
method for the “item” field; and (b) an ObservableList of Double
s
(use the wrapper class as the sub type to instantiate) populated from the get
method for the “price” field
-
The JavaFX form will consist of (a) a
ListView
of Strings from the
ObservableList of “items”; (b) a Slider
that represents tip percentage
as an int
between 15% and 25% (show the current value of the “tip percent”
slider in a matching Label
); (c) a Button
that is clicked
to calculate the “total bill”; and (d) a “result” Label
-
Include an event handler method for the Button that
calculates the “total bill” as follows: the “price” field from the ObservableList
that matches the selected “item” from the ListView (the user may purchase only one
item at a time) times sales tax (8.625%) plus the tip which is the matching “price”
from the ObservableList times the percentage from the Slider; display with text
labels in the “result” Label the selected “item”, its matching “price”, the sales
tax, the amount of the “tip” and the “total bill”
-
Use a combination of layout objects, as well as font and color formatting to create
a pleasing, professional looking form window
-
Provide full documentation using the Javadoc standard and based upon the
downloaded sample files for the unit
-
Students may work on all projects in teams of two or three,
and, if so, all students in the group must submit the same project to their own dropboxes
in Brightspace. In the text box's dropbox, as well as in the source code documentation
(comments), state the name(s) of the classmate(s) with whom you worked.
-
When all steps are finished, create a .ZIP archive (not a .RAR)
of the entire project. This completed assignment with a copy of all files from the
NetBeans project submitted electronically via an attachment to a
Brightspace
dropbox is due to Prof. Struck by 11:59 p.m. on the date specified in the course outline.