C++: Derived Data Types - Sales (Challenge)

Discussion in 'C++' started by seit, Mar 3, 2011.

  1. seit

    seit New Member

    Joined:
    Mar 3, 2011
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Design and code a program that totals a set of sales records, each of which consists of a quantity, a unit price and a taxable status. Your program prompts for and accepts a quantity, a unit price and a taxable status and continues to accept such triples until the user enters 0 for quantity. Your program can store up to 100 triples. It displays the pre-tax total, the gst, the pst and the sales total for all of the information entered.
    The output from your program looks something like

    [FONT=&quot] Sale Totaller[/FONT]
    [FONT=&quot] =============[/FONT]
    [FONT=&quot] Quantity : 2[/FONT]
    [FONT=&quot] Unit Price: 1.99[/FONT]
    [FONT=&quot] Taxable: y[/FONT]
    [FONT=&quot] Quantity : 1[/FONT]
    [FONT=&quot] Unit Price: 2.99[/FONT]
    [FONT=&quot] Taxable: n[/FONT]
    [FONT=&quot] Quantity : 5[/FONT]
    [FONT=&quot] Unit Price: 1.00[/FONT]
    [FONT=&quot] Taxable: n[/FONT]
    [FONT=&quot] Quantity: 0[/FONT]

    [FONT=&quot] Subtotal 11.97[/FONT]
    [FONT=&quot] GST (7%) 0.28[/FONT]
    [FONT=&quot] PST (8%) 0.32[/FONT]
    [FONT=&quot] Total 12.57[/FONT]

    Your program includes a function named total that receives the sale information in an array of instances of Sales types and returns the total information in an instance of a Total type. A Sales type holds the quantity, the unit price and the taxable status for a single item. A Total type holds the total price, the total gst and the total pst. Place your function prototype and your declarations of the two derived types in a file named Sales.h

    Please help me.
     
  2. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,009
    Likes Received:
    203
    Trophy Points:
    63
    Occupation:
    Senior Support Engineer
    Location:
    England
    What's the prize, as this is marked Challenge?
    Or is this your homework, in which case where are you stuck?
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice