Question: in java please Create a class that uses the interface Number formatter given below public interface NumberFormatter{ public String format (int n); } create a
in java please
Create a class that uses the interface Number formatter given below
public interface NumberFormatter{ public String format (int n);
}
create a child class called BaseFormatter that formats the number in base n where n is any number between 2 and 36 that is provided in the constructor. More specifically the baseFormatter class needs to pass these two test cases to asssert true given below
@Test public void baseFormatterTest() { try { NumberFormatter form = new BaseFormatter(0); fail("Formatter should not accept base less than 2"); } catch (Exception e) { assert true; } }
@Test public void baseFormatterTest2() { try { NumberFormatter form = new BaseFormatter(50); fail("Formatter should not accept base greater than 36"); } catch (Exception e) { assert true; }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
