Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: can someone help me make this work!

  1. #1
    Junior Member
    Join Date
    Jul 2014
    Thanked 0 Times in 0 Posts

    Default can someone help me make this work!

    public class Internal{
    public static void main(String[]args)
    double total2 = 0;
    String customerName = " ";
    String address = " ";
    String phoneNum ="0";
    int max = 5;
    int done = 1;
    double totalPizza = 0;
    double totalA = 0;
    int pizzaChoice1 =0;
    int pizzaChoice2 =0;
    int pizzaChoice3 =0;
    String [] pizzaType = {"Placeholder", "Hawaian" , "Classic Italian" , "Cheese Extreme" , "Veg Delight" , "Pepperoni" , "Tomato Margherita" , "Beef & Onion" , "Super Supreme" , "Meat Lovers" , "Hot 'n Spicy" , "Italiano" , "Italian Veg"};
    double [] pizzaPrice = {0, 8.5 , 8.5 , 8.5 , 8.5 , 8.5 , 8.5 , 8.5 , 13.5 , 13.5 , 13.5 , 13.5 , 13.5};
    int [] orderDisplay = {0,0,0,0,0,0,0,0,0,0,0,0,0};
    boolean pickup = true;
    int pickup1 = readInt("If you wish to pickup press 1 or press 0 for delivery");
    if (pickup1 == 0)
    pickup = false;
    while (done != 0)
    for (int i = 1; i <pizzaType.length; i++)
    System.out.println(i + " " +pizzaType[i] + " $" + pizzaPrice[i]);
    pizzaChoice1 = readInt ("Choose the type of pizza you wish to order");
    int pizzaQuantity = readInt ("How many " + pizzaType[pizzaChoice1] + " pizzas do you wish to buy (Maximum is 5)");
    totalPizza = totalPizza + pizzaQuantity; 
    if(totalPizza > max)
    pizzaChoice2 = readInt ("Choose the type of pizza you wish to order");
    int pizzaQuantity = readInt ("How many " + pizzaType[pizzaChoice2] + " pizzas do you wish to buy (Maximum is 5)");
    totalPizza = totalPizza + pizzaQuantity; 
    if(totalPizza > max)
    pizzaChoice3 = readInt ("Choose the type of pizza you wish to order");
    int pizzaQuantity = readInt ("How many " + pizzaType[pizzaChoice3] + " pizzas do you wish to buy (Maximum is 5)");
    totalPizza = totalPizza + pizzaQuantity; 
    if(totalPizza > max)
    totalPizza = totalPizza - pizzaQuantity;
    System.out.println("You cannot order more than five pizzas");
    pizzaChoice1 = 0; 
    pizzaChoice2 = 0;
    pizzaChoice3 = 0;
    pizzaQuantity = 0;
    orderDisplay[pizzaChoice1] = pizzaQuantity;
    orderDisplay[pizzaChoice2] = pizzaQuantity;
    orderDisplay[pizzaChoice3] = pizzaQuantity;
    done= readInt ("Press 0 if you are done or press 1 to make another pizza order");
    double total1 = pizzaQuantity*pizzaPrice[pizzaChoice1];
    total2 = total2 + total1;
    if(totalPizza > 0)
    if(pickup == false)
    int deliveryCost = 3;
    customerName = readString ("Please enter your full name");
    address = readString ("Please enter the Delivery address");
    phoneNum = readString ("Please enter the phone number of " + customerName);
    totalA = total2 + deliveryCost;
    System.out.println("Delivery order for " + customerName);
    System.out.println("To " + address + ", Phone number 0" + phoneNum);
    customerName = readString ("Please enter your full name");
    System.out.println("Pickup order for " + customerName);
    int deliveryCost = 3;
    totalA = total2 + deliveryCost;
    for(int i=1;i<orderDisplay.length;i++)
    System.out.println(" " + orderDisplay[i] + " " + pizzaType[i] + " pizzas");
    System.out.println("The total amount of your order is " + formatMoney(totalA));
    System.out.println("You have not ordered anything.");
    public static int readInt(String prompt)
    java.util.Scanner keyboard = new java.util.Scanner(System.in); 
    return keyboard.nextInt();
    public static String readString (String prompt)
    System.out.println (prompt);
    java.util.Scanner keyboard= new java.util.Scanner(System.in);
    return keyboard.nextLine();
    public static String formatMoney(double phoneNum)
    java.text.NumberFormat fmt = java.text.NumberFormat. getCurrencyInstance();

    --- Update ---

    Can someone please rewrite this it for a practice test here is the instruction I am willing to pay for the help!!

    Dream Pizzas want to computerise their phone orders. Specifically, they want to be able to enter customer details, pizza(s) ordered and pick-up or delivery requirements into a computer and have it display the delivery details, itemised order, and total cost. Phone orders generally consist of several kinds of pizza.
    You must construct a plan to allow your programme to meet the following specifications:
    • The programme contains options for the phone operator to specify whether the pizza order is for pickup or delivery.
    • If the order is for delivery:
    o the programme should collect the customer’s name, address and phone number
    o a $3 delivery charge should be added to the total cost.
    • If the order is for pick up:
    o The phone operator should be asked to enter the customer’s name into the programme.
    • The programme should allow the phone operator to input how many pizzas the customer would like (maximum 5).
    • A numbered menu of at least 12 pizza names should be presented to the phone operator. This menu should be stored in an indexed data structure (e.g. an array or list) and may be hard-coded within the programme so that pizza names don’t need to be typed in every time the programme is run.
    • Each pizza to be ordered should be selected from the choices available on the menu and the order information should be stored.
    • The cost of the first seven (regular) pizzas on the menu is $8.50 and the rest are $5 more as they are gourmet pizzas.
    • When the order is finished:
    o the names of ordered pizzas and their individual price should be displayed
    o the total cost of the order including any delivery charge should be displayed
    o customer name should be displayed
    o if the pizza is for delivery the address and phone number should be displayed.
    • The programme should allow the operator to cancel the order.
    • After the order information has been displayed the programme should be ready to accept another order or exit.
    Note: There does not need to be any facility for editing the ordered list of pizzas. If the order is not right, the operator would just cancel it and start again from the beginning.
    Your plan:
    • should communicate the structure and function of a computer programme
    • should be developed in the context of a target programming language
    • may be communicated using a range of tools
    • should not be expressed in programme code.
    Your teacher will specify the manner in which you plan the programme. This could be natural language (as long as it is unambiguous and precise), diagrams (including screen layouts), and pseudocode.
    Ensure that your plan specifies:
    • variables, scopes and their data types
    • indexed data structure
    • a modular structure including procedural details of the modules
    • expected and boundary input test cases.
    Your finished plan must include at least one indexed data structure and be decomposed into user-defined modules with scoped variables, constants and derived values effectively so as to maximise the flexibility and robustness of the plan. Your chosen scope should match the way the variable is used.
    Annotate your plan and use explanatory variable/module names so that the purpose of each part of the plan is clear. This includes documenting the plan with annotations on the function of the modules.
    Include in your plan a testing schedule with input cases that ensures that your programme will work correctly on all inputs – expected, boundary, and exceptional.
    To achieve with Merit you will need to demonstrate independence when constructing your plan
    To demonstrate an efficient plan, modules will have clear and well-defined purposes. Interaction between modules will be minimised and there will be no duplication. The procedure structure of each module will be efficient.
    Hand in your final plan.

    IF you are able to help I would really appreciate it I am stuck with other things at the moment thank you all

  2. #2
    Grand Poobah
    Join Date
    Mar 2011
    My Mood
    Thanked 167 Times in 158 Posts

    Default Re: can someone help me make this work!


    Writing the code is your job. If we did it for you that would be plagiarism or academic dishonesty. OTOH if you ask a specific question you will get a specific answer.
    Improving the world one idiot at a time!

Similar Threads

  1. Replies: 3
    Last Post: January 26th, 2014, 11:51 PM
  2. how to work wsimport for this WSDL i get errors and i cant make it work
    By pato.llaguno in forum What's Wrong With My Code?
    Replies: 6
    Last Post: January 24th, 2014, 05:27 PM
  3. Help i dont know how to make it work!
    By Freshtilldeath0 in forum What's Wrong With My Code?
    Replies: 2
    Last Post: October 29th, 2012, 07:40 PM
  4. what's going on? I tried to make a scrollable JFrame and it didn't work!
    By javapenguin in forum What's Wrong With My Code?
    Replies: 4
    Last Post: August 20th, 2011, 09:47 PM
  5. How to make for loop work?
    By Dragonkndr712 in forum What's Wrong With My Code?
    Replies: 9
    Last Post: March 8th, 2011, 02:14 PM