CST1620 C# / C++
Programming
Lab Week 5
Exercises |
Exercise 6.1
Temperature Conversions (10 points) Implement the following integer methods:
You may make either a console or a Windows GUI application. Hint: Celsius = 5/9 * (Fahrenheit - 32)
and Fahrenheit = (9/5 * Celsius) + 32
Result
(Save to your local machine and run)
Result (Save to
your local machine and run) Note: Extra credit if you make both variations. (4 points). |
Exercise 6.2
Rational Reduction (10 points) Many fractions (rationals) can be reduced. As an example, a rational with a numerator of 12 and a denominator of 16 reduces to 3/4. Write a method named Reduce in which you pass two parameters by reference, a numerator and a denominator. The reduced numerator and denominator is to be returned back in the parameters that were passed by reference. If the original rational cannot be reduced, just return the original numerator and denominator. Incorporate your method Reduce into a Windows program. Result (Save to your local machine and run) |
Exercise 6.10
Hypotenuse EC
(Extra credit 10 points) Define a method Hypotenuse that calculates the length of the hypotenuse of a right triangle when the other two sides are given. The method should take two arguments of type double and return the hypotenuse as a double. Incorporate the method into a Windows applications that reads integer values for side1 and side2 from TextBoxes and performs the calculation with the Hypotenuse method. Test data: Hint: In a right triangle a2 + b2 = c2 where a and b are the short sides and c is the hypotenuse. |