Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java Code Example of J unit test and File I/O. Additionally, you have the opportunity to continue to build your JUnit testing skills (computer hacking

image text in transcribedimage text in transcribed

Java Code

image text in transcribed

Example of J unit test

image text in transcribed

and File I/O. Additionally, you have the opportunity to continue to build your JUnit testing skills (computer hacking skills will have to wait). Your Employee class should contain all the variables defined in the data file provided. Your Manager class should contain only a single class variable representing the number of employees that manager is responsible for. Make sure that Manager extends Employee so as to build the correct hierarchy. This aspect will not be utilized in this lab, but we may build on this lab later in the semester so this functionally could still be usefu... Design: Employee Class: .Needs to be the super class/parent of Manager .Should only contain class variable(s), constructor(s), and getters/setters Manager Class: .Should only contain class variable(s), constructor(s), and getters/setters Homework2 Class: .Should contain at least a single class variable to store all the employees Required methods are listed below. Packaging: Fully qualified class names are listed below: edu.ben.homeworks.homework2.Homework2.java edu.ben.homeworks.homework2.Homework2Test.java edu.ben.homeworks.homework2.Employee.java . edu.ben.homeworks.homework2.Manager.java Homework2 method signatures: Imports employee data from a CSV file (A sample has been provided on D2L) This method expects the file to have a header line. *@param importData File containing data, including a header line, in CSV format * @throws FileNotFoundException Thrown if the file does not exist public static void importEmployees (File importData) throws FileNotFoundException * Returns an array containing all the employee objects * Oreturn An array of Employee objects public static Employee[] getEmployeeRecords () * Returns the first employee object that matches the given parameter. This * method is case sensitive. * return The matching employee object or null if the name is not found public static Employee getEmployeeByFirstName (String firstName) * Returns the first employee object that matches the given parameter. This *method is case sensitive. * return The matching employee object or null if the name is not found public static Employee getEmployeeByLastName (String lastName) * Deletes all employee data currently stored in this class public static void deleteAllEmployees () Homework2.csv firstName,lastName,salarv.startDate Rohit,Sharma,78438.49,12/18/2019 Homeworko.java | D HomeworkOTest.java33 " in..in packagehomeworks. homeworke; 1 package e 3 public class Homeworke 5 public static void main(Stringll args) f homeworks. homeworke; 3+ import org. junit.Test: public class HomeworkeTest extends TestCase t System.out.print n("Helto wortd) @Test public void test) f String expected:,'"Hello, world! "; Homeworke.main nulu) String actual systemout.getHistory); assertEquals (expected, actua): 10 12 h 16

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Energen Corporation Energen Corporation

Answered: 1 week ago