Update the GUI application you have developed so far by adding a Java application to store the order just made by the customer in a file and present a file confirmation message using files and strea
Phase 3 Application Screenshots 17
ITSD424
1803B-01
Object Oriented Application Development II
Famous Favorite Subs (Unit 3 IP)
Jacqueline Calloway
July 24, 2018
Use Case Customer Places order.
Main Actor: Customer
Details: Customer first selects his/her language preference then they select what they are having from the menu selection.
Ordering System: System is wireless and must me recharged at closing, the display is ready upon the customers arrival the user activates the menu by selection start.
Ordering Process:
Customer selects his/her language preference
Customer then selects the menu to get started
Customer orders a drink from the drink menu
Customer then selects what he/ she would like to eat
Customer confirms order
Placing Wrong Order:
Customer mistakenly orders an item when ordering they can press the back key to return to the previous menu.
Customer enters wrong item and wants to return back to main menu.
Order Placed: Confirmed order is sent to the kitchen where it then is prepared.
Summary: User is familiar with how to enter values through mouse and has a general idea why the inputs are being provided and what is expect.
package famous.favourite.subs;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*;
public class FamousFavouriteSubs {
JFrame frame;//defining a frame in public class
public static void main(String[] args) {
FamousFavouriteSubs db = new FamousFavouriteSubs();
//Container myPane = frame.getContentPane();
}
public FamousFavouriteSubs(){
frame = new JFrame("FamousFavouriteSubs");
frame.pack();// to autosize the frame
frame.setVisible(true);
// what happen when the user clicks the close button
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JButton button = new JButton("order Now");
button.addActionListener(new MyAction());
frame.add(button);
///Below code makes the frame size half the size of the computer screen
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
int height = screenSize.height;
int width = screenSize.width;
frame.setSize(width/2, height/2);
// center the jframe on screen
frame.setLocationRelativeTo(null);
}
public class MyAction implements ActionListener{
public void actionPerformed(ActionEvent e){
// prompt thecustomer to enter their name
String name = JOptionPane.showInputDialog(frame, "Enter your name");
// prompt thecustomer to enter their delivery address
String adress = JOptionPane.showInputDialog(frame, "Enter your Address");
// prompt thecustomer to enter their favourite beverage
String beverage = JOptionPane.showInputDialog(frame, "Enter your favourite beverage");
// prompt thecustomer to enter their favourite sub bread
String sub_bread= JOptionPane.showInputDialog(frame, "Enter your favourite sub bread");
// prompt thecustomer to enter their favourite sub type
String sub_type = JOptionPane.showInputDialog(frame, "Enter your sub type");
showInputDialog();
JOptionPane.showMessageDialog(frame,
"Welcome \t"+name+" \tto"+
"\n****FamousFavouriteSubs****"+
"\n Your favourite selection in FamousFavouriteSubs include:\t"+
"\n SUB BREAD:\t"+sub_bread+
"\nFavourite Beverage:\t"+beverage+
"\nSUB TYPE:\t"+sub_type+
"\nSUB SIZE:\t"+showInputDialog()+
"\nYour favourites to be delivered to:\t"+adress+
"\n Thank for visiting us come again");
}
public String showInputDialog()
// prompt thecustomer to enter their favourite sub size
String inputValue = JOptionPane.showInputDialog("Enter sub size");
if(inputValue == null || inputValue.isEmpty() || inputValue.matches("[A-Za-z]*"))
{
JOptionPane.showMessageDialog(frame,"Enter only integer");
inputValue = showInputDialog();//call the fuction again until the condition is met
}
return inputValue;
}
Phase 2 Application Screenshots
Input Name:
Input Address:
Input Drink:
Input Bread:
Input Style:
Input Size:
Final Output:
Phase 3
Application Screenshots
Address input and Name input
Here chose Favorite beverage and key in Bread Details
Validation Field
Sub Size and Sub type
Output message
Clear the Filled Details