Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C# Project help Write a program called DeductionCalculator that calculates a payroll deduction using a method called CalculateDeduction . The user will enter gross pay,

C# Project help

Write a program called DeductionCalculator that calculates a payroll deduction using a method called CalculateDeduction. The user will enter gross pay, a deduction code, and a deduction value. Deductions can be a percentage, a fixed amount, or none based on a deduction code. The three values must be entered before you perform the if or switch statement. In other words, you enter the three values, test the deduction code and then perform the calculation. Write a program to allow a user to enter the three values, calculate the deduction, and display the three input values and the amount of the deduction.

Calculate Deduction: Name CalculateDeduction. Return type: float

Parameters: gross pay, deduction code, deduction value

Gross pay and deduction are float. Deduction code is a character.

Deductions have three different methods depending upon the deduction code:

Deduction code = N: Deduction is zero.

Deduction code = F: Deduction is a fixed amount and the deduction value entered is dollars and cents.

Deduction code = P: Deduction is a percent of gross pay and the deduction value entered is a decimal percentage. The percentage must be less than or equal to .60 (60%). If the percentage is greater than 60%, make the percentage 60%.

A deduction cannot exceed gross pay. If it does, the deduction is equal to gross pay. However, the deduction may cause the gross pay to be zero.

Your program should output the three input value and the calculated deduction.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases And Python Programming MySQL MongoDB OOP And Tkinter

Authors: R. PANNEERSELVAM

1st Edition

9357011331, 978-9357011334

More Books

Students also viewed these Databases questions

Question

( 1 5 points ) Give the regular expression for following DFA:

Answered: 1 week ago