- Home
- Chapter 1 - Object Oriented Programming Concepts
- Object Oriented Programming Concepts
- Multiple Choice Questions
- State whether the given statements are True or False
- Assignment Questions
- Chapter 2 - Introduction to Java
- Introduction to Java
- Multiple Choice Questions
- Assignment Questions
- Chapter 3 - Values and Data Types
- Values and Data Types
- Multiple Choice Questions
- State whether the given statements are True or False
- Assignment Questions
- Chapter 4 - Operators in Java
- Operators in Java
- Multiple Choice Questions
- State whether the given statements are True or False
- Assignment Questions
- Chapter 5 - User-Defined Methods
- User-Defined Methods
- Multiple Choice Questions
- State whether the given statements are True or False
- Assignment Questions
- Chapter 6 - Input in Java
- Input in Java
- Multiple Choice Questions
- Assignment Questions and Programs
- Chapter 7 - Mathematical Library Methods
- Mathematical Library Methods
- Multiple Choice Questions
- Assignment Questions
- Chapter 8 - Conditional Constructs in Java
- Conditional Constructs in Java
- Multiple Choice Questions
- Assignment Questions and Programs
- Chapter 9 - Iterative Constructs in Java
- Iterative Constructs in Java
- Multiple Choice Questions
- State whether the given statements are True or False
- Assignment Questions and Programs
- Chapter 10 - Nested for loops
- Nested for loops
- Assignment Questions and Programs
- Chapter 11 - Constructors
- Constructors
- Multiple Choice Questions
- Assignment Questions and Programs
- Chapter 12 - Library Classes
- Library Classes
- Multiple Choice Questions
- Assignment Questions
- Chapter 13 - Encapsulation and Inheritance
- Library Classes
- Multiple Choice Questions
- Assignment Questions
- Chapter 14 - Arrays
- Library Classes
- Multiple Choice Questions
- Assignment Questions
- Chapter 15 - String Handling
- Library Classes
- Multiple Choice Questions
- Assignment Questions
Conditional Constructs in Java
Chapter 8
Conditional Constructs in Java
Class 10 - Logix Kips ICSE Computer Applications with BlueJ
![]() Share with a Friend |
Java Program: Compute the wages of the Employees
26. Employees at Arkenstone Consulting earn the basic hourly wage of Rs.500. In addition to this, they also receive a commission on the sales they generate while tending the counter. The commission given to them is calculated according to the following table:
|
Total Sales |
Commmision Rate |
|
Rs. 100 to less than Rs. 1000 |
1% |
|
Rs. 1000 to less than Rs. 10000 |
2% |
|
Rs. 10000 to less than Rs. 25000 |
3% |
|
Rs. 25000 and above |
3.5% |
Write a program in Java that inputs the number of hours worked and the total sales. Compute the wages of the employees.
import java.util.Scanner;
public class EmployeeWages {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int hoursWorked;
double totalSales, commission = 0, wages;
System.out.print("Enter number of hours worked: ");
hoursWorked = sc.nextInt();
System.out.print("Enter total sales (Rs.): ");
totalSales = sc.nextDouble();
// Calculate commission based on sales
if (totalSales >= 100 && totalSales < 1000) {
commission = 0.01 * totalSales;
} else if (totalSales >= 1000 && totalSales < 10000) {
commission = 0.02 * totalSales;
} else if (totalSales >= 10000 && totalSales < 25000) {
commission = 0.03 * totalSales;
} else if (totalSales >= 25000) {
commission = 0.035 * totalSales;
}
// Calculate total wages
wages = (hoursWorked * 500) + commission;
System.out.println("\nCommission Earned: Rs. " + commission);
System.out.println("Total Wages: Rs. " + wages);
}
}
Output
Sample Output Enter number of hours worked: 8 Enter total sales (Rs.): 12000 Commission Earned: Rs. 360.0 Total Wages: Rs. 4360.0
✅ Explanation
- Basic wage is calculated as:
hoursWorked × 500
- Commission is calculated based on the applicable sales slab.
- Total wages =
Basic Wage + Commission
- if-else-if ladder is used to apply the correct commission rate.
