Top-down Program Design(10/14) Testing √Logical error Logical errors occur when the program compiles and runs successfully but produces the wrong answer. Solution: Use shorter statements Check typos ·Check units @日济大学 TONGJI UNIVERSITY
✓ Logical error Logical errors occur when the program compiles and runs successfully but produces the wrong answer. Solution: • Use shorter statements • Check typos • Check units Top-down Program Design(10/14) Testing
Top-down Program Design(11/14) Exam ple > Problem:Write a program that takes the radius and height (in meters)of a cylinder tank and the amount of water (in m3)from the user and output the amount of extra space (in m3)in the tank. >Input: radius and height amount of water >Output: extra space @月诱大学 TONGJI UNIVERSITY
➢ Problem: Write a program that takes the radius and height (in meters) of a cylinder tank and the amount of water (in m3 ) from the user and output the amount of extra space (in m3 ) in the tank. ➢ Input: radius and height amount of water ➢ Output: extra space Top-down Program Design(11/14) Example