1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Molodets [167]
3 years ago
13

Develop a C# console application that will determine the gross pay for each of three employees. The company pays straight time f

or the first 40 hours worked by each employee and time and a half for all hours worked in excess of 40 hours. You are given a list of the three employees of the company, the number of hours each employee worked last week, and the hourly rate of each employee. Your application should input this information for each employee and should determine and display the employee’s gross pay. Use the Console class’s ReadLine method to input the data. Use a while loop to implement the inputs and calculations.
Computers and Technology
1 answer:
I am Lyosha [343]3 years ago
3 0

Answer:

The c# program for the scenario is shown.

using System;

class main {

 static void Main() {

   

// arrays to hold details of employees are declared

// double datatype is taken to accommodate all types of numerical values  

     int[] empid = new int[3];

     double[] hours = new double[3];

     double[] pay = new double[3];

     double[] pay_overtime = new double[3];

     double hrs = 40.00;

     double[] total_pay = new double[3];

     

   Console.WriteLine("Enter the details for the three employees ");

// variable declared and initialized for the loop    

   int i=0;

   while(i<3)

   {

       Console.WriteLine("Enter the id");

       empid[i] = Convert.ToInt32(Console.ReadLine());  

       

       Console.WriteLine("Enter the working hours");

       hours[i] = Double.Parse(Console.ReadLine());

       

       Console.WriteLine("Enter the hourly pay");

       pay[i] = Double.Parse(Console.ReadLine());

       pay_overtime[i] = pay[i]*1.5;

       

       i++;

       

   }

   

   Console.WriteLine("The details for the three employees ");

   // variable set to 0 to be re-used in the loop

   i=0;

   

   while(i<3)

   {

       if(hours[i] > hrs)

           total_pay[i] = ( hrs*pay[i] );

       else

           total_pay[i] = ( hours[i]*pay[i] );

       

       if(hours[i] > hrs)

           total_pay[i] = total_pay[i] + ( (hours[i]-hrs)*pay_overtime[i] );

       

       i++;

       

   }

// variable set to 0 to be re-used in the loop

   i=0;

   

   while(i<3)

   {

       Console.WriteLine("Gross pay of employee " + (i+1) + " : " + total_pay[i] );

   

       i++;

   }

   

   

 }

}  

OUTPUT

Enter the details for the three employees  

Enter the id

1

Enter the working hours

35

Enter the hourly pay

10

Enter the id

2

Enter the working hours

40

Enter the hourly pay

10

Enter the id

3

Enter the working hours

45

Enter the hourly pay

10

The details for the three employees  

Gross pay of employee 1 : 350

Gross pay of employee 2 : 400

Gross pay of employee 3 : 475  

Explanation:

The program works as described.

1. Arrays to hold each piece of information for the employee, employee number, hourly pay, overtime pay and hours worked, are declared.

2. User input is taken inside while loop to fill each array for each employee.

3. The total gross pay for each employee is calculated inside another while loop.

4. The last while loop is used to display the gross pay for each employee.

You might be interested in
```{r}
Stells [14]
Know what your trying to say her input pound 45-94
4 0
3 years ago
A sequence of repetitive operations performed to evaluate the ability of a PC to operate at peak efficiency for a defined time p
iragen [17]

Answer:

False.

Explanation:

The description provided matches better with Software performance testing, and shouldn't be confused with a benchmark.

In computing, a benchmark is a tool or software designed to measure the average performance of another program, by running several tests and trials against it.

A performance testing is designed to measure the performance and responsiveness of a computer system (not a program) under a heavy workload.

8 0
3 years ago
Write a program that uses the function strcmp() to compare two strings input by the user. The program should state whether the f
Andru [333]

user_str1 = str ( input ("Please enter a phrase: "))

user_str2 = str ( input("Please enter a second phrase: "))

def strcmp (word):

user_in1 = int (len(user_str1))

user_in2 = int (len(user_str2))

if user_in1 > user_in2:

return "Your first phrase is longer"

elif user_in1 < user_in2:

return "Your second phrase is longer"

else:

return "Your phrases are of equal length"

3 0
3 years ago
NEED HELP NOW 25 POINTS WILL MARK BRAINLIEST!!!
erastova [34]
The answers are:
C
A
Hope it helps :)
6 0
3 years ago
Read 2 more answers
List at least three things that are included as part of property rights.
KatRina [158]
1) exclusivity of rights to choose the use of the resource

2) exclusivity of rights to the severices of a resource

3) rights to exchange at mutually agreeable terms
4 0
3 years ago
Other questions:
  • If there is no index.html file in the root folder nothing will be displayed when you navigate to the site address
    14·1 answer
  • Programmers use _____ languages in the Rapid Application Development (RAD) methodology to facilitate code reuse?
    5·1 answer
  • Fill the validateForm function to check that the phone number contains a number (use the isNaN function) and that the user name
    10·1 answer
  • You listened to a song on your computer. Did you use hardware or software? Explain.
    11·2 answers
  • Draw the cache tables and the state of all bits within them. Suppose you have a 16 byte cache with 2 byte long cachelines that i
    6·1 answer
  • Which note-taking method quickly captures and organizes information?
    9·2 answers
  • Which component of the windows desktop allows you to retrieve files that have recently been deleted?
    11·1 answer
  • Ayuda necesito 7 objetos que se utilizan en la vida diaria
    8·1 answer
  • A(n) ____________________ key is a key that is not reused, but rather is only used once, thus improving security by reducing the
    5·1 answer
  • As part of your regular system maintenance, you install the latest operating system updates on your Windows 10 computer. After s
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!