/*QUESTION:
An employee gets paid (hours worked) × (basic pay), for each hour up
to 40 hours.
For every hour over 40, they get overtime = (basic pay) × 1.5. The
basic pay must not be less than the minimum wage ($8.00 an hour).
If it is, print an error.
If the number of hours is greater than 60, he is paid for 60 hours
Write a JAVA code to calculate for each of these employees:
Basic Pay Hours Worked
Employee 1 $7.50 35
Employee 2 $8.20 47
Employee 3 $10.00 73
Employee 4 $7.00 65. */
// ANSWER:
class Salary
{
public static void main(String[] args)
{
double basic[]={7.50,8.20,10.00,7.00};
int hr[]={35,47,73,65};
double sal[]={0.00,0.00,0.00,0.00};
for(int i=0;i<4;i++)
{
if(basic[i]<8.00)
{
System.out.println("\n ERROR, The basic pay
must not be less than the minimum wage ($8.00 an hour)");
}
else if(hr[i]>40&&hr[i]<=60)
{
int overtime=hr[i]-40;
total[i]=(basic[i]*40)+(overtime*basic[i]*1.5);
System.out.println(("Total Salary= "+total[i]+"$");
}
else if(hr[i]>60)
{
total[i]=(basic[i]*40)+(20*basic[i]*1.5);
System.out.println("Total Salary= "+total[i]+"$");
}
}
}
Subscribe to:
Post Comments (Atom)
Pro
https://drive.google.com/file/d/1II09HToizTTjISF5TlmGcc2ew_YxiFja/view?usp=drive_link
-
CLOUD COMPUTING - 1 by Dr. S K Nayak Table of Contents Syllabus Cloud c...
-
,Semester,Roll No,Regn No,Student Name,Mentor/faculty,Mentor Ph No,Mentor e Mail ,4th yr BTech,417001,2201105001,ABHILASH DEHURY,Prof S.N.Mi...
-
============================================= Lecture note, Monday 19 September 2016 07:00:48 AM IST ===================================...
No comments:
Post a Comment