CST1801 Visual
Basic I
Lab Week 5
Exercises |
Exercise
RationalReduction (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 (subroutine) 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. Remember to accept negatives for numerators and denominators. Reduce the signs as well. A resulting negative sign, if there is one, should be attached to the numerator. Incorporate your method (subroutine) Reduce into a Windows program. Result (Save to your local machine and run) |
Exercise
TemperatureConversions EC Extra credit (10
points) Implement the following integer functions:
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 extra credit if you make both variations. (4 points). |
Exercise TrafficLight (10
points)
Above are the 6 states of a set of typical traffic lights. Write a program to simulate a set of traffic lights. Use timers to do this. Result (Save to your local machine and run) |