1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

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,012
    Likes Received:
    203
    Trophy Points:
    0
    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