1. Engineering
  2. Computer Science
  3. requirements 1 write a simple class named lengthconverter which converts...

Question: requirements 1 write a simple class named lengthconverter which converts...

Question details

Requirements 1. Write a simple class named LengthConverter which converts kilometers to miles and vice versa (1 kilometer 0.621371192 miles). It has the following two methods public double kmToMile(double km) public double mileToKm(double mile) If the argument is negative, an lllegalArgumentException should be thrown. 2. Write a JUnit test named LengthConverterTest to test both methods of LengthConverter. Results within 0.0001 (km or mile) of the expected results will be accepted. You should include test cases that test both valid and invalid input conditions. 3. Use Eclipse IDE to compile and run the JUnit test.

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution