Answered You can hire a professional tutor to get the answer.

QUESTION

Your mission is to write a program that examines positive integers within a range that the user specifies and categorizes them as follows:

Your mission is to write a program that examines positive integers within a range that the user specifies and categorizes them as follows:ODD or EVENPRIME or COMPOSITE -- a prime number is an integer greater than one that is divisible only by itself and one. Any number that is not "prime" is "composite". 1 is neither prime nor composite by definitionPERFECT / ABUNDANT / DEFICIENT --- as described aboveSQUARE -- as described aboveTRIANGULAR -- as described aboveYou may assume that the user, a.k.a. your grader, will enter integers for this program.The results are to be printed out in a well-formatted table. See the sample run below.ImplementationYour program MUST include the following functions.Do NOT change the function names or parameters in the function headers given below.Since this is a math-related project it's appropriate for us to use n as a variable name for an integer. When a variable is holding the value of something, it's important to name that variable with a meaningful name for what's being held, but just an integer, is okay to be called n. Similarly, it's okay to use a and bYou may choose to use more functions if you wish, but these are sufficient. All predicate functions, by definition, must return True or False. You have some flexibility in implementing the other functions.view sourceprint?def main():# is the skeleton of the programdef printGreeting():# explains the program to the userdef printTableHeading():# prints the heading of the tabledef isOdd(n):# a predicate function that returns True if n is odd# and returns False if not.def isPrime(n):# a predicate function that returns True if n is prime,#and False if notdef checkForPerfect(n):# classifies n as "perfect", "abundant" or "deficient". # A different value is returned for each category.def sumDivisors(n):# returns the sum of the divisors of n.def isDivisor(a, b):# a predicate function that returns True if b is# a divisor of a, and False if not.def isSquare(n):# returns True if n is a perfect square, False if not.def isTriangular(n):# returns True if n is a triangular number, False if not.def printTableLine(n, odd, prime, perfect, square, triangular):# prints the information for one number on one line of the table.output should look like thisThis program classifies positive integers asOdd/Even, Prime/Composite, Perfect/Abundant/Deficient,Square, and TriangularYou will now get to choose the range of positive integers thatyou would like to see classified.Start with which positive integer ?Please enter an integer between 1 and 100000 : 1End with which positive integer ?Please enter an integer between 1 and 100000 : 30Classifications....................................-----------------------------------------------------------------------TriangularDeficientTriangularDeficientTriangularDeficientDeficientSquareTriangularDeficientAbundantDeficientDeficientTriangularSquareDeficientAbundantDeficientAbundantTriangularDeficientDeficientAbundantSquareDeficientDeficientTriangularDeficientAbundant

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question