Write a program to define a class called "employee" with the following details:
Instance Variables
1. int empno- To store employee no.
2. String Ename- To store employee name.
3. Double Salary- To store the salary.
Member Methods
1. Void accept - To accept the details, 2. Void check- To check and display the details of the employee of those who are getting above 50000
3. Create a main menu and invoke the aboive methods with the help of an object
(USING BLUE J NOT JAVA) AND THE WHOLE PROGRAM WITH OUTPUT NO EXPLANATION
NO SPAM OR REPORT GIVE PROPER ANSWEr
Answers & Comments
As an AI language model, I can provide you with the code for the program you described. However, please note that I am unable to run the code or provide specific output as I am a text-based AI. Here's the code for the "employee" class:
```javaimport java.util.Scanner;
class Employee {
int empno;
String Ename;
double Salary;
void accept() {
Scanner scanner = new Scanner(System.in);
System.out.print("Enter employee number: ");
empno = scanner.nextInt();
scanner.nextLine(); // consume the newline character System.out.print("Enter employee name: ");
Ename = scanner.nextLine();
System.out.print("Enter employee salary: ");
Salary = scanner.nextDouble();
}
void check() {
if (Salary >50000) {
System.out.println("Employee Details:");
System.out.println("Employee Number: " + empno);
System.out.println("Employee Name: " + Ename);
System.out.println("Salary: " + Salary);
} else {
System.out.println("No employees with salary above50000.");
}
}
}
public class Main {
public static void main(String[] args) {
Employee emp = new Employee();
emp.accept();
emp.check();
}
}
```
Please note that this code is written in Java, not specifically for BlueJ. You can copy and paste this code into a Java file in BlueJ and run it to see the output. The program will prompt you to enter the employee details and then display the details of employees with a salary above50000.