Question

C coding language is used. Write a program that declare parallel arrays for storing information about...

C coding language is used.

Write a program that declare parallel arrays for storing information about 10 employees. One array will store the hours each person worked for a week and a second array will store each person's weekly pay. Your program should ask the user for the number of hours each of the 10 employees worked. The pay should calculate both regular and overtime pay. Assume that all 10 employees earn $15.25 per hour. Your program should allow the user to search the array for a specific # of hours and state the amount earned by the employee. Please answer in C not C++ or Java.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Note: Could you plz go this code and let me know if u need any changes in this.Thank You
_________________

#include <stdio.h>

int main()

{

//Declaring constants

const int size=10;

const double HOURLY_PAY=15.25;

//Declaring variables

int hours[size];

int i,whours;

double weeklyPay[size];

/* Getting the inputs entered by the user

* and populate those values into an array

*/

for(i=0;i<size;i++)

{

printf("No of Hours worked by Employee#%d:",i+1);

scanf("%d",&hours[i]);

//calculating weekly pay

if(hours[i]<=40)

{

weeklyPay[i]=hours[i]*HOURLY_PAY;

}

else

{

weeklyPay[i]=hours[i]*HOURLY_PAY*1.5;

}

}

//Getting the input entered by the user

printf("Enter No of hours worked :");

scanf("%d",&whours);

  

for(i=0;i<size;i++)

{

if(hours[i]==whours)

{

printf("\nEmployee#%d weekly salary :%.2f\n",i+1,weeklyPay[i]);

}

}

return 0;

}

___________________________

Output:

C: Program Files (x86)\Dev-CpplMinGW64 bin EmployeeWeeklyPayBasedOnHoursWorked.exe No of Hours worked by Employee#1:45 No of Hours worked by Employee#2:34 No of Hours worked by Employee#3:37 No of Hours worked by Employee#4:32 No of Hours worked by Employee#5:23 No of Hours worked by Employee#6:22 No of Hours worked by Employee#7:47 No of Hours worked by Employee#8:55 No of Hours worked by Employee#9:42 No of Hours worked by Employee#10:32 Enter No of hours worked :47 Employee#7 weekly salary :1075.13 Process exited after 32.87 seconds with returnvalue 0 Press any key to continue _

_______________Could you plz rate me well.Thank You

Add a comment
Know the answer?
Add Answer to:
C coding language is used. Write a program that declare parallel arrays for storing information about...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • in C++ Write a program which uses the following arrays: empID: An array of 7 integers...

    in C++ Write a program which uses the following arrays: empID: An array of 7 integers to hold employee identification numbers. The array should be initialized with the following values: 1, 2, 3, 4, 5, 6, 7. Hours: an array of seven integers to hold the number of hours worked by each employee. payRate: an array of seven doubles to hold each employee’s hourly pay rate. Wages: an array of seven doubles to hold each employee’s gross salary. The program...

  • Program Description: Write the pseudocode for a program that will calculate and display an employee’s gross...

    Program Description: Write the pseudocode for a program that will calculate and display an employee’s gross pay. Input the number of hours an employee worked for each of the 5 days of the week. Add them all up to get his hours worked for the week. Weekly Pay is calculated by adding an employee’s normal pay plus any overtime pay. Normal hours are paid at $10/hr. Any over time is paid at $15/hr. Any hours over 40 are considered overtime....

  • I hope some one can help me with the Python excercise (coding) Design a program that...

    I hope some one can help me with the Python excercise (coding) Design a program that uses the following parallel arrays: ● empId: An array of seven Integers to hold employee identification numbers. The array should be initialized with the following numbers: 56588 45201 78951 87775 84512 13028 75804 ● hours: An array of seven Integers to hold the number of hours worked by each employee. ● payRate: An array of seven Reals to hold each employee’s hourly pay rate....

  • Write a java program that specifies three parallel one dimensional arrays name length, width, and area....

    Write a java program that specifies three parallel one dimensional arrays name length, width, and area. Each array should be capable of holding a number elements provided by user input. Using a for loop input values for length and width arrays. The entries in the area arrays should be the corresponding values in the length and width arrays (thus, area[i] =   length [i]* width [i]) after data has been entered display the following output: (in Java)

  • Storing the Array: Write an application that uses an Array to store 10messages of type String....

    Storing the Array: Write an application that uses an Array to store 10messages of type String. You will store this Array with 10 messages of your choosing. For example, a message could be “I love Java the programming language!” or another message could be “I love Java the drink!” Initializing the Array: You may initialize your Array with the messages or have the user enter the messages. The choice is yours. Your Java code will contain a method called shoutOutCannedMessage()...

  • For c++ Write a complete C++ program and declare 2 arrays type double size 5. The...

    For c++ Write a complete C++ program and declare 2 arrays type double size 5. The name of the first array is Salary and the name of the second array is Tax. Use a for loop loop and enter 5 salaries type double into array Salary. Then multiply each element of array Salary by .10 (10 percent), and save the result into array Tax. Print/display the content of both arrays. Hint: the content of array Tax is 10% percent of...

  • Visual C# C# Visual Studio 2017 You are to create a class object called “Employee” which included eight private variable...

    Visual C# C# Visual Studio 2017 You are to create a class object called “Employee” which included eight private variables - firstN - lastN - idNum -wage: holds how much the person makes per hour -weekHrsWkd: holds how many total hours the person worked each week. - regHrsAmt: initialize to a fixed amount of 40 using constructor. - regPay - otPay After going over the regular hours, the employee gets 1.5x the wage for each additional hour worked. Methods: -...

  • Q1. Write a program in Java         a. Create 2 separate arrays, of user defined values,...

    Q1. Write a program in Java         a. Create 2 separate arrays, of user defined values, of same size         b. Add these 2 arrays. ........................................................................................................................... Q2. Write a program in java (using loop) input any10 numbers from user and store in an array. Check whether each of array element is positive, negative, zero, odd or even number. ............................................................................................................................ Q3. Write a program in Java to display first 10 natural numbers. Find the sum of only odd numbers. .............................................................................................................................. Q4....

  • In C language 1. Write a program to declare and initialize an array of size 5...

    In C language 1. Write a program to declare and initialize an array of size 5 and place odd numbers 3, 5, 7,9 and 11 in it. Declare and initialize another array of size 5 and place even numbers 4, 6, 8, 10 and 12 in it. Write a for loop to add each element and place it in a third array of the same dimensions. Display each array.

  • #PLEASE WRITE THE CODE IN JAVA! THANK YOU IN ADVANCE! Write a program that manages a...

    #PLEASE WRITE THE CODE IN JAVA! THANK YOU IN ADVANCE! Write a program that manages a list of up to 10 players and their high scores in the computer's memory. Use two arrays to manage the list. One array should store the players' names, and the other array should store the players' high scores. Use the index of the arrays to correlate the names with the scores. Your program should support the following features: a. Add a new player and...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT