Question

Java Question 1. Create a POJO Class (Employee) with these properties: i. ID ii. Age iii....

Java Question

1. Create a POJO Class (Employee) with these properties:

i. ID

ii. Age

iii. Name

2. Write the class to read into the memory. (Reader to read into the memory).

3. Write a Junit test for the Employee class.

Homework Answers

Answer #1

Employee Class:


class employee// class as asked
{
    public String id;
    public int age;
    public String name;
    
    employee(String id, int age, String name)
    {
        this.id=id;
        this.name=name;
        this.age=age;
    }
    
    
    public static void main (String[] args) throws Exception// main program that test the class 
    {
        employee e=new employee("12345",21,"Jack");
        String name="Jack";
        String id="12345";
        Integer age=21;
        System.out.println(name.equals(e.name));
        System.out.println(id.equals(e.id));
        System.out.println(age.equals(e.age));
    }
}

Junit Test:

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
This program is in C++: Write a program to allow the user to: 1. Create two...
This program is in C++: Write a program to allow the user to: 1. Create two classes. Employee and Departments. The Department class will have: DepartmentID, Departmentname, DepartmentHeadName. The Employee class will have employeeID, emploeename, employeesalary, employeeage, employeeDepartmentID. Both of the above classes should have appropriate constructors, accessor methods. 2. Create two arrays . One for Employee with the size 5 and another one for Department with the size 3. Your program should display a menu for the user to...
In C++ Employee Class Write a class named Employee (see definition below), create an array of...
In C++ Employee Class Write a class named Employee (see definition below), create an array of Employee objects, and process the array using three functions. In main create an array of 100 Employee objects using the default constructor. The program will repeatedly execute four menu items selected by the user, in main: 1) in a function, store in the array of Employee objects the user-entered data shown below (but program to allow an unknown number of objects to be stored,...
Write the following problem in Java Create a class Dog, add name, breed, age, color as...
Write the following problem in Java Create a class Dog, add name, breed, age, color as the attributes. You need to choose the right types for those attributes. Create a constructor that requires no arguments. In this constructor, initialize name, breed, age, and color as you wish. Define a getter and a setter for each attribute. Define a method toString to return a String type, the returned string should have this information: “Hi, my name is Lucky. I am a...
QUESTION 1: This question is also to be used for the next question. Design an Employee...
QUESTION 1: This question is also to be used for the next question. Design an Employee class for a hotel for use in programs. We need an Employee object with these attributes: Name Designation (ex. Manager, Supervisor, Waiter, Bellhop, etc.) ID number Some details: ID Numbers should already be known at time of object's creation. Assume it is an 8 digit number. The ID Number can never be changed Use strings to represent the Name and Designation It is possible...
Create a class Student with the states (attributes): Name, address, phone number, Student ID. Also define...
Create a class Student with the states (attributes): Name, address, phone number, Student ID. Also define the behavior of student as learn, perform assignment, read, attendance, do presentation (Exemple: My name is {Name}). After that create 3 instances of the class Student and present the instance (My name is .....)  
JAVA Question a) Read a file named testScoreIn.txt representing test scores for a class of students....
JAVA Question a) Read a file named testScoreIn.txt representing test scores for a class of students. Each record contains an id number and three test scores (Note: the test scores are integers). For example, a student record might look like: BK1234 87 72 91 b) Without using an array, read each student’s information, one record at a time and compute the student’s average (as a double). c) Write to an output file, testScoreOut.txt, as a neatly formatted table with column...
Create a class called Employee that contains three instance variables (First Name (String), Last Name (String),...
Create a class called Employee that contains three instance variables (First Name (String), Last Name (String), Monthly Salary (double)). Create a constructor that initializes these variables. Define set and get methods for each variable. If the monthly salary is not positive, do not set the salary. Create a separate test class called EmployeeTest that will use the Employee class. By running this class, create two employees (Employee object) and print the annual salary of each employee (object). Then set the...
Java programming. Fill the empty boxes with the Answer. 1) The Java compiler javac translates Java...
Java programming. Fill the empty boxes with the Answer. 1) The Java compiler javac translates Java source code into [Answer]. 2) In Java a class object can inherit the properties of a superclass by using the [Answer] keyword. 3) A(n) [Answer] method consists of the same method name but different number or types of parameters 4) In a class definition, the special method that is called to create an instance of that class is known as a/an [Answer] 5) The...
Java Create a new Drive class. * Create a Menu class. * The menu class will...
Java Create a new Drive class. * Create a Menu class. * The menu class will use the previous 4 classes you created in GCD, LCM, FACTORIAL, DIGITS The Menu will display a menu that give you the option of selecting: 1) Greatest Common Denominator 2) Lowest Common Multiple 3) Factorial 4) Number of Digits in an Integer Enter 1,2,3 or 4: When the User enter the choice, then the correct function/method is called for the class and asks the...
Use Java To(with Explaination of Steps Please): You’re given a class Employee that represents a worker...
Use Java To(with Explaination of Steps Please): You’re given a class Employee that represents a worker in some unknown industry.Each employee has a name , balance and an hourly rate that is unique to them. So Worker1 can have a rate of $5 per hour and Worker2 can have $8 per hour. There are 2 constructors – one that lets you specify the name, a starting balance and the rate,and another that only lets you specify the name and rate...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT