[SOLVED] IT1010 Tutorial 9

30.00 $

Category:
Click Category Button to View Your Next Assignment | Homework

You will receive the following solution file(s) instantly after successful payment:

zip file icon Tutorial-9-5copl1.zip (110.5 KB)
Assignment Instructions Updated Recently? Submit Below and we will provide new Solution!
Submit New Instructions
🔒 Securely Powered by:
Secure Checkout
5/5 - (2 votes)

 

 Question 1

Define a function called hypotenuse that calculates the length of the hypotenuse of a right triangle when the other two sides are given. The function should take two arguments of type double and return the hypotenuse as a double. In your main program write three assert statements to debug your function for the following scenarios.

 

Triangle Side 1 Side 2
1 3.0 4.0
2 5.0 12.0
3 8.0 15.0

 

Question 2

Modify the above program to have another function called testHypotenuse() which contains the three assert statements you wrote. Call testHypotenuse() function in your main program.

 

 

Additional Exercises 

 

Question 3

Write a function qualityPoints that inputs a student’s average and return 4 it’s 90-100 , 3 if it’s 80-89 , 2 if it’s 70-79, 1 if it’s 60-69 , and 0 if the average is lower than 60.

Write another function called testQualityPoints( ) which contains the assert statements to debug the above implemented function.

 

  • Tutorial-9-5copl1.zip