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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!