OOP PROJECT REPORT
-
Upload
minahil-saeed -
Category
Education
-
view
124 -
download
4
description
Transcript of OOP PROJECT REPORT
![Page 1: OOP PROJECT REPORT](https://reader035.fdocuments.us/reader035/viewer/2022062312/553a9ad65503467a438b45a8/html5/thumbnails/1.jpg)
oop project report
SUBMITTED TO: SIR ZAIN-UL-ABIDEEN
MINAHIL SAEED
ABDUL MATEEN
UZAIR ALI
![Page 2: OOP PROJECT REPORT](https://reader035.fdocuments.us/reader035/viewer/2022062312/553a9ad65503467a438b45a8/html5/thumbnails/2.jpg)
Project Title:
Domino’s Pizza
Domino’s Pizza:Domino's Pizza is the recognized world leader in pizza delivery. Founded in 1960, Domino's is the second-largest pizza chain in the United States (after Pizza Hut) and the largest worldwide, with more than 10,000 corporate and franchised stores in 70 countries.
![Page 3: OOP PROJECT REPORT](https://reader035.fdocuments.us/reader035/viewer/2022062312/553a9ad65503467a438b45a8/html5/thumbnails/3.jpg)
SUMMARY OF A PROJECT:This program will allow users to order a pizza with just a couple of clicks. The order will be a step by step by procedure. The user will be able to select from a range of Pizzas on the menu or make a Pizza of their own by choosing from different types of crusts, toppings, sidelines. When the order ends, the program will display the total cost depending on the toppings, crusts etc.
![Page 4: OOP PROJECT REPORT](https://reader035.fdocuments.us/reader035/viewer/2022062312/553a9ad65503467a438b45a8/html5/thumbnails/4.jpg)
Code:
package javaapplication40;
import javax.swing.JFrame;
import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.JLabel;
import javax.swing.ImageIcon;
import javax.swing.JCheckBox;
import javax.swing.ButtonGroup;
import javax.swing.JRadioButton;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JTextField;
import javax.swing.JTextArea;
import java.awt.Color;
import java.awt.image.BufferedImage;
import javax.imageio.ImageIO;
import java.io.File;
![Page 5: OOP PROJECT REPORT](https://reader035.fdocuments.us/reader035/viewer/2022062312/553a9ad65503467a438b45a8/html5/thumbnails/5.jpg)
import java.io.IOException;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.Dimension;
import java.awt.BorderLayout;
import java.awt.FlowLayout;
import javax.swing.BoxLayout;
import javax.swing.JOptionPane;
public class JavaApplication40 {
public static void main(String[] args)throws IOException {
Order obj=new Order();
}
}
class Order extends JFrame implements ActionListener
{
int total=0,sizecost=0,crustcost=0,flavorcost=0,veggiescost=0,drinkscost=0,sidescost=0;
int toppings=0,drinks=0,sides=0;
int count=0;
boolean flag=false;
![Page 6: OOP PROJECT REPORT](https://reader035.fdocuments.us/reader035/viewer/2022062312/553a9ad65503467a438b45a8/html5/thumbnails/6.jpg)
String crust,flavor,size,sauce,veggies;
String text;
JPanel sizePanel=new JPanel();
JPanel crustPanel=new JPanel();
JPanel fvPanel=new JPanel();
JButton submitButton=new JButton();
JButton resetButton=new JButton();
JButton addButton=new JButton();
JTextArea totalTextArea=new JTextArea();
JMenu pepsimenu=new JMenu("Pepsi");
JMenu fantamenu=new JMenu("Fanta");
JMenu spritemenu=new JMenu("Sprite");
JMenuItem p_one=new JMenuItem("1");
JMenuItem p_two=new JMenuItem("2");
JMenuItem p_three=new JMenuItem("3");
JMenuItem p_four=new JMenuItem("4");
JMenuItem f_one=new JMenuItem("1");
JMenuItem f_two=new JMenuItem("2");
JMenuItem f_three=new JMenuItem("3");
JMenuItem f_four=new JMenuItem("4");
JMenuItem s_one=new JMenuItem("1");
JMenuItem s_two=new JMenuItem("2");
JMenuItem s_three=new JMenuItem("3");
JMenuItem s_four=new JMenuItem("4");
![Page 7: OOP PROJECT REPORT](https://reader035.fdocuments.us/reader035/viewer/2022062312/553a9ad65503467a438b45a8/html5/thumbnails/7.jpg)
Order() throws IOException
{
super();
//The Main Frame
setTitle("Dominos Pakistan");
setSize(1024,786);
setLocation(0,0);
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
getContentPane().setBackground(Color.WHITE);
FlowLayout f1=new FlowLayout();
//The Dominos Header Panel
JPanel headerPanel= new JPanel();
headerPanel.setSize(1280,200);
headerPanel.setBackground(Color.BLUE);
headerPanel.setLayout(f1);
BufferedImage headerPicture = ImageIO.read(new File("C:\\Users\\Minahil\\Documents\\Project\\header.jpg"));
JLabel headerLabel = new JLabel(new ImageIcon(headerPicture));
headerPanel.add(headerLabel);
//The Panel in which user chooses the type of Crust
crustPanel.setBackground(Color.ORANGE);
![Page 8: OOP PROJECT REPORT](https://reader035.fdocuments.us/reader035/viewer/2022062312/553a9ad65503467a438b45a8/html5/thumbnails/8.jpg)
crustPanel.setLayout(new BoxLayout(crustPanel,BoxLayout.Y_AXIS));
//The 'Crust' Image used inside a Label
JLabel crustLabel=new JLabel();
ImageIcon crustImage=new ImageIcon("C:\\Users\\Minahil\\Documents\\Project\\crust.jpg");
crustLabel.setIcon(crustImage);
crustPanel.add(crustLabel);
//The Radio Buttons used under the Crust Option
JRadioButton normalRadioButton=new JRadioButton("Normal");
normalRadioButton.addActionListener(this);
normalRadioButton.setBackground(Color.ORANGE);
JRadioButton thinzaRadioButton=new JRadioButton("Thinza");
thinzaRadioButton.addActionListener(this);
thinzaRadioButton.setBackground(Color.ORANGE);
ButtonGroup crustButtonGroup=new ButtonGroup();
crustButtonGroup.add(normalRadioButton);
crustButtonGroup.add(thinzaRadioButton);
crustPanel.add(normalRadioButton);
crustPanel.add(thinzaRadioButton);
JLabel completeLabel=new JLabel();
ImageIcon completeImage=new ImageIcon("C:\\Users\\Minahil\\Documents\\Project\\complete.jpg");
completeLabel.setIcon(completeImage);
![Page 9: OOP PROJECT REPORT](https://reader035.fdocuments.us/reader035/viewer/2022062312/553a9ad65503467a438b45a8/html5/thumbnails/9.jpg)
crustPanel.add(completeLabel);
JLabel contactLabel=new JLabel();
ImageIcon contactImage=new ImageIcon("C:\\Users\\Minahil\\Documents\\Project\\contact.jpg");
contactLabel.setIcon(contactImage);
crustPanel.add(contactLabel);
JTextField contactTextField=new JTextField();
contactTextField.setMaximumSize(new Dimension(Integer.MAX_VALUE,contactTextField.getPreferredSize().height));
crustPanel.add(contactTextField);
JLabel nameLabel=new JLabel();
ImageIcon nameImage=new ImageIcon("C:\\Users\\Minahil\\Documents\\Project\\name.jpg");
nameLabel.setIcon(nameImage);
crustPanel.add(nameLabel);
JTextField nameTextField=new JTextField();
nameTextField.setMaximumSize(new Dimension(Integer.MAX_VALUE,nameTextField.getPreferredSize().height));
crustPanel.add(nameTextField);
JLabel addressLabel=new JLabel();
ImageIcon addressImage=new ImageIcon("C:\\Users\\Minahil\\Documents\\Project\\address.jpg");
addressLabel.setIcon(addressImage);
crustPanel.add(addressLabel);
![Page 10: OOP PROJECT REPORT](https://reader035.fdocuments.us/reader035/viewer/2022062312/553a9ad65503467a438b45a8/html5/thumbnails/10.jpg)
JTextField addressTextField=new JTextField();
crustPanel.add(addressTextField);
//The Panel in which user selects size of the Pizza
sizePanel.setBackground(Color.ORANGE);
sizePanel.setPreferredSize(new Dimension(400,100));
sizePanel.setLayout(f1);
sizePanel.setLayout(new BoxLayout(sizePanel,BoxLayout.Y_AXIS));
//The 'Size' Image used inside a Label
JLabel sizeLabel=new JLabel();
ImageIcon sizeImage=new ImageIcon("C:\\Users\\Minahil\\Documents\\Project\\size.jpg");
sizeLabel.setIcon(sizeImage);
sizePanel.add(sizeLabel);
//The buttons under the Size option
JRadioButton sliceRadioButton=new JRadioButton("Slice");
sliceRadioButton.addActionListener(this);
sliceRadioButton.setBackground(Color.ORANGE);
JRadioButton halfRadioButton=new JRadioButton("Half");
halfRadioButton.addActionListener(this);
halfRadioButton.setBackground(Color.ORANGE);
JRadioButton fullRadioButton=new JRadioButton("Full");
fullRadioButton.addActionListener(this);
![Page 11: OOP PROJECT REPORT](https://reader035.fdocuments.us/reader035/viewer/2022062312/553a9ad65503467a438b45a8/html5/thumbnails/11.jpg)
fullRadioButton.setBackground(Color.ORANGE);
ButtonGroup sizeButtonGroup=new ButtonGroup();
sizeButtonGroup.add(sliceRadioButton);
sizeButtonGroup.add(halfRadioButton);
sizeButtonGroup.add(fullRadioButton);
sizePanel.add(sliceRadioButton);
sizePanel.add(halfRadioButton);
sizePanel.add(fullRadioButton);
JLabel sideLabel=new JLabel();
ImageIcon sideImage=new ImageIcon("C:\\Users\\Minahil\\Documents\\Project\\side.jpg");
sideLabel.setIcon(sideImage);
sizePanel.add(sideLabel);
JCheckBox breadCheckBox=new JCheckBox("Garlic Bread");
breadCheckBox.addActionListener(this);
breadCheckBox.setBackground(Color.ORANGE);
JCheckBox wingsCheckBox=new JCheckBox("Chicken Wings");
wingsCheckBox.addActionListener(this);
wingsCheckBox.setBackground(Color.ORANGE);
JCheckBox wedgesCheckBox=new JCheckBox("Potato Wedges");
wedgesCheckBox.addActionListener(this);
wedgesCheckBox.setBackground(Color.ORANGE);
JCheckBox pocketsCheckBox=new JCheckBox("Cheesy Pockets");
![Page 12: OOP PROJECT REPORT](https://reader035.fdocuments.us/reader035/viewer/2022062312/553a9ad65503467a438b45a8/html5/thumbnails/12.jpg)
pocketsCheckBox.addActionListener(this);
pocketsCheckBox.setBackground(Color.ORANGE);
sizePanel.add(breadCheckBox);
sizePanel.add(wingsCheckBox);
sizePanel.add(wedgesCheckBox);
sizePanel.add(pocketsCheckBox);
JLabel drinksLabel=new JLabel();
ImageIcon drinksImage=new ImageIcon("C:\\Users\\Minahil\\Documents\\Project\\drinks.jpg");
drinksLabel.setIcon(drinksImage);
sizePanel.add(drinksLabel);
JMenuBar menubar=new JMenuBar();
pepsimenu.setPreferredSize(new Dimension(100, 25));
fantamenu.setPreferredSize(new Dimension(100, 25));
spritemenu.setPreferredSize(new Dimension(100, 25));
p_one.addActionListener(this);
pepsimenu.add(p_one);
p_two.addActionListener(this);
pepsimenu.add(p_two);
p_three.addActionListener(this);
pepsimenu.add(p_three);
![Page 13: OOP PROJECT REPORT](https://reader035.fdocuments.us/reader035/viewer/2022062312/553a9ad65503467a438b45a8/html5/thumbnails/13.jpg)
p_four.addActionListener(this);
pepsimenu.add(p_four);
f_one.addActionListener(this);
fantamenu.add(f_one);
f_two.addActionListener(this);
fantamenu.add(f_two);
f_three.addActionListener(this);
fantamenu.add(f_three);
f_four.addActionListener(this);
fantamenu.add(f_four);
s_one.addActionListener(this);
spritemenu.add(s_one);
s_two.addActionListener(this);
spritemenu.add(s_two);
s_three.addActionListener(this);
spritemenu.add(s_three);
s_four.addActionListener(this);
spritemenu.add(s_four);
menubar.add(pepsimenu);
menubar.add(fantamenu);
menubar.add(spritemenu);
![Page 14: OOP PROJECT REPORT](https://reader035.fdocuments.us/reader035/viewer/2022062312/553a9ad65503467a438b45a8/html5/thumbnails/14.jpg)
sizePanel.add(menubar);
//The panel in which user selects the type of Sauce
JPanel saucePanel=new JPanel();
saucePanel.setBackground(Color.green);
saucePanel.setLayout(f1);
//The 'Sauce' Image used inside a label
JLabel sauceLabel=new JLabel();
ImageIcon sauceImage=new ImageIcon("C:\\Users\\Minahil\\Documents\\Project\\sauce.jpg");
sauceLabel.setIcon(sauceImage);
saucePanel.add(sauceLabel);
//The options after the Sauce label
JRadioButton mildRadioButton=new JRadioButton("Mild");
mildRadioButton.addActionListener(this);
mildRadioButton.setBackground(Color.green);
JRadioButton hotRadioButton=new JRadioButton("Hot");
hotRadioButton.addActionListener(this);
hotRadioButton.setBackground(Color.green);
JRadioButton extrahotRadioButton=new JRadioButton("Extra Hot");
extrahotRadioButton.addActionListener(this);
extrahotRadioButton.setBackground(Color.green);
ButtonGroup sauceButtonGroup=new ButtonGroup();
![Page 15: OOP PROJECT REPORT](https://reader035.fdocuments.us/reader035/viewer/2022062312/553a9ad65503467a438b45a8/html5/thumbnails/15.jpg)
sauceButtonGroup.add(mildRadioButton);
sauceButtonGroup.add(hotRadioButton);
sauceButtonGroup.add(extrahotRadioButton);
saucePanel.add(mildRadioButton);
saucePanel.add(hotRadioButton);
saucePanel.add(extrahotRadioButton);
//The Add Another, Reset and Next Button
addButton.addActionListener(this);
addButton.setBackground(Color.GREEN);
ImageIcon addImage=new ImageIcon("C:\\Users\\Minahil\\Documents\\Project\\add.jpg");
addButton.setIcon(addImage);
saucePanel.add(addButton);
resetButton.addActionListener(this);
resetButton.setBackground(Color.GREEN);
ImageIcon resetImage=new ImageIcon("C:\\Users\\Minahil\\Documents\\Project\\reset.jpg");
resetButton.setIcon(resetImage);
saucePanel.add(resetButton);
submitButton.addActionListener(this);
submitButton.setBackground(Color.GREEN);
ImageIcon submitImage=new ImageIcon("C:\\Users\\Minahil\\Documents\\Project\\submit.jpg");
submitButton.setIcon(submitImage);
saucePanel.add(submitButton);
![Page 16: OOP PROJECT REPORT](https://reader035.fdocuments.us/reader035/viewer/2022062312/553a9ad65503467a438b45a8/html5/thumbnails/16.jpg)
//The panel in which options for flavor and vegetables is selected
fvPanel.setBackground(Color.ORANGE);
fvPanel.setPreferredSize(new Dimension(400,100));
fvPanel.setLayout(new BoxLayout(fvPanel,BoxLayout.Y_AXIS));
//The 'Flavor' image used inside a label
JLabel flavorLabel=new JLabel();
ImageIcon flavorImage=new ImageIcon("C:\\Users\\Minahil\\Documents\\Project\\flavor.jpg");
flavorLabel.setIcon(flavorImage);
fvPanel.add(flavorLabel);
//The options displayed after Flavor
JRadioButton cheeseRadioButton=new JRadioButton("Cheese");
cheeseRadioButton.addActionListener(this);
cheeseRadioButton.setBackground(Color.ORANGE);
JRadioButton fajitaRadioButton=new JRadioButton("Chicken Fajita");
fajitaRadioButton.addActionListener(this);
fajitaRadioButton.setBackground(Color.ORANGE);
JRadioButton tikkaRadioButton=new JRadioButton("Chicken Tikka");
tikkaRadioButton.addActionListener(this);
tikkaRadioButton.setBackground(Color.ORANGE);
JRadioButton pepperoniRadioButton=new JRadioButton("Pepperoni");
pepperoniRadioButton.addActionListener(this);
pepperoniRadioButton.setBackground(Color.ORANGE);
![Page 17: OOP PROJECT REPORT](https://reader035.fdocuments.us/reader035/viewer/2022062312/553a9ad65503467a438b45a8/html5/thumbnails/17.jpg)
JRadioButton vegiRadioButton=new JRadioButton("Vegitarian");
vegiRadioButton.addActionListener(this);
vegiRadioButton.setBackground(Color.ORANGE);
ButtonGroup flavorButtonGroup=new ButtonGroup();
flavorButtonGroup.add(cheeseRadioButton);
flavorButtonGroup.add(fajitaRadioButton);
flavorButtonGroup.add(tikkaRadioButton);
flavorButtonGroup.add(pepperoniRadioButton);
flavorButtonGroup.add(vegiRadioButton);
fvPanel.add(cheeseRadioButton);
fvPanel.add(fajitaRadioButton);
fvPanel.add(tikkaRadioButton);
fvPanel.add(pepperoniRadioButton);
fvPanel.add(vegiRadioButton);
//The 'Veggies' Image used inside a label
JLabel veggiesLabel=new JLabel();
ImageIcon veggiesImage=new ImageIcon("C:\\Users\\Minahil\\Documents\\Project\\veggies.jpg");
veggiesLabel.setIcon(veggiesImage);
fvPanel.add(veggiesLabel);
//The options after the Veggies image
JCheckBox olivesCheckBox=new JCheckBox("Olives");
olivesCheckBox.addActionListener(this);
![Page 18: OOP PROJECT REPORT](https://reader035.fdocuments.us/reader035/viewer/2022062312/553a9ad65503467a438b45a8/html5/thumbnails/18.jpg)
olivesCheckBox.setBackground(Color.ORANGE);
JCheckBox mushroomsCheckBox=new JCheckBox("Mushroom");
mushroomsCheckBox.addActionListener(this);
mushroomsCheckBox.setBackground(Color.ORANGE);
JCheckBox capsicumCheckBox=new JCheckBox("Capsicum");
capsicumCheckBox.addActionListener(this);
capsicumCheckBox.setBackground(Color.ORANGE);
JCheckBox jalapenoesCheckBox=new JCheckBox("Jalapenoes");
jalapenoesCheckBox.addActionListener(this);
jalapenoesCheckBox.setBackground(Color.ORANGE);
fvPanel.add(olivesCheckBox);
fvPanel.add(mushroomsCheckBox);
fvPanel.add(capsicumCheckBox);
fvPanel.add(jalapenoesCheckBox);
totalTextArea.setSize(100,100);
totalTextArea.setEditable(false);
fvPanel.add(totalTextArea);
//The addition of Panels in the frame
add(saucePanel,BorderLayout.SOUTH);
add(headerPanel,BorderLayout.NORTH);
add(crustPanel,BorderLayout.CENTER);
![Page 19: OOP PROJECT REPORT](https://reader035.fdocuments.us/reader035/viewer/2022062312/553a9ad65503467a438b45a8/html5/thumbnails/19.jpg)
add(sizePanel,BorderLayout.LINE_START);
add(fvPanel,BorderLayout.EAST);
setVisible(true);
}
@Override
public void actionPerformed(ActionEvent ex)
{
//switch-case statements for the selection of size of pizza
switch (ex.getActionCommand())
{
case "Slice":
{
size="Slice of a Pizza";
sizecost=250;
break;
}
case "Half":
{
size="Half a Pizza";
sizecost=800;
break;
}
case "Full":
{
size="Full Pizza";
![Page 20: OOP PROJECT REPORT](https://reader035.fdocuments.us/reader035/viewer/2022062312/553a9ad65503467a438b45a8/html5/thumbnails/20.jpg)
sizecost=1500;
break;
}
}
//switch-case statements for the selection of crust of pizza
switch (ex.getActionCommand())
{
case "Normal":
{
crust="Normal Crust";
crustcost=0;
break;
}
case "Thinza":
{
crust="Thinza Crust";
crustcost=100;
break;
}
}
//switch-case statements for the selection of flavor
switch (ex.getActionCommand())
{
case "Cheese":
{
![Page 21: OOP PROJECT REPORT](https://reader035.fdocuments.us/reader035/viewer/2022062312/553a9ad65503467a438b45a8/html5/thumbnails/21.jpg)
flavor="Cheese";
flavorcost=100;
break;
}
case "Chicken Fajita":
{
flavor="Chicken Fajita";
flavorcost=200;
break;
}
case "Chicken Tikka":
{
flavor="Chicken Tikka";
flavorcost=150;
break;
}
case "Pepperoni":
{
flavor="Pepperoni";
flavorcost=200;
break;
}
![Page 22: OOP PROJECT REPORT](https://reader035.fdocuments.us/reader035/viewer/2022062312/553a9ad65503467a438b45a8/html5/thumbnails/22.jpg)
case "Vegitarian":
{
flavor="Vegitarian";
flavorcost=150;
break;
}
}
switch (ex.getActionCommand())
{
case "Olives":
{
toppings=toppings+1;
break;
}
case "Mushroom":
{
toppings=toppings+1;
break;
}
case "Capsicum":
{
toppings=toppings+1;
break;
}
case "Jalapenoes":
![Page 23: OOP PROJECT REPORT](https://reader035.fdocuments.us/reader035/viewer/2022062312/553a9ad65503467a438b45a8/html5/thumbnails/23.jpg)
{
toppings=toppings+1;
break;
}
}
switch (ex.getActionCommand())
{
case "Mild":
{
sauce="Mild";
break;
}
case "Hot":
{
sauce="Hot";
break;
}
case "Very Hot":
{
sauce="Very Hot";
break;
}
}
switch (ex.getActionCommand())
{
![Page 24: OOP PROJECT REPORT](https://reader035.fdocuments.us/reader035/viewer/2022062312/553a9ad65503467a438b45a8/html5/thumbnails/24.jpg)
case "Garlic Bread":
{
sidescost=sidescost+100;
sides=sides+1;
break;
}
case "Chicken Wings":
{
sidescost=sidescost+100;
sides=sides+1;
break;
}
case "Potato Wedges":
{
sidescost=sidescost+100;
sides=sides+1;
break;
}
case "Cheesy Pockets":
{
sidescost=sidescost+100;
sides=sides+1;
break;
}
}
![Page 25: OOP PROJECT REPORT](https://reader035.fdocuments.us/reader035/viewer/2022062312/553a9ad65503467a438b45a8/html5/thumbnails/25.jpg)
if(ex.getSource()==p_one)
{
drinks=drinks+1;
drinkscost=drinkscost+60;
pepsimenu.setText("Pepsi: 1");
}
else if(ex.getSource()==p_two)
{
drinks=drinks+2;
drinkscost=drinkscost+120;
pepsimenu.setText("Pepsi: 2");
}
else if(ex.getSource()==p_three)
{
drinks=drinks+3;
drinkscost=drinkscost+180;
pepsimenu.setText("Pepsi: 3");
}
else if(ex.getSource()==p_four)
{
drinks=drinks+4;
drinkscost=drinkscost+240;
pepsimenu.setText("Pepsi: 4");
![Page 26: OOP PROJECT REPORT](https://reader035.fdocuments.us/reader035/viewer/2022062312/553a9ad65503467a438b45a8/html5/thumbnails/26.jpg)
}
if(ex.getSource()==f_one)
{
drinks=drinks+1;
drinkscost=drinkscost+60;
fantamenu.setText("Fanta: 1");
}
else if(ex.getSource()==f_two)
{
drinks=drinks+2;
drinkscost=drinkscost+120;
fantamenu.setText("Fanta: 2");
}
else if(ex.getSource()==f_three)
{
drinks=drinks+3;
drinkscost=drinkscost+180;
fantamenu.setText("Fanta: 3");
}
else if(ex.getSource()==f_four)
{
drinks=drinks+4;
drinkscost=drinkscost+240;
![Page 27: OOP PROJECT REPORT](https://reader035.fdocuments.us/reader035/viewer/2022062312/553a9ad65503467a438b45a8/html5/thumbnails/27.jpg)
fantamenu.setText("Fanta: 4");
}
if(ex.getSource()==s_one)
{
drinks=drinks+1;
drinkscost=drinkscost+60;
spritemenu.setText("Sprite: 1");
}
else if(ex.getSource()==s_two)
{
drinks=drinks+2;
drinkscost=drinkscost+120;
spritemenu.setText("Sprite: 2");
}
else if(ex.getSource()==s_three)
{
drinks=drinks+3;
drinkscost=drinkscost+180;
spritemenu.setText("Sprite: 3");
}
else if(ex.getSource()==s_four)
{
drinks=drinks+4;
![Page 28: OOP PROJECT REPORT](https://reader035.fdocuments.us/reader035/viewer/2022062312/553a9ad65503467a438b45a8/html5/thumbnails/28.jpg)
drinkscost=drinkscost+240;
spritemenu.setText("Sprite: 4");
}
if(ex.getSource()==submitButton)
{
totalcost();
if(flag==true){
totalTextArea.setText("Your order is\n"+text+size+"\nWith "+crust+
"\nFlavor:"+flavor+"\nSauce:"+sauce+"\nWith "+toppings+
" Toppings"+"\nOrder Also includes "+sides+" Sides"+
"\nAnd "+drinks+" Drinks"+"\nThe Total is = "+total);
submitButton.setVisible(false);
}
else{
totalTextArea.setText("Your order is\n"+size+"\nWith "+crust+
"\nFlavor:"+flavor+"\nSauce:"+sauce+"\nWith "+toppings+
" Toppings"+"\nOrder Also includes "+sides+" Sides"+
"\nAnd "+drinks+" Drinks"+"\nThe Total is = "+total);
submitButton.setVisible(false);
}
}
else if(ex.getSource()==addButton){
![Page 29: OOP PROJECT REPORT](https://reader035.fdocuments.us/reader035/viewer/2022062312/553a9ad65503467a438b45a8/html5/thumbnails/29.jpg)
totalcost();
JOptionPane.showMessageDialog(this,"Press Ok to add another pizza to your order","Add Another", JOptionPane.PLAIN_MESSAGE);
text = size+"\nWith "+crust+
"\nFlavor:"+flavor+"\nSauce:"+sauce+" and\n";
flag=true;
}
else if(ex.getSource()==resetButton){
total=0;
sizecost=0;
crustcost=0;
flavorcost=0;
veggiescost=0;
drinkscost=0;
sidescost=0;
toppings=0;
drinks=0;
sides=0;
crust="";
flavor="";
size="";
sauce="";
veggies="";
JOptionPane.showMessageDialog(this, "Your order has been Reset","Reset", JOptionPane.PLAIN_MESSAGE);
submitButton.setVisible(true);
![Page 30: OOP PROJECT REPORT](https://reader035.fdocuments.us/reader035/viewer/2022062312/553a9ad65503467a438b45a8/html5/thumbnails/30.jpg)
}
}
public void totalcost()
{
if(toppings<=2 && toppings>0)
veggiescost=50;
else if(toppings==3)
veggiescost=150;
else if(toppings==4)
veggiescost=250;
total=total+crustcost+sizecost+flavorcost+veggiescost+drinkscost+sidescost;
} }
![Page 31: OOP PROJECT REPORT](https://reader035.fdocuments.us/reader035/viewer/2022062312/553a9ad65503467a438b45a8/html5/thumbnails/31.jpg)
MAIN INTERFACE
![Page 32: OOP PROJECT REPORT](https://reader035.fdocuments.us/reader035/viewer/2022062312/553a9ad65503467a438b45a8/html5/thumbnails/32.jpg)
CLASS DIAGRAM
ORDEROrder()public void actionPerformed(ActionEvent ex)public void totalcost()
int total=0, sizecost=0, crustcost=0, flavorcost=0, veggiescost=0, drinkscost=0, sidescost=0, toppings=0, drinks=0, sides=0, count=0;
boolean flag=false;
String crust,flavor,size,sauce,veggies,text;