Question: EMath.java /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates *
EMath.java /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package emath; /** * Homework 02.2: Unit Testing with NetBeans and JUnit * @author Dr. Jose Poveda */ public class EMath { public static int absolute(String s1){ int number=Integer.parseInt(s1); return((number>0)? number: -number); } public static int modulo(String sa, String sb){ int a=absolute(sa); int b=absolute(sb); return(a-(a/b)*b); } public static int gcd(String sa, String sb){ int numA=absolute(sa); int numB=absolute(sb); while (numA != numB) { if (numB > numA) numB -=numA; else numA -=numB; } return (numA); } }
Homework 5 We are interested in testing the performance of the static class EMath with the following public interface; +gcd(String x, String y): int, NumberFormatException +absolute(String x): int, NumberFormatException +module(String x, String y ): int, ArithmeticException, NumberFormatException Where the member methods of the class; gcd(x, y) returns the greatest common divisor of the integer numbers x and y, or exception. absolute(x) returns the absolute value of x, or exception modulo(x, y) returns x modulus y, or exception. Develop a bank of test using the tools NetBeans and JUnit for testing the right performance of Java objects of the class EMath. Concepts in practice: Unit Testing with NetBeans and JUnit. Files to be used: EMath.java
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts

EMath.java /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package emath; /** * Homework 02.2: Unit Testing with NetBeans and JUnit * @author Dr. Jose Poveda */ public class EMath { public static int absolute(String s1){ int number=Integer.parseInt(s1); return((number>0)? number: -number); } public static int modulo(String sa, String sb){ int a=absolute(sa); int b=absolute(sb); return(a-(a/b)*b); } public static int gcd(String sa, String sb){ int numA=absolute(sa); int numB=absolute(sb); while (numA != numB) { if (numB > numA) numB -=numA; else numA -=numB; } return (numA); } }