Results 1 to 4 of 4
  1. #1
    4uAngelique is offline Member
    Join Date
    Apr 2012
    Posts
    13
    Rep Power
    0

    Default To write a program using methods to display the total price and unit price

    To write a program using methods to display the total price and unit price-doc-1-6.18.34-pm.jpgTo write a program using methods to display the total price and unit price-doc-2-6.18.34-pm.jpgTo write a program using methods to display the total price and unit price-doc-3-6.18.34-pm.jpg

  2. #2
    4uAngelique is offline Member
    Join Date
    Apr 2012
    Posts
    13
    Rep Power
    0

    Default Re: To write a program using methods to display the total price and unit price

    This what i have i will be working more on it. but i need help since i know my structure is not good and i have error in assigning variables and parameter

    import java.util.Scanner;

    public class P2
    {
    public static void main( Strings args[])
    {
    menu();
    unitPrice();
    }

    double A = 1.01;
    double B = 2.01;
    double C = 3.01;
    double D = 4.01;

    double num;
    char choice;
    int quantity;
    int letter;
    int symbol;
    }

    public static void unitPrice()
    {
    /**
    * Price/ounce: Small:$ 0.11 Tall:$ 0.13 Mug:$ 0.13 Jug:$ 0.13
    **/
    }

    public static void menu()
    {
    /**
    * RUNNING on JAVA
    * SIZE PRICE
    * A) Small ( 9 oz) $1.01
    * B) Tall (16 oz) $2.01
    * C) Mug (24 oz) $3.01
    * D) Jug (32 oz) $4.01
    **/

    Scanner scan = new Scanner(System.in);
    String inputStr = null;

    System.out.print( "Enter Type of drink (A B C or D): ");
    num = scan.nextDouble();

    while (num > 11)
    {
    System.out.print("ERROR! Quantity only 1-11!");
    }
    while (num < 1)
    {
    System.out.print("ERROR! Quantity only 1-11!");
    }

    System.out.print("Enter Quantity (1-11): ");
    quantity = scan.nextInt();
    Total = quantity * A;
    }

  3. #3
    4uAngelique is offline Member
    Join Date
    Apr 2012
    Posts
    13
    Rep Power
    0

    Default Re: To write a program using methods to display the total price and unit price

    It's just intro to java so we are using method, if else or switch statement, while loop to write the program

  4. #4
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default Re: To write a program using methods to display the total price and unit price

    What error do you have? Can you clarify exactly where your stuck? All I see is a large assignment and a bit of unformatted code. It would help if you explain your problem in your own words, and if you could post formatted code using [code] [/code] tags, as discussed in the forum FAQ.

Similar Threads

  1. need last help - price list not shown up
    By Cyberoxy in forum Advanced Java
    Replies: 5
    Last Post: 06-29-2011, 02:08 PM
  2. Update a price in a database
    By sandraW in forum New To Java
    Replies: 14
    Last Post: 08-29-2010, 04:41 AM
  3. I need Sun Voucher for discount price.
    By salma in forum Java Certification
    Replies: 2
    Last Post: 01-09-2010, 01:48 AM
  4. Replies: 1
    Last Post: 12-23-2009, 12:24 AM
  5. Displaying a price with a checkbox
    By F4iChick02 in forum New To Java
    Replies: 4
    Last Post: 12-09-2008, 05:13 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •