Question

// I am going to use if and else stamtents for this employee pay clalulations. //using...

// I am going to use if and else stamtents for this employee pay clalulations.

//using if and else to cal salary

//If hours worked is <= 40.0

//Employee salry will = hours*pay rate

//else

//employess salary will =40*pay rate +(hours worked-40)*1.5* pay rate.

#include

using namespace std;

const double Max_Hours= 40.0;

const double MuLTIPLER = 1.5;

char salary;

char payrate;

char hours_worked;

char Max_hours;

char get_total_pay;

int main()

{

double Hours=0;

double Payrate = 0;

cout <<"Please enter employee hours worked[xx.yy]" <

cin>>hours_worked ;

cout <<"Please enter employee hourly rate[xx.yy]" <

cin>> Payrate;

cin >> get_total_pay;

double salary =0;

  

if (Hours<= Max_hours){

salary = Hours*payrate;

}

else{

salary = Max_Hours*payrate+(hours_worked-Max_hours)* MuLTIPLER*payrate;

}

// This shows hours worked, payrate and salary//

cout <<"number of hours worked"<

cin >> hours_worked;

cout <<"payrate $"<

cin>>Payrate;

cout <<" get salary $" <

cin>> salary;

return 0;

  

can you tell me what is worng witht my code I cant get it to print the total salary and how would I make menus and boxes for this code. I am using a mac to write this code and can you show your work.

}

0 0
Add a comment Improve this question Transcribed image text
Answer #1
#include <iostream>
using namespace std;

const double Max_Hours= 40.0;

const double MuLTIPLER = 1.5;

double salary;

double payrate;

double hours_worked;

double Max_hours;


int main()

{

double Hours=0;

double Payrate = 0;

cout <<"Please enter employee hours worked[xx.yy]" <

cin>>hours_worked ;

cout <<"Please enter employee hourly rate[xx.yy]" <

cin>> Payrate;

double salary =0;

  

if (Hours<= Max_hours){

salary = Hours*payrate;

}

else{

salary = Max_Hours*payrate+(hours_worked-Max_hours)* MuLTIPLER*payrate;

}

// This shows hours worked, payrate and salary//

cout <<"number of hours worked";

cout << hours_worked<<endl;;

cout <<"payrate $";

cout << Payrate<<endl;;

cout <<" get salary $";

cout << salary <<endl;;

return 0;
}

Please enter employee hours workedLxx.yy 156.43 Please enter employee hourly ratexx-yy 160 umber of hours worked56.43 payrate

\color{blue}Please\; up\;vote\;the \;solution \;if \;it \;helped.\;Thanks!

\color{red}Note: \;Please \;comment \;below \;if \;you \;have \;any \;issues \;with \;this \;solution.\;

Add a comment
Know the answer?
Add Answer to:
// I am going to use if and else stamtents for this employee pay clalulations. //using...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • i am having trouble displaying results and displaying them evenly it is suppose to look like...

    i am having trouble displaying results and displaying them evenly it is suppose to look like this Enter the following data for employee 1: Employee ID: 1298 Hours worked: 35.8 Pay rate (per hour): 23.45 Enter the following data for employee 2: Employee ID: 1899 Hours worked: 34.5 Pay rate (per hour): 19.5 Enter the following data for employee 3: Employee ID: 4435 Hours worked: 30.5 Pay rate (per hour): 20.75 Enter the following data for employee 4: Employee ID:...

  • This C++ program will not let me put numbers in on address, just characters #include using namespace std; float paycalc(){ cout<<"Enter 1 if salary and 2 if hourly: "; int choice, hoursW...

    This C++ program will not let me put numbers in on address, just characters #include using namespace std; float paycalc(){ cout<<"Enter 1 if salary and 2 if hourly: "; int choice, hoursWorked, payrate; float salary; cin>>choice; if(choice == 1){ cout<<"Enter your salary per month: "; cin>>salary; }else{ cout<<"Enter hours worked: "; cin>>hoursWorked; cout<<"Enter pay rate: "; cin>>payrate; salary = hoursWorked * payrate; } return salary; } void printCheck(float sal, int id, char address[30]){ cout<<"Employee id: "<>id; cout<<"Enter address: "; char...

  • Why is my code not calculating the pay and not printing entire data at the end? // // main.cpp // Project 14 // // Created by Esmeralda Martinez on 5/13/19. // Copyright © 2019 Esmeralda Martinez. All...

    Why is my code not calculating the pay and not printing entire data at the end? // // main.cpp // Project 14 // // Created by Esmeralda Martinez on 5/13/19. // Copyright © 2019 Esmeralda Martinez. All rights reserved. // #include<iostream> #include<fstream> #include<cstdlib> #include<regex> #include <iomanip> using namespace std; float grossPay(float hrsWorked, float payrate); float grossPay(float hrsWorked, float payrate){ return hrsWorked*payrate;       } int main(){    //opening an output file ifstream outFile("Employee.txt", ios::in); //Read variables string depId,emp_num,firstName,lastName,email,hrs_worked,pay_rate,ch="y";    //Regex patterns regex integerPattern("(\\+|-)?[[:digit:]]+"); regex...

  • My if/else statement wont run the program that I am calling. The menu prints but once...

    My if/else statement wont run the program that I am calling. The menu prints but once I select a number the menu just reprints, the function called wont run. What can I do to fix this probelm? #include <iostream> #include "miltime.h" #include "time.h" #include "productionworker.h" #include "employee.h" #include "numdays.h" #include "circle.h" using namespace std; int main() { int select=1;     while (select>0) { cout << "Option 1:Circle Class\n"<< endl; cout << "Option 2:NumDay Class\n" << endl; cout <<"Option 3:Employee and Production...

  • This question is about calculating and printing payslips. User inputs his name, number of worked hours...

    This question is about calculating and printing payslips. User inputs his name, number of worked hours and hourly rate. below is the source file for my program...It's supposed calculate salaries. Given that a work week has 40 hours and over time is 1.5xnormalRate for each our of overtime My output is not working. what is wrong with this code? // Calculate and print payslips #include <iostream> #include <iomanip> using namespace std; const float workingHours = 40.0; void getData( string &employeeP,...

  • I want c++ code for employee payslip calculation using switch statement convert this code to switch...

    I want c++ code for employee payslip calculation using switch statement convert this code to switch statement also, use for loop ___________________________________________________________________________ #include using namespace std; int main() {char empname[222]; float basicSalary, h_r_a, DearnessAllow, tax, netSalary; int e_id; cout<<"\nEmployee Name :"; cin>>empname; cout<<"\nEmployee Id :"; cin>>e_id; cout << "Enter Basic Salary : "; cin >> basicSalary; DearnessAllow = 0.30 * basicSalary; h_r_a= 800; tax = 0.10 * basicSalary; netSalary = basicSalary + DearnessAllow + h_r_a - tax; cout<<"\nEmployee Id              :...

  • This is c++ programming and here is my code. I am getting an exception thrown on...

    This is c++ programming and here is my code. I am getting an exception thrown on the destructor for permanentworker. Can you tell me why I am getting this exception? #include <iostream> #pragma warning(disable:4996) class PermanentWorker { private:    char *name;    int salary; public:    PermanentWorker(const char* nam, int money) : salary(money)    {        name = new char[strlen(nam) + 1];        strcpy(name, nam);    }    int getPay() const    {        return salary;   ...

  • Hey, i was just wondering how i would calculate over time pay in c++ visual studio...

    Hey, i was just wondering how i would calculate over time pay in c++ visual studio 2017? what i have right now is either returning 0 for some reason or being skipped over? im also wondering about the federal tax as well because that also doesn't seem to work, any help is greatly appreciated! these are my variables char chChoice = ' '; int intempID = 0; int intHours = 0; int intOThours = 0; float flOTrate = 0; float...

  • The following Java code outputs various amounts for a worker based on skill level, hours worked,...

    The following Java code outputs various amounts for a worker based on skill level, hours worked, and insurance: import java.util.Scanner; public class Pay { public static void main(String[] args) { int SkillOneRate = 17; int SkillTwoRate = 20; int SkillThreeRate = 22; double MedicalInsurance = 32.50; double DentalInsurance = 20.00; double DisabilityInsurance = 10.00; int skill,hours; int choice; char y; char n; int payRate =0; double regularPay = 0; double overtimePay = 0; double grossPay=0; double deductions=0; double netPay =...

  • I NEED ALL QUESTIONS OR ELSE THUMBS DOWN! C++ Implement a structure Employee. An employee has...

    I NEED ALL QUESTIONS OR ELSE THUMBS DOWN! C++ Implement a structure Employee. An employee has a name (a char *) and a salary (a double). Write a default constructor, a constructor with two parameters (name and salary), and methods char* getName() double getSalary() to return the name and salary. Write a small global function TestEmployee() to test your structure. Creating a new employee. Please type the name: Larry Bird Please specify the salary: 200000 New employee has been created....

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT