webtech_6[1]
webtech_6[1]
EXPERIMENT -06
Create a Java Bean for Employee information (EmpID, Name, Salary,
Designation and Department).
CODE:
import java.util.Scanner;
// Private attributes
private int empID;
private String name;
private double salary;
private String designation;
private String department;
// Default constructor
public Employee() {}
// Parameterized constructor
public Employee(int empID, String name, double salary, String designation,
String department) {
this.empID = empID;
this.name = name;
this.salary = salary;
this.designation = designation;
(GEETIKA AHUJA 2200271690021)
this.department = department;
}
if (choice.equalsIgnoreCase("yes")) {
System.out.println("What would you like to update?");
System.out.println("1. EmpID");
System.out.println("2. Name");
System.out.println("3. Salary");
System.out.println("4. Designation");
System.out.println("5. Department");
System.out.print("Enter your choice (1-5): ");
switch (updateChoice) {
case 1:
(GEETIKA AHUJA 2200271690021)
} else {
System.out.println("Thank you! No changes made.");
}
scanner.close();
(GEETIKA AHUJA 2200271690021)
(GEETIKA AHUJA 2200271690021)