Question: Hello, Who can help me with this? Project: The MyInteger Class Problem is same as we have done in class. Problem Description: Design a class

Hello, Who can help me with this?

Project: The MyInteger Class

Problem is same as we have done in class.

Problem Description:

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
  • A get method that returns the int
  • 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.
  • Method equals(int) that return true if the value in the object is equal to the specified value.

public class Exercise10_03 {

public static void main(String[] args) {

MyInteger n1 = new MyInteger(5);

System.out.println("n1 is even? " + n1.isEven());

System.out.println("n1 is prime? " + n1.isPrime());

System.out.println("n1 is prime? " + n1.isOdd());

}

}

class MyInteger {

// Implement your class here

}

Submit your MyInteger.java file

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!