Question

In: Computer Science

(C++) Follow the template given to calculate and print the monthly salary of an employee. We...

(C++) Follow the template given to calculate and print the monthly salary of an employee. We assume the employee works for 50 weeks during the year with an hourly rate of $25. Your program should ask the user the workHoursPerWeek. If it's over 40, then the excess hours (i.e., workHoursPerWeek over 40) are paid with 20% overtime rate. Note: just print out the monthly salary.

Example: If I work for 45 hours with a rate of $30/hr, then my weekly pay is 40x30+(45-40)x(1+0.2)x30=1200+180=1380.

Solutions

Expert Solution

using namespace std;
#include<iostream>
int main()
{
int workhrs,pay; //Initialising variable
cout<<"Enter the work hours per week: "; //User enters hours per week
cin>>workhrs;
int hrrate=30; //Hourly rate of 30$
if(workhrs>40) //If hours>40
pay=40*hrrate+(workhrs-40)*1.2*hrrate; //Pay is calculated accordingly
else
pay=hrrate*workhrs;
cout<<"\nThe monthly pay is: $ "<<pay;
}


Related Solutions

17.9 Worksheet 7 Follow the instructions commented into the given template. There will be no partial...
17.9 Worksheet 7 Follow the instructions commented into the given template. There will be no partial credit given. #include <iostream> using namespace std int main() { int array1[20] = {3, 18, 1, 25, 4, 7, 30, 9, 80, 16, 17}; int numElements = 11; cout << "Part 1" << endl; // Part 1 // Enter the statement to print the numbers in index 4 and index 9 // put a space in between the two numbers cout << endl; //...
Find the second minimum of an integer array? //this is the template we follow. Answer must...
Find the second minimum of an integer array? //this is the template we follow. Answer must run in linear time (i.e. no nested loops). package findsecondminimumtest; import java.util.Arrays; import java.util.NoSuchElementException; public class FindSecondMinimumTest { /** * Find the second minimum of an integer array * * @param a is the array * @return the second minimum if array has at least two elements and it * indeed has a second minimum. If array length is less than two, it throws...
Write a C++ program for the following problem: Calculate and print the area and volume of...
Write a C++ program for the following problem: Calculate and print the area and volume of a cone inside a While  loop that goes from 1 to 20 with a step of .5. (the step is 1/2 or Point 5, so you go 10, 10.5,11, 11.5) Note: Your loop variable will need to be a double data type Use two decimal places on all numbers that are double data type. This will be a table with 3 columns. Don't worry about...
Given the monthly returns that follow, find the R2, alpha, and beta of the portfolio.
Given the monthly returns that follow, find the R2, alpha, and beta of the portfolio. Compute the average return differential with and without sign. Do not round intermediate calculations. Round your answers to two decimal places.R2:   Alpha:   %Beta:   Average return difference (with signs):   %Average return difference (without signs)   %
SOLVE IN C: Given numRows and numColumns, print a list of allseats in a theater....
SOLVE IN C: Given numRows and numColumns, print a list of all seats in a theater. Rows are numbered, columns lettered, as in 1A or 3E. Print a space after each seat, including after the last. Ex: numRows = 2 and numColumns = 3 prints:1A 1B 1C 2A 2B 2C
Java program to implement circular linked list. NO COPY PASTE ANSWERS plz follow the given template......
Java program to implement circular linked list. NO COPY PASTE ANSWERS plz follow the given template... public class CircularLinkedList { private Node tail; private int size; public CircularLinkedList() { tail= null; size = 0; } public int size(){ return size; } public boolean isEmpty() { return size==0; } //if list is not empty return the first element public E first() { if (isEmpty()) return null; //code here return 0; } //if list not empty return last element public E last()...
Given the monthly returns that follow, find the R2, alpha, and beta of the portfolio. Compute...
Given the monthly returns that follow, find the R2, alpha, and beta of the portfolio. Compute the average return differential with and without sign. Do not round intermediate calculations. Round your answers to two decimal places. Month Portfolio Return S&P 500 Return January 6.0 % 6.3 % February -2.6 -3.3 March -1.5 -1.3 April 2.3 1.7 May 0.7 -0.1 June -0.9 -0.3 July 0.5 0.8 August 1.5 1.8 September -0.4 0.2 October -3.0 -3.5 November 2.9 2.4 December 0.4 -0.1...
Given the monthly returns that follow, find the R2, alpha, and beta of the portfolio. Compute...
Given the monthly returns that follow, find the R2, alpha, and beta of the portfolio. Compute the average return differential with and without sign. Do not round intermediate calculations. Round your answers to two decimal places. Month Portfolio Return S&P 500 Return January 5.8 % 6.0 % February -2.4 -3.3 March -1.9 -1.3 April 2.4 1.6 May 0.5 0.2 June -1.0 -0.6 July 0.2 0.4 August 1.4 1.9 September -0.5 -0.3 October -3.5 -3.8 November 2.5 1.9 December 0.4 0.0...
Given the monthly returns that follow, find the R2, alpha, and beta of the portfolio. Compute...
Given the monthly returns that follow, find the R2, alpha, and beta of the portfolio. Compute the average return differential with and without sign. Do not round intermediate calculations. Round your answers to two decimal places. Month Portfolio Return S&P 500 Return January 5.3 % 5.5 % February -2.4 -2.9 March -1.8 -1.1 April 2.5 2.0 May 0.9 0.5 June -1.1 -0.5 July 0.2 0.4 August 1.3 1.7 September -0.8 -0.1 October -3.2 -3.8 November 2.8 2.3 December 0.8 0.3...
Given the monthly returns that follow, find the R2, alpha, and beta of the portfolio. Compute...
Given the monthly returns that follow, find the R2, alpha, and beta of the portfolio. Compute the average return differential with and without sign. Do not round intermediate calculations. Round your answers to two decimal places. Month Portfolio Return S&P 500 Return January 5.5 % 5.7 % February -2.3 -3.2 March -1.9 -1.1 April 2.3 1.8 May 0.9 0.2 June -0.5 0.0 July 0.0 0.2 August 1.3 1.5 September -0.3 0.2 October -3.7 -4.2 November 2.3 1.5 December 0.3 0.1...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT