help


Input: - the number of office supply items requested by our department for the Fall semester 2016
- the price for all those items (tax not included)
Output:
- the prices of all items requested, after applying the sales tax (6%)
- the average price after tax
Hint: You should use two arrays of real numbers in order to store the prices of all items before and after tax
Example of Running:
Input the number of office supply items needed: 3
Input the prices (before tax) for all 3 items:
16.99
100.25
25.50
The prices after tax are:
$18.00
$106.26
$27.03
Hints:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// Input: 
// - the number of office supply items requested by our department for the Fall 
//   semester 2016
// - the price for all those items (tax not included)
// Output:
// - the prices of all items requested, after applying the sales tax (6%)
// - the average price after tax
// Hint: You should use two arrays of real numbers in order to store the prices 
//       of all items before and after tax
// Example of Running:
// Input the number of office supply items needed: 3
// Input the prices (before tax) for all 3 items:
// 16.99
// 100.25
// 25.50
// The prices after tax are:
// $18.00
// $106.26
// $27.03 
#include <???>      // <-- header to manipulate output
#include <iostream>

int main()
{
    // Input: 
    // - the number of office supply items requested by our department for the 
    // Fall semester 2016
    std::cout << "Please insert the number of office supply items requested\n"
                 "by our department for the Fall semester 2016.\n"
                 "How many items have been requested? ";
    int itemnum = 0;
    /* insert input inside --> */ itemnum;

    // - the price for all those items (tax not included)
    std::cout << "Please insert the price (tax not included) of each item.\n";
    double* net_items = ... // create an array to store 'itemnum' prices
    double* taxed_items = ... // create an array to store 'itemnum' prices
    double total_taxed_prices = // initial value?

    for(int i /* initial value?; stop condition?; increment? */) {
        std::cout << "Price of item " << i+1 << ": ";
        std::cin >> ... // where should this value be stored?
        taxed_items[/*an index needed here*/] = /*original price*/ * 0.06;
        // To calculate the average price, you need the sum of all taxed prices:
        total_taxed_prices += // how much should this be incremented?
    }

    // Output:
    // - the prices of all items requested, after applying the sales tax (6%)
    std::cout << "The prices after tax are:\n";
    for(/* loop inside taxed_items */ ) {
        std::cout << // instructions to truncate number after second decimal
                  << // dollar sign needed
                  << taxed_items[i] << '\n';
    }
 
 // - the average price after tax
    std::cout << "\nAverage taxed price is " 
              << // instructions to truncate number after second decimal
              << // dollar sign needed
              << /* sum of all taxed prices / item number */
              << ".\n";
    return 0;
}

Registered users can post here. Sign in or register to post.