Question: does anyone know the java program, and the uml diagram for the following: Part 2 Design, by creating a UML diagram, a class named MyInteger.
does anyone know the java program, and the uml diagram for the following:
Part 2
Design, by creating a UML diagram, 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 with the passed int value.
A get method that returns the int value.
The instance 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 value 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 instance methods equals(int) and equals(MyInteger) that return true if the value 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.
Create a UML diagram that shows the MyInteger class, its attributes and methods. The UML diagram should be drawn using the UMLet drawing tool. The diagram should be exported as an image and then imported into a word processing document as demonstrated in class.
The file should be an PDF formatted file and be named Unit05_.pdf, for example Unit05_sdoe.pdf. Any word processor can save or export to PDF.
Once your UML diagram is complete implement the class naming the Java file MyInteger.java. Create another Java file, a program named MyIntegerTester.java that tests all methods in the MyInteger class by creating a MyInteger object with a value, then calling all the methods and checking that they do what they are supposed to do. You can "wire in" the test data, no need to prompt the user for anything. One technique is to write both classes at the same time. As much as possible you implement and test one method at a time. This minimized the amount of new code you have to look at when debugging a method. Only the tester file will have main() method in it.
Here is a sample run of what the output of MyIntegerTester might look like.
Tests use MyInteger n1 object constructed with MyIneger(5)
Testing equals(int), n1 and 6: false
Testing equals(MyInteger), n1 and n2 = 7: false
Testing isEven(), n1 which is 5, is even? false
Testing isOdd(), n1 which is 5, is odd? true
Testing static isPrime(), n1 which is 5, is prime? true
Testing instance isPrime(), 5 is prime? true
Next two tests use char[] and Sring data of 3539
Testing parseInt(char[]): 3539
Testing parseInt(String)Passing: 3539 X
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
