Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I can't figure out why my code does not work # Week 4 Assignment # This program is to calculate the cost of house cleaning
I can't figure out why my code does not work
# Week Assignment
# This program is to calculate the cost of house cleaning
# Define Functions
# Welcome
def Welcome:
# This function displays the Welcome message
print
Welcome!"
print
This program will calculate the cost of your house cleaning."
print
The services we provide:
#Display options for cleaning types
print Basic: Includes regular cleaning of windows, doors, baseboards, dusting, and all furniture wiped."
print Premium: Includes deep cleaning of inside cabinets, oven cleaning, and moving furniture."
print Deluxe: Includes Premium cleaning plus laundering of bedding, curtains, bath, and kitchen rugs.
# GetNumRooms
def GetNumRooms:
#Prompt the user for number of rooms
numRooms intinputHow many rooms do you have?t
#Validate input
if numRooms : #A small house is rooms or less
# Display result for a small house
print
This number of rooms is the Small package
elif numRooms and numRooms : #A medium house is rooms
#Display result for a medium house
print
This number of rooms is the Medium package
elif numRooms : #A large house is or more rooms
#Display result for a large house
print
This number of rooms is the Large package
#Set price for house size
if numRooms :
numRoomsCost #A small house is $
elif numRooms and numRooms :
numRoomsCost #A medium house is $
elif numRooms :
numRoomsCost #A large house is $
returnnumRooms
# GetCleanType
def GetCleanTypeCost :
#Prompt the user for cleaning type
cleanType intinputWhat cleaning type would you like to select?
Enter for basic, for premium, or for deluxet
#Validate input
if cleanType :
# Display result for basic cleaning
print
There is no additional fee for a Basic cleaning"
elif cleanType :
#Display result for a premium cleaning
print
There is a $ charge for a Premium cleaning"
elif cleanType :
#Display result for a deluxe cleaning
print
There is a $ charge for a Deluxe cleaning"
#Set price for cleaning type
if cleanType :
cleanTypeCost #A basic cleaning is extra charge, $
elif cleanType :
cleanTypeCost #A premium cleaning is $ more
elif cleanType :
cleanTypeCost #A deluxe cleaning is $ more
returncleanType
# CalCustCost
def CalCustCost numRoomsCostcleanTypeCost:
# This function calculates all costs per customer
# Input: numRooms, cleanType
# Output: numRooms, cleanType, totalCost total customer cost
#Calcuate the total cost
totalCost numRoomsCost cleanTypeCost
returnnumRoomsCostcleanTypeCost,totalCost
# DisplayOutput
def DisplayCustOutput numRoomsCCost cleanTypeCCost,totalCCost:
# This function displays the number of rooms, cleaning type, and the total cost
# Input: numRoomsCCost number of rooms cost
# cleanTypeCCost type of cleaning type cost
# totalCCost total for house cleaning
# Output: none
#Display the output
print
printThe total for the number of rooms: $ numRoomsCCost
printThe total for the cleaning type: $ cleanTypeCCost
printThe total for the house cleaning: $ totalCCost
# Main
def main:
# Display Welcome message
Welcome
#Prompt user for number of rooms
numRooms GetNumRooms
#Prompt user for clean type
cleanType GetCleanTypeCost
#Calculate the customer cost
totalCost cleanType numRooms
#Diplay output
DisplayCustOutput numRooms cleanType, totalCost
# Execute
main
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