Can anyone help me wit this?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • shadachi
    New Member
    • May 2007
    • 15

    Can anyone help me wit this?

    Question 1

    The mail-order company requires a program to calculate discounts that it is giving to all its customers during a sales campaign. Write a program that asks the user to enter the total price of an order. If the order price is RM200.00 or less, the discount rate is 10%. If the order price is greater than RM200.00, the discount rate is 15%.The net price of the order is the price minus the discount. The program should display the price of the order, the discount amount, and the net price of the order. Design the program to process any number of orders. When there are no more orders to process, the program should display the number of orders it processed, the total of the prices, the total of the discounts, and the total of the net prices.


    Sample output
    Enter the total price of an order: RM150.50

    Order price: RM150.50
    Discount amount: RM15.05
    Net order price: RM135.45

    Do you have any other orders to proceed? (y/n) : y

    Enter the total price of an order: RM420.30

    Order price: RM420.30
    Discount amount: RM63.05
    Net order price: RM357.25

    Do you have any other orders to proceed? (y/n) : y

    Enter the total price of an order: RM200.00

    Order price: RM200.00
    Discount amount: RM20.00
    Net order price: RM180.00

    Do you have any other orders to proceed? (y/n) : n

    Total number of orders: 3
    Total order prices: RM770.80
    Total discounts: RM98.10
    Total net prices: RM672.70

    Can anyone help me ..i juz don get it?
  • JosAH
    Recognized Expert MVP
    • Mar 2007
    • 11453

    #2
    Originally posted by shadachi
    Can anyone help me ..i juz don get it?
    What is it that you 'juz don't get'? The structure of your program should be
    something like this:
    Code:
    while more orders to process
       process order and do some bookkeeping
    
    print out statistics
    kind regards,

    Jos

    Comment

    • shadachi
      New Member
      • May 2007
      • 15

      #3
      can ya post a sample of anything..

      coz i am new to java... ><

      thx in advanced

      Comment

      • prometheuzz
        Recognized Expert New Member
        • Apr 2007
        • 197

        #4
        Originally posted by shadachi
        can ya post a sample of anything..

        coz i am new to java... ><

        thx in advanced
        Try to whip up some code yourself: otherwise you will remain "new to java".
        Here's some sample code for a while-statement:

        Comment

        Working...