In: Computer Science
In c++
create a program that asks for tire shop sales numbers made by 0 to 20 employees
Premium tires sell for $300 and standard tires sell for $250
The wholesale cost of premium tires is $120 and the standard is $100
The program must ask for each employee's name and then the amount of premium and standard tires sold.
Output the name and the total profit each employee made for the shop
Output the total profits earned between all employees
Complete the program using basic methods, no arrays or vectors
`Hey,
Note: If you have any queries related to the answer please do comment. I would be very happy to resolve all your queries.
/******************************************************************************
Online C++ Compiler.
Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile
and execute it.
*******************************************************************************/
#include <iostream>
using namespace std;
int profitEmployee(int n1,int n2)
{
return (n1)*(300-120)+(n2)*(250-100);
}
int main()
{
int profit=0;
string name;
for(int i=0;i<=20;i++)
{
cout<<"Enter name of "<<(i)<<"th employee:
";
cin>>name;
int prem;
cout<<"Enter premium tires sold: ";
cin>>prem;
int stan;
cout<<"Enter standard tires sold: ";
cin>>stan;
int pro=profitEmployee(prem,stan);
profit+=pro;
cout<<"name: "<<name<<",
profit="<<pro<<endl;
}
cout<<"Net profit: "<<profit<<endl;
return 0;
}
Kindly revert for any queries
Thanks.