Answer:
Here is Algorithm.
1.Read the number of items "n".
2.for i=1 to n
2.1 read cost of each items
2.2 calculate total cost of all items and assign to tot_cost
3. if the total cost is less than 200
3.1 add 10 per item(hipping and handling charge) to tot_cost
4. print the total cost
5.end the program
Implementation in C++.
// include headers
#include <bits/stdc++.h>
using namespace std;
// main function
int main()
{
// variables
int no_item;
double tot_cost=0,cost;
cout<<"enter the number of items:";
// read number of items
cin>>no_item;
for(int a=1;a<=no_item;a++)
{
cout<<"enter the cost of item "<<a<<":";
// read cost of each item
cin>>cost;
// calculate total cost
tot_cost=tot_cost+cost;
}
// if total cost is less than 200
// add 10 per item
if(tot_cost<200)
tot_cost=tot_cost+no_item*10;
// print the total cost
cout<<"total cost of all item is:"<<tot_cost<<endl;
return 0;
}
Output:
enter the number of items:4
enter the cost of item 1:55
enter the cost of item 2:80
enter the cost of item 3:34
enter the cost of item 4:49
total cost of all item is:218