Answered step by step
Verified Expert Solution
Question
1 Approved Answer
# universityTester.py import random from university import Instructor # Global constants RAISE 2 = 2 RAISE 5 = 5 RAISE 8 = 8 RAISE 1
# universityTester.py
import random
from university import Instructor
# Global constants
RAISE
RAISE
RAISE
RAISE
ADJPROF 'Adjunct Professor'
ASSISPROF 'Assistant Professor'
ASSOCPROF 'Associate Professor'
FULLPROF 'Full Professor'
ADJSAL
ASSISSAL
ASSOCSAL
FULLSAL
def main:
# Strings declaration
fName 'Smith'
fName 'Doe'
fName 'YourLastName'
# Function definitions
def getRandom:
Generate a random integer number between and inclusive.
Returns:
int: Random integer between and
return random.randint
def startingSalarynum:
Get starting salary based on the given number.
Parameters:
num int: A number to determine starting salary.
Returns:
float: Starting salary based on the given number.
if num :
return ADJSAL
elif num :
return ASSISSAL
elif num :
return ASSOCSAL
elif num :
return FULLSAL
else:
return
def classificationnum:
Get classification based on the given number.
Parameters:
num int: A number to determine classification.
Returns:
str: Classification based on the given number.
if num :
return ADJPROF
elif num :
return ASSISPROF
elif num :
return ASSOCPROF
elif num :
return FULLPROF
else:
return 'Unknown Professor'
def raiseSalarynum:
Get raise percentage based on the given number.
Parameters:
num int: A number to determine raise percentage.
Returns:
int: Raise percentage based on the given number.
if num :
return RAISE
elif num :
return RAISE
elif num :
return RAISE
elif num :
return RAISE
else:
return
def printByAccessorobj:
Print rank, name, and salary of the given professor object.
Parameters:
obj Instructor: The Instructor object to print details of
printobj
def goodBye:
Print last two lines to end the program."""
print
This program was written by Dr YourLastName."
printEnd of program.
# Step : Instantiate Instructor objects
num getRandom
num getRandom
classify classificationnum
classify classificationnum
salary startingSalarynum
salary startingSalarynum
person Instructorclassify fName salary
person Instructorclassify fName salary
person InstructorclassificationgetRandom fName startingSalarygetRandom
# Step : Print details of Instructor objects
printByAccessorperson
printByAccessorperson
printperson
# Step : Raise salary for person
num getRandom
increase raiseSalarynum
printf
Full Professor fName will get an increase in salary by: increase
salary persongetSalary
newsalary salary increase
personsetSalarynewsalary
printByAccessorperson
# Step : Possibly change rank for person
print
Adjunct Professor Doe may or may not get a new title."
classify classificationgetRandom
personsetRankclassify
printperson
# Step : Create and print dictionaries
profRank Num: persongetRank 'Num: persongetRank 'Num: persongetRank
print
profRank:", profRank
profName Num: fName 'Num: fName 'Num: fName
printprofName: profName
profSalary Num: persongetSalary 'Num: persongetSalary 'Num: persongetSalary
printprofSalary: profSalary
# Step : Calculate and print total and average salaries
totalsalary profSalaryNum profSalaryNum profSalaryNum
print
Total salary for professors: $ totalsalary
averagesalary totalsalary
printAverage salary for professors: $ averagesalary
# Step : Print final lines
goodBye
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