Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CSIT 512 Elements of Computer Programming Programming Assignment 4 Programming Assignment 4: Focus on function arguments, return values, modules The Five Twelve Construction Company has

image text in transcribed

CSIT 512 Elements of Computer Programming Programming Assignment 4 Programming Assignment 4: Focus on function arguments, return values, modules The Five Twelve Construction Company has asked you to implement a computer program to determine the number of cans of paint, along with the cost, to paint a room of a given size with a given color. You will write this program using a main() and several functions. The functions will be organized into two modules. The available colors and their cost per can are: Color Green Red Blue Eggshell Cost/can $3.68 $4.25 $3.69 $4.25 White $3.25 Custom $6.00 First function: This function will prompt the user for a room dimension value as input and return it. The function should be passed one argument, a string which identifies which dimension is to be entered (length', 'width', 'height'). The function should perform basic input validation before returning the value. The dimensions width and length will be between 4.5 and 30 feet, height between 6.5 and 16 feet. Notice that the function will be called three times by main(), once for each dimension. Second function: This function will prompt the user for the color to be used and return the value. The color should be limited to one of the available ones. While the user should be presented with the names of the colors, they should be shown along with abbreviations that are easier to enter, for example Green (G), Red (R), etc. The abbreviations will be the coded value that the function returns. Third function: This function should compute and return the number of cans of paint needed for the job. The three dimensions will be passed as arguments and the function will calculate the total surface are to be painted and then the number of cans required. The returned value must be an integer, since the company can't buy fractional cans of paint. Also, you cannot just convert from float to int because that will always truncate the quantity. Use the math.ceii function. Tength The room has 4 walls and a ceiling to paint and is rectangular. The floor will not be painted. Two walls will have size height*length and two will have height*width. The ceiling's size is length*width. One can of paint covers 365 square feet of surface. width height Fourth function: This function should compute and return the total cost of paint for the room. It will receive the number of cans of paint and the color code (abbreviation) as arguments. main(): will call the functions and print out the final cost for the user. The first two functions should be stored in a module named fetch.py. The third and fourth functions should be stored in a module named compute.py

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database And Expert Systems Applications 33rd International Conference Dexa 2022 Vienna Austria August 22 24 2022 Proceedings Part 2 Lncs 13427

Authors: Christine Strauss ,Alfredo Cuzzocrea ,Gabriele Kotsis ,A Min Tjoa ,Ismail Khalil

1st Edition

3031124251, 978-3031124259

More Books

Students also viewed these Databases questions