Answered step by step
Verified Expert Solution
Question
1 Approved Answer
10.3) (The MyInteger class) Design a class named MyInteger. The class contains: An int data field named yalue that stores the int yalue represented by
10.3) (The MyInteger class) Design a class named MyInteger. The class contains: An int data field named yalue that stores the int yalue represented by this object. A constructor that creates a MyInteger object for the specified int value. A getter method that returns the int value *The methods isEven, isOdd, and isPrime) that return true if the value in this object is even, odd, or prime, respectively The static methods isEven (int), isOdd int), and isPrime(int) that return true if the specified yalue is even, odd, or prime, respectively The static methods isEven(MyInteger), isOdd(MyInteger), and isPrime(MyInteger) that return true if the specified value is even, odd,or prime, respectively * The methods equals (int) and equals(MyInteger) that return true if the yalue in this 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 and then implement the class. Write a client program that tests all methods in the class. Given that the definition of a prime number is a positive integer be sure to instruct the use to only enter positive integers SAMPLE RUN #1 -. Prompts For Keyboard/Console/Standard Input Enter a positive integer to create a MyInteger object or to move on to next part of program Enter a positive integer to test static isXXX(int) methods or to move on to next part of program Enter a positive integer to test static isXXX(MyInteger) methods or to move on to next part of program: Enter a the first of two positive integers to create obj2 and test obj2.equals(int) or to move on to next part of program Enter a the second of two positive integers to test obj2.equals(int): Enter a the first of two positive integers to create obj2 and test obj2.equals(MyInteger obj3) or to move on to next part of program: Enter a the second of two positive integers to create obj3 and test obj2.equals(MyInteger obj3) Enter a positive integer that will be placed into a char array to demonstrate the MyInteger.parseInt (char]): Enter a positive integer that will be placed into a String to demonstrate the MyInteger parseInt(String): 10.3) (The MyInteger class) Design a class named MyInteger. The class contains: An int data field named yalue that stores the int yalue represented by this object. A constructor that creates a MyInteger object for the specified int value. A getter method that returns the int value *The methods isEven, isOdd, and isPrime) that return true if the value in this object is even, odd, or prime, respectively The static methods isEven (int), isOdd int), and isPrime(int) that return true if the specified yalue is even, odd, or prime, respectively The static methods isEven(MyInteger), isOdd(MyInteger), and isPrime(MyInteger) that return true if the specified value is even, odd,or prime, respectively * The methods equals (int) and equals(MyInteger) that return true if the yalue in this 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 and then implement the class. Write a client program that tests all methods in the class. Given that the definition of a prime number is a positive integer be sure to instruct the use to only enter positive integers SAMPLE RUN #1 -. Prompts For Keyboard/Console/Standard Input Enter a positive integer to create a MyInteger object or to move on to next part of program Enter a positive integer to test static isXXX(int) methods or to move on to next part of program Enter a positive integer to test static isXXX(MyInteger) methods or to move on to next part of program: Enter a the first of two positive integers to create obj2 and test obj2.equals(int) or to move on to next part of program Enter a the second of two positive integers to test obj2.equals(int): Enter a the first of two positive integers to create obj2 and test obj2.equals(MyInteger obj3) or to move on to next part of program: Enter a the second of two positive integers to create obj3 and test obj2.equals(MyInteger obj3) Enter a positive integer that will be placed into a char array to demonstrate the MyInteger.parseInt (char]): Enter a positive integer that will be placed into a String to demonstrate the MyInteger parseInt(String)
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