Question Solved1 Answer I WANT TO CODES AND UML DIAGRAM Design a class named MyInteger. The class contains: An int data field named value that stores the int value represented by this object. A constructor that creates a MyInteger object for the specified int value. A get method that returns the int value. Methods isEven(), isOdd(), and isPrime() that return true if the value is even, odd, or prime, respectively. Static methods isEven(int), isOdd(int), and isPrime(int) that return true if the specified value is even, odd, or prime, respectively. Static methods isEven(MyInteger), isOdd(MyInteger), and isPrime(MyInteger) that return true if the specified value is even, odd, or prime, respectively. Methods equals(int) and equals(MyInteger) that return true if the value in the object is equal to the specified value. A static method parseInt(char[]) that converts an array of numeric characters to an int value. A static method parseInt(String) that converts a string into an int value. Draw the UML diagram for the class. Implement the class. Write a client program that tests all methods in the class. Draw the UML class diagram.

O6WZ1Q The Asker · Computer Science

I WANT TO CODES AND UML DIAGRAM

Design a class named MyInteger. The class contains:

  • An int data field named value that stores the int value represented by this object.
  • A constructor that creates a MyInteger object for the specified int value.
  • A get method that returns the int value.
  • Methods isEven(), isOdd(), and isPrime() that return true if the value is even, odd, or prime, respectively.
  • Static methods isEven(int), isOdd(int), and isPrime(int) that return true if the specified value is even, odd, or prime, respectively.
  • Static methods isEven(MyInteger), isOdd(MyInteger), and isPrime(MyInteger) that return true if the specified value is even, odd, or prime, respectively.
  • Methods equals(int) and equals(MyInteger) that return true if the value in the object is equal to the specified value.
  • A static method parseInt(char[]) that converts an array of numeric characters to an int value.
  • A static method parseInt(String) that converts a string into an int value.

Draw the UML diagram for the class. Implement the class. Write a client program that tests all methods in the class.

Draw the UML class diagram.

More
See Answer
Add Answer +20 Points
Community Answer
TOH6GI The First Answerer
See all the answers with 1 Unlock
Get 4 Free Unlocks by registration

Solution :: I have implemented the code MyInteger and Main display the result as per the given description. PLEASE FIND THE FOLLOWING CODE SCREENSHOT/OUTPUT AND CODE ANY CLARIFICATIONS REQUIRED TO LEAVE A COMMENT CODE SCREENSHOT: 蛔 Main.java xx MyInteger.java xx ------------------------------------------------------------ OUTPUT: Output - Mylnteger (run)run:First MyInteger : 234IsEven : trueIsodd : falseIsPrime : falseSecond MyInteger : 233IsEven : falseIsOdd : trueIsPrime : trueBUILD SuCCESSFUL (total time: 1 second) CODE: Main.java public class Main { public static void main(String[] args) { MyInteger mi1=new MyInteger(234); MyInteger mi2=new MyInteger(233); System.out.println("First MyInteger : "+mi1.getData()); System.out.println("IsEven : "+mi1.isEven()); System.out.println("IsOdd : "+mi1.isOdd()); System.out.println("IsPrime : "+mi1.isOdd()); //testing the static method System.out.println("Second MyInteger : "+mi2.getData()); System.out.println("IsEven : "+MyInteger.isEven(mi2)); System.out.println("IsOdd : "+MyInteger.isOdd(mi2)); System.out.println("IsPrime : "+MyInteger.isOdd(mi2)); } } MyInteger.java public class MyInteger { private int data; public MyInteger(int data) { this.data = data; } public int getData() { return data; } public boolean isEven(){ return this.data%2== ... See the full answer