Results 1 to 5 of 5
  1. #1
    ryzii is offline Member
    Join Date
    Mar 2009
    Posts
    4
    Rep Power
    0

    Default can someone help me code this?

    prompt the user to the number of products purchased
    prompt the user to enter the name of each product and its price
    calculate the total cost of the products
    if the total cost of the products is between 10 and 25 the user gets a 5% discount, if the total cost is between 25 and 40 pounds they get a 7.5% and if the purchases cost more than 40 they get a 10% discount
    prompt the user to enter amount tendered
    calculate the change
    write the names and prices of products, discount, amount tendered and change owed to customer to a file
    read the details written to the file onto the screen


    these are my specifications

    i'm pretty new to java and completely stuck...

  2. #2
    ryzii is offline Member
    Join Date
    Mar 2009
    Posts
    4
    Rep Power
    0

    Default

    1. start LOOP

    2. GET number of products purchased

    3. GET information about product
    3.1 GET name of product
    3.2 GET price of product

    3.3. end LOOP

    4. IF total cost of product is between 10-25 THEN 5% discount
    4.1 IF total cost of product is between 25-40 THEN 7.5% discount
    4.2 IF total cost of product is 40> THEN 10% discount

    5. GET amount tendered
    6. Calculate change
    7. INPUT: price of products, discount, amount tendered and change owed.
    8. OUTPUT: price of products, discount, amount tendered and change owed.
    9. end

  3. #3
    tomiu is offline Member
    Join Date
    Dec 2008
    Posts
    32
    Rep Power
    0

    Default

    u must give a try...then if u have problems post ur code and errors u get...

  4. #4
    corlettk is offline Member
    Join Date
    Apr 2009
    Location
    Brisbane
    Posts
    86
    Rep Power
    0

    Default

    package ryzii;

    Java Code:
    class Purchases
    {
      public static void main(String[] args) {
        try {
          Purchases purchases = new Purchases();
          .... your main method code goes here ....
          .... it says what needs to happen not how ....
        } catch (Exception e) {
          e.printStackTrace();
        }
      }
    
      .... some cool helper methods go here ....
      .... each method defines how a specifc task is performed ....
      .... for instance ....
    
        // prompt the user to enter the number of products purchased
      private static int readNumProducts() {
        String prompt = "please enter the number of products purchased : ";
        return Integer.parseInt(console.readLine(prompt));
      }
    
    }
    HTH. Keith.
    Last edited by corlettk; 04-23-2009 at 04:51 PM. Reason: frog got the code tags!

  5. #5
    conv_bay is offline Member
    Join Date
    Apr 2009
    Posts
    15
    Rep Power
    0

    Default

    ye..
    dat rite..

    u net to try 1st..

    n if u get mistake,
    plz send ur coding n tell ur mistake..

Similar Threads

  1. Why doesn't this code accept my code?
    By PeterFeng in forum New To Java
    Replies: 5
    Last Post: 02-03-2009, 01:39 PM
  2. I need help fixing my code.. or non code?
    By MrHuggykins in forum New To Java
    Replies: 1
    Last Post: 03-19-2008, 10:12 PM
  3. Replies: 1
    Last Post: 04-26-2007, 03:52 PM

Posting Permissions

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