Question: PLEASE ANSWER ASAP 2. (15 points) Write a Java class named Posint, that represents positive integers, i.e., integers greater than 0, with the following behavior:

PLEASE ANSWER ASAP
2. (15 points) Write a Java class named Posint, that represents positive integers, i.e., integers greater than 0, with the following behavior: - An integer instance variable to contain the value - A constructor that accepts an integer argument that is assigned to the instance variable. If the argument passed is not positive, an Exception is thrown with the message "Constructor passed non-positive value". - A default constructor that initializes the value of the instance variable to 1 . For full credit. you must use the integer-argument constructor when implementing this method. - A copy constructor that accepts a Posint object and copies its values to the new (receiver) object. - A copy method that accepts a(nother) Posint argument and copies the argument to the receiver. The receiver is returned as the value of the function. - An addinplace method that accepts a(nother) Pos Int argument and adds the argument to the receiver. The receiver is returned as the value of the function. - An add method that accepts a(nother) Pos Int argument and returns the sum as a new Posint object. For full credit, you must leverage: - either addInPlace using add, or add using addInplace, - the copy constructor using the copy method
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
