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
// 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;
}