MACHINE PROBLEMS #2

1.
Create a C++ program that would input the following data about a merchandise:
Product
Number, Item Description, Original Price, Estimated Years of used of a Merchandise,
Salvage Value of Merchandise. Compute the Depreciation and Rate of Depreciation of
the Merchandise using the Straight Line Method.
Depreciation = (Original Price

Salvage Value) / Year of Service
Rate of Depreciation = Depreciation / Original Price
Note: The Rate of Depreciation should be converted to percent equivalent.
2.
Create a C++ program that would input the following data: Employee Number, Employee LastName, Employee FirstName, Rate per hour, Number of Hours Worked. Compute
and ouput the Gross Pay, SSS Deduction, Tax Withhold, Total Deduction, Net Pay
Gross Pay = No. of hrs worked * rate per hour.
SSS Deduction = 5% of Gross Pay
Tax Withhold = 10% of Gross
Pay
Total Deduction = SSS Deduction + Tax Withhold
Net Pay = Gross Pay

Total Deductions
3.
Write a C++ program that would input Employee Name, Rate per hour, No. of hours worked and will
compute the daily wage of an employee. If the number of hours worked
exceeds eight hours add 30% to each excess hours as overtime rate.
Formula:
Daily Wage = Rate per hour * No. of hours worked + OT pay

Write a program that takes as input the

hourly
wage
,
total regular hours
and
total overtime hours
and displays an employee’s
total weekly
pay

Here's a step-by-step solution for each of the problems:

Problem 1: Computing Depreciation using the Straight Line Method

1. Declare the necessary variables:
- prodNumber (integer) - input the product number
- itemDesc (string) - input the item description
- origPrice (float) - input the original price
- yearsOfService (integer) - input the estimated years of used of the merchandise
- salvageValue (float) - input the salvage value of the merchandise
- depreciation (float) - to store the computed depreciation
- rateOfDepreciation (float) - to store the computed rate of depreciation

2. Prompt the user for the necessary inputs:
- product number
- item description
- original price
- years of service
- salvage value

3. Compute the depreciation:
- depreciation = (origPrice - salvageValue) / yearsOfService

4. Compute the rate of depreciation:
- rateOfDepreciation = (depreciation / origPrice) * 100

5. Output the computed depreciation and rate of depreciation.

Problem 2: Computing Employee Payroll

1. Declare the necessary variables:
- empNumber (integer) - input the employee number
- lastName (string) - input the employee last name
- firstName (string) - input the employee first name
- ratePerHour (float) - input the rate per hour
- hoursWorked (float) - input the number of hours worked
- grossPay (float) - to store the computed gross pay
- sssDeduction (float) - to store the computed SSS deduction
- taxWithhold (float) - to store the computed tax withhold
- totalDeduction (float) - to store the total deduction
- netPay (float) - to store the computed net pay

2. Prompt the user for the necessary inputs:
- employee number
- employee last name
- employee first name
- rate per hour
- number of hours worked

3. Compute the gross pay:
- grossPay = ratePerHour * hoursWorked

4. Compute the SSS deduction:
- sssDeduction = 0.05 * grossPay

5. Compute the tax withhold:
- taxWithhold = 0.10 * grossPay

6. Compute the total deduction:
- totalDeduction = sssDeduction + taxWithhold

7. Compute the net pay:
- netPay = grossPay - totalDeduction

8. Output the computed gross pay, SSS deduction, tax withhold, total deduction, and net pay.

Problem 3: Computing Daily Wage with Overtime

1. Declare the necessary variables:
- empName (string) - input the employee name
- ratePerHour (float) - input the rate per hour
- hoursWorked (float) - input the number of hours worked
- dailyWage (float) - to store the computed daily wage
- overtimeRate (float) - to store the computed overtime rate
- excessHours (float) - to store the number of excess hours worked
- overtimePay (float) - to store the computed overtime pay

2. Prompt the user for the necessary inputs:
- employee name
- rate per hour
- number of hours worked

3. Compute the daily wage:
- dailyWage = ratePerHour * hoursWorked

4. Check if the number of hours worked exceeds eight hours:
- If it exceeds, calculate the overtime pay:
- excessHours = hoursWorked - 8
- overtimeRate = ratePerHour * 1.3
- overtimePay = excessHours * overtimeRate
- dailyWage += overtimePay

5. Output the computed daily wage.

Note: Make sure to include the necessary header files and use appropriate syntax in your C++ program to execute the steps outlined above.

To solve each machine problem, you will need to create a C++ program that prompts the user to input the required data and perform the necessary calculations. Follow the steps below to complete each problem:

Machine Problem #2 - Problem 1:

1. Begin by declaring the necessary variables to store the data being inputted. This includes variables for the product number, item description, original price, estimated years of use, and salvage value of the merchandise.
2. Use "cin" statements to prompt the user to input the values for each variable.
3. Calculate the depreciation by subtracting the salvage value from the original price and then dividing it by the number of years of service.
4. Calculate the rate of depreciation by dividing the depreciation by the original price and then converting it to a percentage.
5. Print the depreciation and rate of depreciation to the console using "cout" statements.

Machine Problem #2 - Problem 2:

1. Declare the necessary variables to store the employee number, last name, first name, rate per hour, and number of hours worked.
2. Prompt the user to input the values for each variable using "cin" statements.
3. Calculate the gross pay by multiplying the number of hours worked by the rate per hour.
4. Calculate the SSS deduction by multiplying the gross pay by 5%.
5. Calculate the tax withhold by multiplying the gross pay by 10%.
6. Calculate the total deduction by adding the SSS deduction and tax withhold.
7. Calculate the net pay by subtracting the total deduction from the gross pay.
8. Print the gross pay, SSS deduction, tax withhold, total deduction, and net pay to the console using "cout" statements.

Machine Problem #2 - Problem 3:

1. Declare the necessary variables to store the employee name, rate per hour, and number of hours worked.
2. Prompt the user to input the values for each variable using "cin" statements.
3. Use an "if" statement or a ternary operator to check if the number of hours worked exceeds eight hours.
4. If the number of hours worked is greater than eight, calculate the overtime pay by multiplying the excess hours by 30% of the rate per hour.
5. Calculate the daily wage by multiplying the rate per hour by the number of hours worked and adding the overtime pay (if applicable).
6. Print the daily wage to the console using a "cout" statement.