Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using the task assigned for Workshop 5, you will modify the task to use classes and methods to determine an employee's non-overtime salary and overtime

Using the task assigned for Workshop 5, you will modify the task to use classes and methods to determine an employee's non-overtime salary and overtime salary.

Important: The program must allow the entry of several employees. Important: The [program must consist of 2 classes Program class with Main method Emp class with attributes and two methods You must take into account the following conditions:

Input: The program must allow the entry of the employee's name The program must allow the entry of hours worked The program must allow the entry of the Hourly Rate.

Conditions: If the employee works 40 hours or less: It will call the method to determine salary without overtime If it works more than 40 hours It will call the method to determine salary with overtime.

Classes and Methods: Class Emp Attributes name hoursWorked rateHour

Methods:

saltNoExtras salary = hoursWorked * rateHour leaveExtras hoursExtras = hoursWorked - 40 salExtra = hoursExtras * (rateHour * 1.50) salary = ((40 * rateHour) + salExtra Output Name + SalaryBruto

The task must be uploaded in the link of workshop 6 with name Lab workshop 6.

Previous Work: workshop #5 we must use. program C#

image text in transcribed

image text in transcribed

*********************************************

WORAHOP #5 WRITTEN

Here is the C# program with methods to calculat using System; public class Program { public static double salaryNoExtras(int work double Gross_Salary= 40 * hourly_rate; return Gross_Salary; } public static double salarywithExtras(int wo { double Gross_Salary = 40 * hourly_rate; double Overtime = work_hours 40; double Extra_Salary Overtime*hourly_rate*1 Gross_Salary=Gross_Salary+Extra_Salary; return Gross_Salary; public static void Main() { String employee_name; double hourly_rate, Gross_Salary; int work_hour; int another=1; //0ption to calculate Gross Salary for multi while(another=31) { // Getting input from user Console.Write("Enter employee's name:"); employee_name = Console.ReadLine(); Console.Write("Enter the total hours of work work_hour = Convert.ToInt32(Console.ReadLine Console.Write("Enter the hourly rate:"); hourly_rate = Double.Parse(Console.ReadLine( //Calculating the gross salary of the employ //Invoke appropriate methods based on work_hi if(work hour>40) { Gross_Salary=salarywithExtras (work hour, hou } else { Gross_Salary=salaryNoExtras (work_hour, hourl: } T/Printing the output Console.Write(" >> ** Console.Write(" Employee Name:" + employe Console.Write(" Gross Salary:" + Gross_Sa. Console.Write(" Press 1 if you want to calci another = Convert. ToInt32(Console.ReadLine() { } } Here is a sample output Enter employee's name: Sam Enter the total hours of work:45 Enter the hourly rate: 10 >> ********************** Here is the C# program with methods to calculat using System; public class Program { public static double salaryNoExtras(int work double Gross_Salary= 40 * hourly_rate; return Gross_Salary; } public static double salarywithExtras(int wo { double Gross_Salary = 40 * hourly_rate; double Overtime = work_hours 40; double Extra_Salary Overtime*hourly_rate*1 Gross_Salary=Gross_Salary+Extra_Salary; return Gross_Salary; public static void Main() { String employee_name; double hourly_rate, Gross_Salary; int work_hour; int another=1; //0ption to calculate Gross Salary for multi while(another=31) { // Getting input from user Console.Write("Enter employee's name:"); employee_name = Console.ReadLine(); Console.Write("Enter the total hours of work work_hour = Convert.ToInt32(Console.ReadLine Console.Write("Enter the hourly rate:"); hourly_rate = Double.Parse(Console.ReadLine( //Calculating the gross salary of the employ //Invoke appropriate methods based on work_hi if(work hour>40) { Gross_Salary=salarywithExtras (work hour, hou } else { Gross_Salary=salaryNoExtras (work_hour, hourl: } T/Printing the output Console.Write(" >> ** Console.Write(" Employee Name:" + employe Console.Write(" Gross Salary:" + Gross_Sa. Console.Write(" Press 1 if you want to calci another = Convert. ToInt32(Console.ReadLine() { } } Here is a sample output Enter employee's name: Sam Enter the total hours of work:45 Enter the hourly rate: 10 >> **********************

how to use classes and methods replacing workshop 5

Here is the C# program with methods to calculat using System; public class Program { public static double salaryNoExtras(int work { double Gross_Salary = 40 * hourly_rate; return Gross_Salary; } public static double salaryWithExtras(int woj { double Gross_Salary = 40 * hourly_rate; double Overtime = work_hours - 40; double Extra_Salary Overtime*hourly_rate*1 Gross_Salary=Gross_Salary+Extra_Salary; return Gross_Salary; } public static void Main() { String employee_name; double hourly_rate, Gross_Salary; int work_hour; int another=1; 7/Option to calculate Gross Salary for multi while(another==1) { 1/Getting input from user Console.Write("Enter employee's name :"); employee_name = Console.ReadLine(); Console.Write("Enter the total hours of work work_hour = Convert.ToInt32(Console.ReadLine Console.Write("Enter the hourly rate:"); hourly_rate Double.Parse(Console.ReadLine( 7/Calculating the gross salary of the employ //Invoke appropriate methods based on work_hi if(work_hour>40) { Gross_Salary=salaryWithExtras(work_hour, houi } else { Gross_Salary=salaryNoExtras(work_hour, hourl: } //Printing the output Console.Write(" >> *. Console.Write(" Employee Name:" + employe Console.Write(" Gross Salary:" + Gross_Sa. Console.Write(" Press 1 if you want to calci another = Convert.ToInt32 (Console.ReadLine(). } } } Here is a sample output Enter employee's name: Sam Enter the total hours of work:45 Enter the hourly rate: 10 >> ********* ******* >> ****** ***** *** Employee Name : Sam Gross Salary: 475 Press 1 if you want to calculate for another Enter employee's name: Peter Enter the total hours of work:35 Enter the hourly rate: 10 >> ***** ***** ****** Employee Name: Peter Gross Salary:400 Press 1 if you want to calculate for another

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

Probabilistic Databases

Authors: Dan Suciu, Dan Olteanu, Christopher Re, Christoph Koch

1st Edition

3031007514, 978-3031007514

More Books

Students also viewed these Databases questions