1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
quester [9]
3 years ago
8

In this module you learned about advanced modularization techniques. You learned about the advantages of modularization and how

proper modularization techniques can increase code organization and reuse.
Create the PYTHON program allowing the user to enter a value for one edge of a cube(A box-shaped solid object that has six identical square faces).
Prompt the user for the value. The value should be passed to the 1st and 3rd functions as arguments only.
There should be a function created for each calculation
One function should calculate the surface area of one side of the cube. The value calculated is returned to the calling statement and printed.
One function should calculate the surface area of the whole cube(You will pass the value returned from the previous function to this function) and the calculated value results printed.
One function should calculate the volume of the cube and print the results.
Make a working version of this program in PYTHON.
Computers and Technology
1 answer:
Sedbober [7]3 years ago
7 0

Answer:

Following are the code to the given question:

def getSAOneSide(edge):#defining a method that getSAOneSide that takes edge patameter

   return edge * edge#use return to calculate the edge value

def getSA(SA_one_side):#defining a method that getSA that takes SA_one_side patameter

   return 6 * SA_one_side#use return to calculate the SA_one_side value

def volume(edge):#defining a method that volume that takes edge patameter

   return edge * edge * edge#use return to calculate edge value

edge = int(input("Enter the length of edge of the cube:\n"))#defining edge variable that input value

SA_one_side = getSAOneSide(edge)#defining SA_one_side that holds getSAOneSide method value

print("Surface area of one side of the cube:", SA_one_side)

surfaceArea = getSA(SA_one_side)#defining a surfaceArea that holds getSA method value

print("Surface area of the cube:", surfaceArea)#print surfaceArea value

vol = volume(edge)#defining vol variable that holds Volume method value

print("Volume of the cube:", vol)#print vol Value

Output:

Please find the attached file.

Explanation:

In the code three method "getSAOneSide, getSA, and volume" method is declared that takes a variable in its parameters and use a return keyword that calculates and return its value.

In the next step,edge variable is declared that holds value from the user and defines three variable that holds method value and print its value with the message.

You might be interested in
Lief wants to keep the information of his chart, but he doesn’t want it taking up space in his page. What should he select after
Murljashka [212]
If wants to keep the chart but does not want it taking up space, he can move it  to another sheet. Once he goes to the Move Chart tab, he should select New Sheet which will ask for a name of the new sheet. After doing this, the chart will be moved to a different sheet.
4 0
4 years ago
Read 2 more answers
A document called a system requirements report describes the objectives for the information system.
kkurt [141]
A, true. Requirements describe the objectives of any assignment.
6 0
3 years ago
Look at the following program and answer the question that follows it. They are multiple choice i need the correct one and expla
Tamiku [17]
E!


Have an amazing day!
4 0
3 years ago
WHAT DOES THE SCRATCH CODE BELOW DO?
Vinil7 [7]
I think it’s b vertically
7 0
3 years ago
Why should you open your door with your right hand when parked on a right-side curb?
meriva

Answer:

B. So that you will be forced to look behind the car for an approaching bicyclist.

Explanation:

The main reason for opening with your right hand in this scenario is so you can look behind you for a bicyclist, etc. It's a good practice as you never know if someone is behind you or of the likes. Many people usually open the door with their left hand. The problem with this is that they're not forced to look behind them and can be oblivious to people, bicyclists, etc. behind them.

<u>Hope this helps and have a nice day!</u>

5 0
4 years ago
Other questions:
  • 4. The clutch pedal is found in cars with manual and automatic transmissions.
    6·1 answer
  • The domain name is passed to a domain name server, which maps it to the correct IP address, and then the code behind the page is
    12·1 answer
  • What are two ways to access the options for scaling and page orientation? click the home tab, then click alignment, or click the
    10·1 answer
  • If you feel that an OSHA inspection is needed to get hazards corrected at your workplace, which is your best option?
    7·1 answer
  • How to transfer photos from iphone to iphone?
    14·2 answers
  • What is an administrator?
    8·1 answer
  • This diagram shows who is responsible in preventing cyberbullying. A flowchart. Top box is labeled Cyberbullying can be prevente
    14·2 answers
  • When reading events in the Event Viewer, you need to recognize the designated levels or classifications. Which of the following
    9·1 answer
  • Examine the following piece of code and determine the data type of the function's return value.
    11·1 answer
  • What is the deference between touch screen phone and keypad phone
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!