11. Test 2 – Volume and Area

Main Task

  • The formula for the volume of a cylinder is πr2h
  • The formula for the surface area is (2πr2) + (2πrh)
  1. Create a program that will:
    • Ask for the radius and height of a cylinder
    • Calculate the volume and surface area
    • Output the values separately
  2. Save and label your code

Extension Task

  1. Create a similar program that will:
    • Ask for the length, width and height of a cuboid
    • Calculate the volume and surface area
    • Output the values separately
  2. Save and label your code

Hints

  • Assume the user will enter numbers with decimal points
  • Create an answer variable to store the result before printing
  • pi (π) = 3.14159265359
  • r2 is the same as r*r