A painting company has determined that for every 115 square feet of wall space, one gallon of paint and eight hours of labor will be required. the company charges $20 per hour for labor. Design a modular program that asks the user to enter the square feet of wall space to be painted and the price of the paint per gallon. The program should display the following data: The number of gallons of paint required The hours of labor required The cost of the paint The labor charges The total cost of the paint job
What did you come up with so far?
ahh hey
I didn't think anyone would come lol
anyways, I want to understand the logic of the problem and how it is possible to have sub modules within the problem
and I would like to understand how to do in psuedocode
any ideas?
Well, first, do you know what it means by modular?
I need to start the problem with a main module and an end module?
I kinda understand how to do the problem with one module, but I am not sure how to break it up into sub modules
Well, it is like a modular closet organizer. See, every closet is similar in that they hold close. Some need more shelves for shoes, other might have a clothes drawer in them, most have a place to hang things. So they sell all of these, and more, as modules and you pick the ones you need. They applied this idea to programming. Break down a program into small parts that each do a very limited thing. These parts can then be reused as needed.
how bout this, let me tell you what I have so far and see if there is a way we can break into sub modules
Main Module Declare integer Quantityofpaint Declare Real Laborhours, Paintcost, Totalpaintcost Declare Real Laborcharges, Totalcost, Wallspace Display "Enter the total wall space to be painted in square units: " Input Wallspace Set Quantityofpaint = Wallspace Set Laborhours = 8 * Wallspace Display "Enter the price of paint per gallon" Input Paintcost Set Totalpaintcost = Paintcost * Wallspace Display "Input the hours of labor: " Input Laborhours Set Laborcharges = 20*Laborhours Set Totalcost = Totalpaintcost + Laborcharges Display "The number of gallons of paint required is " Quantity of paint Display "The hours of labor required is " Laborhours Display "The cost of the paint is " Totaalpaintcost Display "The labor charges is " Laborcharges Display "The total cost of the paint job is " Totalcost End Main module
sorry if that took long to type lol
I have a slight idea of what could be broken into submodules, but I may be wrong. module wallspace, module Paintcost, module Laborhours?
wat is your opinion?
you still there by the way?
Well, I am at work and the only mod on the site at the moment... so I am getting bombarded.
ahh sorry about that, but is there a way I can change the inputs into submodules or no?
B or D Maybe because it seems like to me like that would make more sense hope this helped
B or D?
Yes
wat do you mean?
D i would go with i mean
But this isn't multiple choice
Oh lol sorry about that i'm not really good at this
I have to display all of the five components lol
oh ok lol
I am just rying to figure how I can break the problem into submodules
For this type of problem, you would generally turn the things that do the work into subs. Because there is only one job at a time there is no need to make an instance for each.
for example?
Oh well maybe you can do A B C D with all of your answers you know from the question and some ideas maybe.
A,B,C,D?
And form a paragraph about what you know with each of them
And make a thesis of your answers and how you got them according to what you know
Wallspace() Display "Enter the total wall space to be painted in square units: "
would that be a submodule?
Hope this helped i usually do this with this type of problem
Yes that would be @luisz
ok let me redo the problem, for I may be gettin the hang of this give me a few minutes
I hope you get it right but you can always check with someone else to see if you are correct or not i would like to see you get this correct
you have anything yet? You catching on? :D
And also draw up a picture too if that helps
Main Module Declare Integer Quantityofpaint Declare Real Laborhours, Paintcost, Totalpaintcost Declare Real Laborcharges, Totalcost, Wallspace Wallspace() Display "Enter the total wall space to be painted in square units: " Set Quantityofpaint = Wallspace Set Laborhours = 8 * Wallspace Paintcost() Display "Enter the price of paint per gallon" Set Totalpaintcost = Paintcost * Wallspace Laborhours() Display "Enter the hours of labor: " Set Laborcharges= 20 * Laborhours Set Totalcost = Totalpaintcost + Laborcharges Display "The number of gallons of paint required is " Quantityofpaint Display "The cost of the paint is " Totalpaintcost Display "The labor charges is " Laborcharges Display "The total cost of the paint job is " Totalcost End Main Module
am I missing anything?
Yep just label it with A. B. C and D.
by separating parts of your answer
e.mccormick wat is your opinion? Did I answer the problem correctly?
I have no clue what the whole thing about labeling things is about. It has nothing to do with being modular. The entire focus of modules is making a small piece of code that is reusable and has a clear, specific job.
Oh im sorry I just wanted to help...hope this helped
so did I answer the problem incorrectly or did I answer it in an incorrect fashion?
if you tell me where I want wrong and show me some examples through pseudocode I may be able to understand more efficiently :)
Well, it is hard to say how to make this modular. It inputs two numbers and the rest is math. There are existing input routines, so building them is kind of pointless. A better example of modular is a card game. Then each card is unique, but related. Each player is also unique but related. The things needed to make one player can be reused to make another, same for making the entire deck.
not sure what that exactly means, but was the problem done correctly in your opinion, or am I missing some things that would make the program run incorrrectly?
Well, it is hrd for me to get time to look at it... like I said, I am getting asked things both on here and at work. In fact, work is sending me somewhere.
http://www.justanswer.com/computer-programming/24oav-6-painting-company-determined-every-115-square.html idk maybe it will tell you
If not i would go @e.mccormick then :/
Your psudocode has one module, the main module. One thing you could do to make more modules is to emulate a very typical input method. That is one where you pass it a querry message and it returns the user's response. BEGIN UserQueryIn Method (String Querry) Display Querry Return User's Input END UserQueryIn Method Then you would do something like this in the main code: Set Wallspace = UserQueryIn("Enter the total wall space to be painted in square units: ") That bit of code would use the submodule to output the wall space question to the user and return the result to be assigned to the variable. You then do the same thing for the price of the paint. That is what is meant when you do things in a modular way.
Join our real-time social learning platform and learn together with your friends!