Your mission is to write a program that examines positive


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 EVEN
PRIME 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 definition
PERFECT / ABUNDANT / DEFICIENT --- as described above
SQUARE -- as described above
TRIANGULAR -- as described above
You 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.

Implementation

Your 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 b

You 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 program

def printGreeting():
# explains the program to the user

def printTableHeading():
# prints the heading of the table

def 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 not

def 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 this

This program classifies positive integers as
Odd/Even, Prime/Composite, Perfect/Abundant/Deficient,
Square, and Triangular

You will now get to choose the range of positive integers that
you would like to see classified.

Start with which positive integer ?
Please enter an integer between 1 and 100000 : 1
End with which positive integer ?
Please enter an integer between 1 and 100000 : 30

Int Classifications....................................
-----------------------------------------------------------------------
1 Odd Neither Deficient Square Triangular
2 Even Prime Deficient
3 Odd Prime Deficient Triangular
4 Even Composite Deficient Square 
5 Odd Prime Deficient
6 Even Composite Perfect Triangular
7 Odd Prime Deficient
8 Even Composite Deficient
9 Odd Composite Deficient Square
10 Even Composite Deficient Triangular
11 Odd Prime Deficient
12 Even Composite Abundant
13 Odd Prime Deficient
14 Even Composite Deficient
15 Odd Composite Deficient Triangular
16 Even Composite Deficient Square
17 Odd Prime Deficient
18 Even Composite Abundant
19 Odd Prime Deficient
20 Even Composite Abundant
21 Odd Composite Deficient Triangular
22 Even Composite Deficient
23 Odd Prime Deficient
24 Even Composite Abundant
25 Odd Composite Deficient Square
26 Even Composite Deficient
27 Odd Composite Deficient
28 Even Composite Perfect Triangular
29 Odd Prime Deficient
30 Even Composite Abundant

Request for Solution File

Ask an Expert for Answer!!
Programming Languages: Your mission is to write a program that examines positive
Reference No:- TGS0119628

Expected delivery within 24 Hours