A company has 100 employees who receive a monthly salary
ranged from 1000QR to 50000QR. We can represent the
employee by an array of 100 elements as follows:
double MonthS[100];
Q1: Write a for loop to fill-in the array with data.
Q2: Calculate the average salary of employees.
Q3: Find the employee number who gets the maximum salary.
Q4: Count the number of employees who gets a monthly salary
between 10000QR and 25000QR.
Q5: Decrease the salary of employees who receive the maximum
payment per month by 5000QR.
Q6: The array B represents the extra hours done by every
employee during the month. The rate per hour is 50QR for
those who get between 10000QR and 20000QR. It is 75QR
otherwise. Updated then the salary of all employees based on
the numbers of extra hours worked.
Q7: Print a histogram showing every employee number and
his/her salary.
Q8: Add a Bonus of 6.4% to every employee who worked more
than 15 extra hours in a month (Use the array B to find the extra
hours and update then the Array A).
Ola Loay
0
Newbie Poster
Recommended Answers
Jump to PostStart at the beginning.
Q1: Write a for loop to fill-in the array with data.
So write a program that creates the array, and when that is working, add a for loop to fill the array with data.
Do you know how to write an empty program that does nothing?
…
Jump to Post
MonthS[x]= 1000 && MonthS[x]<=50000;
This makes no sense. What are you trying to do?
Jump to PostYou have to tell it what number to put in each element of the array.
MonthS[x]= 1000
This puts the number 1000 into array element x. If you want each element to have a different number, you'll have to change that number for each element.
All 10 Replies
Moschops
683
Practically a Master Poster
Featured Poster
Ola Loay
0
Newbie Poster
Ola Loay
0
Newbie Poster
Moschops
683
Practically a Master Poster
Featured Poster
Ola Loay
0
Newbie Poster
Moschops
683
Practically a Master Poster
Featured Poster
Ola Loay
commented:
i have to write this 100 times ?
+0
Moschops
683
Practically a Master Poster
Featured Poster
Ola Loay
0
Newbie Poster
sneekula
969
Nearly a Posting Maven
Moschops
683
Practically a Master Poster
Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.