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.


>> REGISTER NOW TO START POSTING


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

Results 1 to 2 of 2

Thread: Selection with a for loop

  1. #1
    Junior Member sowmyad96's Avatar
    Join Date
    Nov 2012
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Post Selection with a for loop

    Write a well structured program with programmer comments and user prompts that:

    1. Allows the user to enter the number of times they wish to repeat the program

    2. Allows the user to enter a integer drink size represented by the following option and cost:
    (1)Small $1.50
    (2)Medium $2.00
    (3)Large $3.00
    (4)Xtra Large $4.00
    3. Allows the user to enter the number of the above drinks that he/she wishes to purchase.

    4. Calculates and outputs the HST 13% and the total cost of the drink order.
    Example

    Enter the number of times to repeat the program 2
    Enter drink size 2
    Enter the number of drinks 4

    Cost $ 8.00 HST $ 1.04 Total $ 9.04

    Enter drink size 1
    Enter the number of drinks 1

    Cost $ 1.50 HST $ 0.20 Total $ 1.70

    HINT! use field format to round to 2 decimal places


  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,180
    My Mood
    Hungover
    Thanks
    141
    Thanked 601 Times in 516 Posts

    Default Re: Selection with a for loop

    Did you have a question, or do you just want to trade homework assignments?

    Please see the link in my signature on asking questions the smart way, then try again.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

Similar Threads

  1. [SOLVED] Selection sort not working
    By killer3p0 in forum What's Wrong With My Code?
    Replies: 5
    Last Post: May 7th, 2012, 12:24 PM
  2. [SOLVED] User selection problem
    By zipstacrack in forum What's Wrong With My Code?
    Replies: 9
    Last Post: May 4th, 2012, 11:11 PM
  3. JTable selection issue
    By kpat in forum AWT / Java Swing
    Replies: 2
    Last Post: April 1st, 2012, 01:38 PM
  4. Rendering VS Selection in JTrees
    By Cyclops in forum AWT / Java Swing
    Replies: 1
    Last Post: September 28th, 2011, 09:42 AM
  5. Selection Sorting
    By chronoz13 in forum Algorithms & Recursion
    Replies: 5
    Last Post: December 10th, 2009, 10:08 AM