CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2013
    Posts
    1

    help needed for intro while loops

    I need help coding this project using while loops and cout/cin.. It is suppose to be one while loop for the whole thing and inside of the first while loop is the second while loop for each sale separately. I cannot figure out how to start that?

    ** completely new at programming and this is a project that is due soon for class


    You have been asked to write a program to calculate sales totals for a general store. Your program will not know how many products each customer will buy, so your program will have to repeat the process until the last product has been entered (use -1 for Product ID to end each sale). After each sale your program must ask if you want to do another sale (Y –continue, N – end program).
    At the beginning of the day, the cash drawer has $500 in it. At the end of the program you must display how much money is in the drawer after handling all your sales transactions.
    Input
    Your program must take the following input:
    • Product ID Number (int)
    • Quantity for each item purchased (int)
    • Cash Received at the end of the sale
    Use the following dataset to determine the price and taxability for each item.
    First Sale:
    Product ID Price Quantity Taxable
    101 $65.00 2 Yes
    102 $12.50 1 No
    103 $24.50 5 No
    104 $38.75 4 Yes
    105 $17.80 6 Yes
    106 $16.50 2 No
    107 $42.85 8 Yes
    108 $32.99 2 Yes
    109 $28.75 1 Yes
    110 $51.55 1 No

    Second Sale:
    Product ID Price Quantity Taxable
    102 $12.50 1 No
    103 $24.50 1 No
    106 $16.50 1 No
    107 $42.85 1 Yes
    108 $32.99 1 Yes
    109 $28.75 1 Yes

    Third Sale:
    Product ID Price Quantity Taxable
    106 $16.50 4 No
    107 $42.85 3 Yes
    108 $32.99 1 Yes
    109 $28.75 5 Yes
    110 $51.55 2 No

    Calculating Tax
    For those items that are taxable, assume a 7.5% sales tax. Be sure to keep a running total of tax for the each sale.

    Getting Started
    You must use the starter file provided with this assignment.
    What to turn in:
    • A copy of your source code
    • A printout of your program’s output

  2. #2
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,635

    Re: help needed for intro while loops

    What does the starter file look like?

  3. #3
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,822

    Re: help needed for intro while loops

    As this is for homework for a course, we won't write the code for you. Have a read of http://www.codeguru.com/forum/showthread.php?t=366302

    We'll try to assist if you have a specific question regarding code you have already produced - or point you in the right direction as to how something might be done. But just giving a program spec and asking for help to code it is a non-starter. Many members of this forum would call that cheating. You are being tested on what you know, not what I know.

    Have you produced a program design from the spec? If you haven't I suggest you do before you even write one line of code.

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured