Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started