This assignment requires a Java program to create two employee objects using user input (name, attendance rate, hours worked) and determine eligibility for a bonus based on the provided data.
Contribute Materials
Your contribution can guide someone’s learning journey. Share your
documents today.
import java.util.Scanner; public class EmployeeApp { //----------------------------------------------------------------- // Read input //----------------------------------------------------------------- public static void main (String[] args) { Scanner scan = new Scanner(System.in); String name; double attendanceRate; int hoursWorked; System.out.println("Employee1 name:"); name = scan.next(); System.out.println("Employee1 attendance rate:"); attendanceRate = scan.nextDouble(); System.out.println("Employee1 hours worked:"); hoursWorked = scan.nextInt(); //To-Do: Passing the user provided data (name, attendanceRate, hoursWorked) to the Employee constructor and create an employee object //For example, //Employee emp1 = new Employee(name, attendanceRate, hoursWorked); //To-Do: We need one more employee. So, repear the above steps (line 17-28) one more time
Secure Best Marks with AI Grader
Need help grading? Try our AI Grader for instant feedback on your assignments.
//To-Do: print the number of Employee objects created, display data for each, and specify whether each employee is eligible for bonus or not. scan.close(); } }