Question: Design a class MinMaxprime that has two private member variables that are prime ( Use the previous Prime class ) maxP and minP, where maxp
Design a class MinMaxprime that has two private member variables that are prime Use the previous Prime class maxP and minP, where maxp should always, at all times, be greater or equal to minP.
default constructor that sets both to default Prime
A constructor that accepts one Prime and sets both to that Prime
A constructor that accepts an integer and sets both to that integer or the prime close to it
A constructor that accepts two Primes and sets maxP to the largest and minP to smallest
A constructor that accepts two integers and sets maxP to the largest and minP to the smallest after creating the Primes getters. getMaxP getMinPthese return Prime objects int getMaxPValue int getMinPValuethese return the value as in Setters. If you try to set minP to a Prime greater than maxP, then maxP should be set to that Prime and minP should be set to maxP. example: minP is maxp is you try to set minP to then maxp becomes and minP will be will be set to the new value.
tostring
equals
method add that a accepts an integer and returns a MaxMin object with both maxp and minP increase by at least the integer use add method used in prime
method add that accepts a Prime object and adds it to both maxP and minP
A method add that accepts two Prime objects and adds the largest to maxp and the smallest to minP.
Tester to test every constructor and method in this class.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
