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
Users of an access point share the transmission capacity of the access point. The throughput a user gets is called the ________.
sdas [7]

Solution:

Users of an access point share the transmission capacity of the access point. The throughput a user gets is called the bits per seconds.

Thus this is the required answer.

6 0
3 years ago
You are looking at computer ads. One has a processor that is 3.64GHz. What does this mean?
aliina [53]

Answer:

The higher the clockspeed the more the cpu can do

Explanation:

8 0
3 years ago
host b is sending an email intented for the user on host a to the mail server what protocol is being used to send the message
KatRina [158]

Answer:

SMTP

Explanation:

This is the SMTP or the Simple Mail Transfer Protocol. It is the push protocol and is used to send the mail message. Whereas POP3 and IMAP are meant for retrieving the message. These are the three main types of protocols associated with mail services. And the correct answer here is certainly the SMTP.

3 0
3 years ago
An additional factor in how an element is rendered is that properties are passed from a parent element to its children in a proc
ValentinkaMS [17]

Answer: Style inheritance

Explanation:

Style inheritance is used to design style sheets. It is a process in which properties are inherited by children from a parent element. For example you wish that all text on a page use same font color i.e. red. You can apply they following style for <body> tag like {body color:red;}. All the elements in the web page will inherit this font color. This is better to use than to create styles for each tag. Every heading and paragraph will be displayed in this font color until you define different color for particular element.

3 0
3 years ago
3. When code tracing, why is it important to iteratively test parts of the program?
GenaCL600 [577]

Answer:

A. To isolate errors in the outcomes of code.

<em>Hope this helps! ^-^</em>

<em>-Isa</em>

7 0
3 years ago
Other questions:
  • Generally speaking, mobile sites are good for acquiring new customers and inspiring new relationships while mobile apps are good
    6·1 answer
  • What is binary number
    11·1 answer
  • Which element of presentation software can you use to add callouts and banners?
    5·2 answers
  • What is the best information to include in the template name to differentiate it from other templates? Check all that apply.
    6·1 answer
  • Write a shell script called SpellOutDate that prints the detail of the current date in separate lines. For example if the curren
    13·1 answer
  • Define the missing method. licenseNum is created as: (100000 * customID) licenseYear, where customID is a method parameter. Samp
    14·2 answers
  • A provides legal protection for something an individual has created
    12·1 answer
  • What can hack or code can I use to get a shadow or frost dragon in adopt me
    6·2 answers
  • Microsoft Word, Google Chrome, and Windows Media Player are examples of
    15·1 answer
  • Which of the following protocols is used by an email client to retrieve messages from an email server, giving users the option t
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!