Computer Applications
A security agency pays to their staff as per the tariff given below:
| Hours | Rate |
|---|---|
| For first 48 hours in a week | ₹1000 per hour |
| For next 8 hours in a week | ₹1250 per hour |
| For further hours in a week | ₹1500 per hour |
Write a program in Java to calculate the weekly wages of the staff taking number of hours worked in a week as input.
Answer
import java.util.Scanner;
public class KboatSecurityAgency
{
public static void main(String args[]) {
Scanner in = new Scanner(System.in);
System.out.print("Enter no. of hours: ");
int hr = in.nextInt();
double wage = 0;
if (hr <= 48) {
wage = hr * 1000;
}
else if (hr <= 56) {
wage = (48 * 1000) + ((hr - 48) * 1250);
}
else {
wage = (48 * 1000) + (8 * 1250) + ((hr - 56) * 1500);
}
System.out.println("Weekly Wage = " + wage);
}
}Output
Related Questions
An air-conditioned bus charges fare from the passengers based on the distance travelled as per the tariff given below:
Distance Travelled Fare Up to 10 km Fixed charge ₹80 11 km to 20 km ₹6/km 21 km to 30 km ₹5/km 31 km and above ₹4/km Design a program to input distance travelled by the passenger. Calculate and display the fare to be paid.
A triangle is said to be an 'Equable Triangle', if the area of the triangle is equal to its perimeter. Write a program to enter three sides of a triangle. Check and print whether the triangle is equable or not.
For example, a right angled triangle with sides 5, 12 and 13 has its area and perimeter both equal to 30.Using the switch-case statement, write a menu driven program to do the following:
(a) To generate and print Letters from A to Z and their Unicode
Letters Unicode A 65 B 66 . . . . . . Z 90 (b) Display the following pattern using iteration (looping) statement:
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5