Java程序辅导

C C++ Java Python Processing编程在线培训 程序编写 软件开发 视频讲解

客服在线QQ:2653320439 微信:ittutor Email:itutor@qq.com
wx: cjtutor
QQ: 2653320439
CSCE 270, Data Structures -- Lab #2 Computer Science & Computer Engineering 270 Laboratory #2 Objectives: Review basic Java, arrays, loops, file I/O, and Javadoc. Gain familiarity with Eclipse and JUnit testing. Gain more familiarity with UML diagrams and superclass / subclass hierarchy, abstract classes, and inheritance. Learn how to implement the Comparable< Employee > interface. Overview: My friend runs a small business with a large number of employees. Some of the employees are paid by the hour and some are salaried employees. At the moment all the employee records are stored in a text file that is cumbersome to use and maintain. I have designed a Java program for her that you are going to implement. I will give you the code for the classes Employee, EmployeeDB, and the JUnit test classes needed to test HourlyEmp, SalariedEmp, and EmployeeDB. You will implement three classes, HourlyEmp and SalariedEmp, and EmployeeDB. Most of the methods in EmployeeDB are stubbed out, but I have written the method readFile(fileName). The classes Employee, HourlyEmp, and SalariedEmp were discussed in class and the UML diagram for all the classes is given below. There are Javadoc comments for all the methods and you can use those Javadoc comments in the classes HourlyEmp and SalariedEmp. The toString() method will return a string that has the fields in the format needed for reading (and writing) from a text file. The fields payRate and annualSalary must have exactly two digits after the decimal (e.g., 15.50). Hint: Use String.format(). Before the Lab: Create a project for this lab (e.g., Lab2). Import the classes Employee and EmployeeDB into your project. Create the subclasses HourlyEmp and SalariedEmp that extend the abstract class Employee. Stub out all the methods in the UML diagram. If a method you stub out returns a value just return 0 or null. Add javadoc comments for all the methods. At the beginning of lab show your Eclipse project to the lab TA or the instructor. During the Lab: Import the JUnit test classes into your Eclipse project. Don't worry about the errors. We will fix them. Implement the classes HourlyEmp and SalariedEmp, and use the JUnit test classes to verify that your code is correct. Implement the compareTo(e Employee) method inside the class Employee Read through the code and documentation for EmployeeDB. The class has two private fields employees and numEmp. The array employees will hold all the Employee objects and numEmp will equal the number of Employee objects. Implement each method in class EmployeeDB according to the given documentation. Use the JUnit tests to check your code. You may wish to add more JUnit tests. After the Lab: Finish implementing, documenting, and testing the classes. Submission Instructions: See the class website for details on submitting your lab assignment, and other important requirements. Labs