Maurice Tutor

(5)

$15/per page/Negotiable

About Maurice Tutor

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Algebra,Applied Sciences See all
Algebra,Applied Sciences,Biology,Calculus,Chemistry,Economics,English,Essay writing,Geography,Geology,Health & Medical,Physics,Science Hide all
Teaching Since: May 2017
Last Sign in: 398 Weeks Ago, 4 Days Ago
Questions Answered: 66690
Tutorials Posted: 66688

Education

  • MCS,PHD
    Argosy University/ Phoniex University/
    Nov-2005 - Oct-2011

Experience

  • Professor
    Phoniex University
    Oct-2001 - Nov-2016

Category > Computer Science Posted 13 Jul 2017 My Price 15.00

My Integer object

Design a class named MyInteger. The class contains:
A????1 An int instance variable named value that stores the int value represented by the object.
A????1 A constructor that creates a MyInteger object for the specified int value.
A????1 A get method that returns the int value.
A????1 Static methods isEven(int), isOdd(int) and isPrime(int) that return true if the specified value is odd, even, or
prime, respectively, and false otherwise.
A????1 Methods isEven(), isOdd(), and isPrime() that return true if the value in this object is even, odd or prime,
respectively, and false otherwise.
A????1 Static methods isEven(MyInteger), isOdd(MyInteger) and isPrime(MyInteger) that return true if the value of
the specified object is even, odd, or prime, respectively, and false otherwise.
A????1 Method equals(int) that returns true if the value in this object is equal to the specified integer.
A????1 Method equals(MyInteger) that return true if the value in this object is equal to the value in another object.
A????1 Static method parseInt(char[]) that converts an array of numeric characters to an int value.
A????1 Static method parseInt(String) that converts a string into an int value.
Note: if c is a character from A????10A????1 to A????19A????1, then (int)c-48 converts c to an integer value.
You may assume that the user enters only digits.
HereA????1s a demo class that tests the above methods and the output. Use a similar demo class.
public class MyIntegerDemo
{
public static void main(String[] args)
{
MyInteger n1 = new MyInteger(5);
System.out.println("n1 is " + n1.getValue());
System.out.println("n1 is even? " + n1.isEven());
System.out.println("n1 is odd? " + n1.isOdd());
System.out.println("n1 is prime? " + n1.isPrime());
System.out.println("15 is prime? " + MyInteger.isPrime(15));
char[] chars = {'3','5','3','9'};
System.out.println(MyInteger.parseInt(chars));
String s = "9786";
System.out.println(MyInteger.parseInt(s));
MyInteger n2 = new MyInteger(24);
System.out.println("n2 is " + n2.getValue());
System.out.println("n2 is odd? " + n2.isOdd());
System.out.println("45 is odd? " + MyInteger.isOdd(45));
System.out.println("n1 is equal to n2? " + n1.equals(n2));
System.out.println("n1 is equal to 5? " + n1.equals(5));
}
}
----jGRASP exec: java -ea MyIntegerDemo
n1 is 5
n1 is even? false
n1 is odd? true
n1 is prime? true
15 is prime? false
3539
9786
2 is 24
n2 is odd? false
45 is odd? true
n1 is equal to n2? false
n1 is equal to 5? true
----jGRASP: operation complete.

Answers

(5)
Status NEW Posted 13 Jul 2017 01:07 PM My Price 15.00

Hel-----------lo -----------Sir-----------/Ma-----------dam----------- Â----------- Th-----------ank----------- Yo-----------u f-----------or -----------usi-----------ng -----------our----------- we-----------bsi-----------te -----------and----------- ac-----------qui-----------sit-----------ion----------- of----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill-----------

Not Rated(0)