Ask Question

Write the definition of a class employee base on the modular specification:. A data member for Id of type int (private). A data member for EmpName of type string (private). A data member for Salary of type double (private). A method to display the fields Id, EmpName, and Salary.

+4
Answers (1)
  1. 14 July, 15:05
    0
    public class Employee {

    private int id;

    private String empName;

    private double salary;

    public void displayEmployee () {

    System. out. print ("Employee ID: " + id + "/nEmployee name: " + empName + "/nSalary: " + salary);

    }

    }

    Explanation:

    - Declare the class variables

    - Write a method called displayEmployee to display the fields
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Write the definition of a class employee base on the modular specification:. A data member for Id of type int (private). A data member for ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers