Professional Documents
Culture Documents
PROG
PROG
Spend 15 minutes ensuring that your programs meet the general criteria below (10).
Create two (2) child classes of Product called Perishable and NonPerishable. Each must include the
setPrice() method that will set the price for a Perishable product to R11.99 and R19.99 for a
NonPerishable product. Write a constructor for each child class and include a call to the setPrice()
method within each.
Create a class named UseProduct to demonstrate using an object of each child class and print out
the following:
Write a java program that uses methods/ procedures and parameter passing to do the following:
Q.2.1 When the program starts it must display the following GUI:
Q.2.2 When the user clicks on the Place Order Menu item, read the user choices and store
these in variables. Then display this information in a message box as shown below.
Q.2.3 When the user clicks on the Amount Due menu item, use the following price
information to calculate the total amount due for the order and display in a
message box as shown below:
Q.2.4 When the user clicks on the Print Order menu item, print the report as per the
screenshot below in a textarea/ listbox:
Q.2.5 When the user clicks on Save Order, write the entire order to a new file named
“NewOrder.txt”. Also show a message confirmation box as displayed below:
Q.2.6 The exit menu item must display a messagebox which must be appropriately coded,
as follows:
Q.2.7
Marking Guideline Mark Examiner Moderator
Import statements 2
Variable and array declarations 3
GUI Design 10
Menu structure 3
Message Boxes 2
Open File-Place and show order 5
Calculate Amount Due menu code 10
Print Order Menu code 5
Save Order – write to new file 8
Text Files created and saved 2
TOTAL 50
END OF PAPER