Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

JOption program


Take a look at this program that i made in elipse i just started programing and im 15 tell me how to make this better?








import javax.swing.JOptionPane;
import javax.swing.Spring;

public class burger
{
public static void main(String args[])
{

//Burgers, condimentss, and sides
String burgertype, mustard, ketchup, tomato, lettuce, pickle, onions, fries, onionrings, ket="", must="",toma="", let="", oni="", onio="", fri="", burger1="", burger2="", burger3="", burger4="", burger5="";
//Burgers, condiments, and sides
int burgerstr, mustardstr, ketchupstr, tomatostr, lettucestr, picklestr, onionsstr, friesstr, onionringsstr;
//drinks
String drink;
//drinks
int drinkstr;
//answers
String answer, answer1, answer2;
int answerstr, answer1str, answer2str;
//brands
String ketchup2;
int ketchup2str;






//input
JOptionPane.showMessageDialog(null,"Welcome to Romans Burger Store");
burgertype = JOptionPane.showInputDialog(null,"Please enter the number of the type of burger that you would like."+"
"+
"1 Flame Fried. " +"
"+
"2 Cheese. " +"
"+
"3 Double Cheese. " +"
"+
"4 Triple Cheese. " +"
"+
"5 Bacon Cheese");
burgerstr= Integer.parseInt(burgertype);
JOptionPane.showMessageDialog(null,"For the following questions for topings and " +"
"+
"sides of your meal please enter " +"
"+
"1 for yes" +"
"+
"2 for no");
ketchup = JOptionPane.showInputDialog(null,"Would you like ketchup?");
ketchupstr= Integer.parseInt(ketchup);
mustard = JOptionPane.showInputDialog(null,"Would you like Mustard?");
mustardstr= Integer.parseInt(mustard);
tomato = JOptionPane.showInputDialog(null,"Would you like Tomatoes?");
tomatostr= Integer.parseInt(tomato);
lettuce = JOptionPane.showInputDialog(null,"Would you like lettuce?");
lettucestr= Integer.parseInt(lettuce);
onions = JOptionPane.showInputDialog(null,"Would you like onions?");
onionsstr= Integer.parseInt(onions);
onionrings = JOptionPane.showInputDialog(null,"Would you like onion rings as a side");
onionringsstr= Integer.parseInt(onionrings);
fries = JOptionPane.showInputDialog(null,"Would you also like fries as a side? ");
friesstr= Integer.parseInt(fries);

//output
if (burgerstr == 1)
{
burger1 = " Flame fried burger ";
JOptionPane.showMessageDialog(null,"You ordered a Flame fried burger");
}
else if (burgerstr == 2)
{
burger1 = " Cheese burger ";
JOptionPane.showMessageDialog(null,"You ordered a Cheese burger");
}
else if (burgerstr == 3)
{
burger1 = " Double cheese burger ";
JOptionPane.showMessageDialog(null,"You ordered a Double cheese burger");
}
else if (burgerstr ==4)
{
burger1 = " Triple cheese burger ";
JOptionPane.showMessageDialog(null,"You ordered a Triple cheese burger");
}
else if (burgerstr ==5)
{
burger1 = " Bacon cheese burger ";
JOptionPane.showMessageDialog(null,"You ordered a Bacon cheese burger");
}
if (ketchupstr == 1)
{
ket = " ketchup ";
}
if (mustardstr == 1)
{
must = " mustard ";
}
if (tomatostr == 1)
{
toma = " tomatoes ";
}
if (lettucestr == 1)
{
let = " lettuce ";
}
if (onionsstr == 1)
{
oni = " and onions ";
}
if (onionringsstr == 1)
{
onio = " onion rings ";
}
if (friesstr == 1)
{
fri = " and fries ";
}
//input
JOptionPane.showMessageDialog(null," On your "+ burger1 + burger2 + burger3 + burger4 + burger5 +"You have selected "+"
"+ket+ "
"+ must+ "
"+ toma+"
"+ let+"
"+ oni+"
");
JOptionPane.showMessageDialog(null,"The sides that you selected to go with your"+ burger1 + burger2 + burger3 + burger4 + burger5+ "is" +"
"+onio+"
"+fri+"
" );
answer2 = JOptionPane.showInputDialog(null, "Is this what you ordered " +"
"+
"1 for yes " +"
"+
"2 for no. " +"
"+
"CAUTION IF YOU PRESS NO THE PROGRAM WILL RESTART");
answer2str= Integer.parseInt(answer2);
if(answer2str == 1)
{
JOptionPane.showMessageDialog(null,"Good press ok to continue");
}
else if(answer2str == 2)
{
//input
JOptionPane.showMessageDialog(null,"Welcome to Romans Burger Store");
burgertype = JOptionPane.showInputDialog(null,"Please enter the number of the type of burger that you would like."+"
"+
"1 Flame Fried. " +"
"+
"2 Cheese. " +"
"+
"3 Double Cheese. " +"
"+
"4 Triple Cheese. " +"
"+
"5 Bacon Cheese");
burgerstr= Integer.parseInt(burgertype);
JOptionPane.showMessageDialog(null,"For the following questions for topings and " +"
"+
"sides of your meal please enter " +"
"+
"1 for yes" +"
"+
"2 for no");
ketchup = JOptionPane.showInputDialog(null,"Would you like ketchup?");
ketchupstr= Integer.parseInt(ketchup);
mustard = JOptionPane.showInputDialog(null,"Would you like Mustard?");
mustardstr= Integer.parseInt(mustard);
tomato = JOptionPane.showInputDialog(null,"Would you like Tomatoes?");
tomatostr= Integer.parseInt(tomato);
lettuce = JOptionPane.showInputDialog(null,"Would you like lettuce?");
lettucestr= Integer.parseInt(lettuce);
onions = JOptionPane.showInputDialog(null,"Would you like onions?");
onionsstr= Integer.parseInt(onions);
onionrings = JOptionPane.showInputDialog(null,"Would you like onion rings as a side");
onionringsstr= Integer.parseInt(onionrings);
fries = JOptionPane.showInputDialog(null,"Would you also like fries as a side? ");
friesstr= Integer.parseInt(fries);
}




drink = JOptionPane.showInputDialog(null,"Please enter the number of the drink that you desire" +"
"+
"#1 Caffeine Free Pepsi" +"
"+
"#2 Diet Pepsi" +"
"+
"#3 Caffeine Free Diet Pepsi" +"
"+
"#4 Diet Pepsi Max" +"
"+
"#5 Jazz Diet Pepsi" +"
"+
"#6 Diet Pepsi Lime" +"
"+
"#7 Diet Pepsi Vanilla" +"
"+
"#8 Pepsi Wild Cherry" +"
"+
"#9 Diet Pepsi Wild Cherry" +"
"+
"#10 Pepsi ONE" +"
"+
"#11 Mountain Dew" +"
"+
"#12 Diet Mountain Dew" +"
"+
"#13 Caffeine Free Mountain Dew" +"
"+
"#14 Mountain Dew Code Red" +"
"+
"#15 Diet Mountain Dew Code Red");
drinkstr= Integer.parseInt(drink);
//output
if (drinkstr == 1)
{
JOptionPane.showMessageDialog(null, "You selected Caffeine Free Pepsi");
}
else if (drinkstr == 2)
{
JOptionPane.showMessageDialog(null, "You selected Diet Pepsi");
}
else if (drinkstr == 3)
{
JOptionPane.showMessageDialog(null, "You selected caffeine Free Diet Pepsi");
}
else if (drinkstr == 4)
{
JOptionPane.showMessageDialog(null, "You selected Diet Pepsi Max");
}
else if (drinkstr == 5)
{
JOptionPane.showMessageDialog(null, "You selected Jazz Diet Pepsi");
}
else if (drinkstr == 6)
{
JOptionPane.showMessageDialog(null, "You selected Diet Pepsi Lime");
}
else if (drinkstr == 7)
{
JOptionPane.showMessageDialog(null, "You selected Diet Pepsi Vanilla");
}
else if (drinkstr == 8)
{
JOptionPane.showMessageDialog(null, "You selected Pepsi Wild Cherry");
}
else if (drinkstr == 9)
{
JOptionPane.showMessageDialog(null, "You selected Diet Pepsi Wild Cherry");
}
else if (drinkstr == 10)
{
JOptionPane.showMessageDialog(null, "You selected Pepsi ONE");
}
else if (drinkstr == 11)
{
JOptionPane.showMessageDialog(null, "You selected Mountain Dew");
}
else if (drinkstr == 12)
{
JOptionPane.showMessageDialog(null, "You selected Diet Mountain Dew");
}
else if (drinkstr == 13)
{
JOptionPane.showMessageDialog(null, "You selected Caffeine Free Mountain Dew");
}
else if (drinkstr == 14)
{
JOptionPane.showMessageDialog(null, "You selected Mountain Dew Code Red");
}
else if (drinkstr == 15)
{
JOptionPane.showMessageDialog(null, "You selected Diet Mountain Dew Code Red");
}
//input
JOptionPane.showMessageDialog(null, "So one more time did you order the following?");
JOptionPane.showMessageDialog(null, "Did You ordered a" +burger1 + burger2 + burger3 + burger4 + burger5+ "With" +"
"+ket+ "
"+ must+ "
"+ toma+"
"+ let+"
"+ oni+"
"+"on it?");
answer = JOptionPane.showInputDialog(null, "1 for Yes " +"
"+
"2 for No?");
answerstr= Integer.parseInt(answer);
//output
if (answerstr == 1)
{
JOptionPane.showMessageDialog(null, "Great just a few more things");
}
else if (answerstr== 2)
{
JOptionPane.showMessageDialog(null, "Thats not good! try restarting that program");
}

answer1 = JOptionPane.showInputDialog(null, "Ok did you order"+"
"+onio+"
"+fri+"as your sides");
answer1str= Integer.parseInt(answer1);
if (answer1str == 1)
{
JOptionPane.showMessageDialog(null, "Great one more thing...........");
}
else if (answer1str == 2)
{
JOptionPane.showMessageDialog(null, "Thats not good! try restarting that program");
}



JOptionPane.showMessageDialog(null, "Did you order a.......");
if (drinkstr == 1)
{
JOptionPane.showMessageDialog(null, "Caffeine Free Pepsi");
}
else if (drinkstr == 2)
{
JOptionPane.showMessageDialog(null, "Diet Pepsi");
}
else if (drinkstr == 3)
{
JOptionPane.showMessageDialog(null, "Caffeine Free Diet Pepsi");
}
else if (drinkstr == 4)
{
JOptionPane.showMessageDialog(null, "Diet Pepsi Max");
}
else if (drinkstr == 5)
{
JOptionPane.showMessageDialog(null, "Jazz Diet Pepsi");
}
else if (drinkstr == 6)
{
JOptionPane.showMessageDialog(null, "Diet Pepsi Lime");
}
else if (drinkstr == 7)
{
JOptionPane.showMessageDialog(null, "Diet Pepsi Vanilla");
}
else if (drinkstr == 8)
{
JOptionPane.showMessageDialog(null, "Pepsi Wild Cherry");
}
else if (drinkstr == 9)
{
JOptionPane.showMessageDialog(null, "Diet Pepsi Wild Cherry");
}
else if (drinkstr == 10)
{
JOptionPane.showMessageDialog(null, "Pepsi ONE");
}
else if (drinkstr == 11)
{
JOptionPane.showMessageDialog(null, "Mountain Dew");
}
else if (drinkstr == 12)
{
JOptionPane.showMessageDialog(null, "Diet Mountain Dew");
}
else if (drinkstr == 13)
{
JOptionPane.showMessageDialog(null, "Caffeine Free Mountain Dew");
}
else if (drinkstr == 14)
{
JOptionPane.showMessageDialog(null, "Mountain Dew Code Red");
}
else if (drinkstr == 15)
{
JOptionPane.showMessageDialog(null, "Diet Mountain Dew Code Red");
}
answer = JOptionPane.showInputDialog(null, "1 for Yes " +"
"+
"2 for No?");
if (answerstr == 1)
{
JOptionPane.showMessageDialog(null, "Your order is complete thank you for ordering at Romans burger store!!!! Made by Roman Bucheral");
}
else if (answerstr == 2)
{
JOptionPane.showMessageDialog(null, "Thats not good! try restarting that program");
}













}
}

Sign In or Register to comment.