C++ HELP: Your company (give it a name that includes your own last name) is a ca
ID: 3670657 • Letter: C
Question
C++ HELP: Your company (give it a name that includes your own last name) is a car dealership with 2 types of employees. You have hourly workers and workers that work on commission. Your program must ask the user what type of employee they are and then calculate their salary for the week, asking the user for what you need.
Commission workers receive base salary of $400 per week plus commission. Commission is 8.00 % of the week’s sale value. A sale value is calculated by taking 30% of the car’s sale price. Because we don’t have too many skills yet( you may but you are not expected to yet), a salesman can only sell one car a week. Make sure the percentages are all constants declared prior to function main so they can be easily adjusted if needed and they use proper constant style (all uppercase). Hourly workers are paid time and a half for anything over 40 hours. Have them enter their hours and their hourly rate.
Explanation / Answer
#include<iostream>
using namespace std;
#define BASE_SAL 400
#define COMISSION 8
#define SALEVALUE 30
int main(){
int type;
cout<<"Enter type of Employee"<<endl;
cout<<"1. Weekly Paid. 2. Hourly Paid"<<endl;
cin>>type;
switch(type){
case 1:
cout<<"Enter number of cars sold this week: ";
int n,price;
double comm;
cin>>n;
cout<<"Enter price of each car: ";
cin>>price;
comm = (n*price)*(COMISSION/100);
cout<<"Salary of Emp: "<<(BASE_SAL+comm)<<endl;
break;
case 2:
int hrs;
double rate;
cout<<"Enter number of total hours: ";
cin>>hrs;
cout<<"Rate for each hours: ";
cin>>rate;
cout<<"Salary of Emp: "<<(hrs*rate)<<endl;
break;
default:
cout<<"Invalid type of employee"<<endl;
}
return 0;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.