Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

Project (25% Final Exam Grade) Part1 (No submission needed): In Part1.cpp file, write a series of five functions that determine if a given positive integer is EVEN, ODD, PRIME, PERFECT and ABUNDANT....

1 answer below »
Project (25% Final Exam Grade)
Part1 (No submission needed):
In Part1.cpp file, write a series of five functions that determine if a given
positive integer is EVEN, ODD, PRIME, PERFECT and ABUNDANT. Each of these
functions should accept a single integer as an argument and return whether the
integer meets the criteria for that classification.
Below is the description of each function:
• Function name: is_even
• Function arguments: a positive integer
• Function processing: determines if the supplied number is even
• return value: boolean
• Function name: is_odd
• Function arguments: a positive integer
• Function processing: determines if the supplied number is odd
• return value: Boolean
• Function name: is_prime
• Function arguments: a positive integer
• Function processing: determines if the supplied number is prime. a prime number is a n
umber that only has two factors - the number 1 and itself. for example, 17 is prime be
cause it only has two factors (1 and 17).in order to determine this you might need to
count the # of factors between 1 and the number you are testing. a note on efficiency:
if you aretesting a number (say, 15) and you find a factor (say, 3) - do you need to e
ven continue to find additional factors?
• return value: Boolean
• Function name: is_perfect
• Function arguments: a positive integer
• Function processing: determines if the supplied number is perfect. a perfect number is
a number that is equal to the sum of its factors (i.e. the number 6 is perfect because
6 = XXXXXXXXXX)
• return value: Boolean
• Function name: is_abundant
• Function arguments: a positive integer
• Function processing: determines if the supplied number is abundant. an abundant number
is a number that is less than the sum of its factors (i.e. the number 12 is abundant
ecause 12 < XXXXXXXXXX)
• return value: boolean
Run your code to test it!!! Make sure that your functions work as desired, by
getting the following output:
False True
True False
True False
True False False
True False False
Part2 (Submission needed):
• Once you're happy with your functions, copy/paste all functions
prototypes/implementations from Part1.cpp into Part2.cpp, then write a short
program to prompt the user for a starting and ending number (both integers) -
ensure that the first number is positive, and that the second number is greater
than the first number.
• Then use your functions to analyze all numbers in this range to and generate
output similar to the following sample run:
Sample Run:
Enter starting number: -5
Invalid, try again
Enter starting number: 5
Enter ending number: 0
Invalid, try again
Enter ending number: 30
5 is ... odd prime
6 is ... even perfect
7 is ... odd prime
8 is ... even
9 is ... odd
10 is ... even
11 is ... odd prime
12 is ... even abundant
13 is ... odd prime
14 is ... even
15 is ... odd
16 is ... even
17 is ... odd prime
18 is ... even abundant
19 is ... odd prime
20 is ... even abundant
21 is ... odd
22 is ... even
23 is ... odd prime
24 is ... even abundant
25 is ... odd
26 is ... even
27 is ... odd
28 is ... even perfect
29 is ... odd prime
30 is ... even abundant
1- You need to submit Part2 only (Part1 won’t be graded).
2- Rename the file Part2.cpp such as YourFirstName_LastNameFinalProject.cpp.
3- Your output should be similar the output above.
4- If the program does not run you will receive a grade of Zero.
5- Only “.cpp” file will be accepted (other type of files will receive a grade
of Zero).
6- Respect the due Date Monday 12/06/2021 before class.
Answered Same Day Nov 24, 2021

Solution

Kshitij answered on Nov 25 2021
106 Votes
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here