Question
W e are interested in testing the performance of the static class EMath with the following public interface; + gcd(String x, String y): int, NumberFormatException
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.
---------------o----------o---------------
Files to be used: EMath.java
Files to deliver: EMathTestingProject.zip //------------------------------------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 */ 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); } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started