Write a program for a company that sells 7 different types of smartphones. The p
ID: 3659418 • Letter: W
Question
Write a program for a company that sells 7 different types of smartphones. The program should help the company to keep track of their sales. The program should use two arrays both should hold 7 elements: a) an array of strings that holds the 7 smartphone names. The value of the names should be initialized at the time the array is created. The names of the phones are up to you to decide on. b) an array of integers that holds the number of phones sold during the past 4 months for each smartphone type. The program should prompt the user to enter the number of phones sold for each type. The program should then produce a small report that displays: - sales for each phone type - total sales - the name of the lowest selling productExplanation / Answer
please rate - thanks
if you haven't learned formatting message me before rating, I'll get rid of it
#include <iostream>
#include <string>
#include <iomanip>
using namespace std;
int main()
{string phones[7]={"smarty","androidy","razory","iphony","ultra smart","mysmarts",
"myphone"};
int sold[7],i,total=0,low;
cout<<"Enter sales last four months for following phones ";
for(i=0;i<7;i++)
{cout<<phones[i]<<": ";
cin>>sold[i];
total+=sold[i];
}
low=0;
for(i=1;i<7;i++)
if(sold[i]<sold[low])
low=i;
cout<<"SALES SUMMARY phone #sold ";
for(i=0;i<7;i++)
cout<<setw(15)<<left<<phones[i]<<sold[i]<<endl;
cout<<" Total phones sold: "<<total<<endl;
cout<<"Phone with lowest sales: "<<phones[low]<<endl;
system("pause");
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.