Answered step by step
Verified Expert Solution
Link Copied!

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.
1- default constructor that sets both to default Prime
2- A constructor that accepts one Prime and sets both to that Prime
3 A constructor that accepts an integer and sets both to that integer or the prime close to it.
4- A constructor that accepts two Primes and sets maxP to the largest and minP to smallest
5- A constructor that accepts two integers and sets maxP to the largest and minP to the smallest (after creating the Primes)6 getters. getMaxP(), getMinP()(these return Prime objects), int getMaxPValue(), int getMinPValue()(these return the value as in 7- 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 7, maxp is 13 you try to set minP to 17, then maxp becomes 17 and minP will be 13.) will be set to the new value.
8- tostring
9- equals
10- 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).
11- 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.
13 Tester to test every constructor and method in this class.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL Antipatterns Avoiding The Pitfalls Of Database Programming

Authors: Bill Karwin

1st Edition

1680508989, 978-1680508987

More Books

Students also viewed these Databases questions

Question

What is the most important part of any HCM Project Map and why?

Answered: 1 week ago