ICE LECTURE In Class Exercises - Radio Buttons

Note: Please keep the programs that you create today, in case you have a question about your grades for the ICEs at the end of the quarter. When you're working with a partner, each person should save their own, individual copy.

ICE Part 1: Practice Exercises

Pick from amongst the following problems. Start with any one that you want and try to solve it.  If you get done with that one, then pick another one and work on that, etc, etc.

Part 1-A: Two Way Temperature Converter

Create a page that asks the user for the temperature in degrees using a text box, along with a pair of radio buttons.  If the first radio button is checked off then the page will assume that the temperature is in Fahrenheit and convert that number to Celsius.  If the second radio button is checked off then the page will do the opposite - it will assume that the temperature is in Celsius and convert that number to Fahrenheit.

Part 1-B: Optional Math Class Style Question About Inverse Functions

NOTE: You don't have to do this one and it will never be on any tests.  It might be fun and/or useful to think about, depending on which math classes you're taking (if any)

Let's say that you want to create another web page that works similar to the one in Part A, except this time for grades.  The idea being that you can convert from your total points (e.g., 595 points out of 700 total) into your overall GPA (e.g., a 3.0) if you select one of the radio buttons, or you can convert from a GPA (such as 4.0) back to your number of points (e.g., 672 out of 700).

Why can't you do this?  If you wanted to talk about this using the language of math, how would you describe the inverse function of the 'points to GPA' function?  It might help also to clarify the domain and range for both the 'points to GPA' function and it's inverse.

Again, this question is totally optional - I just thought it might be fun if you're in Math &141 or so :)

Part 1-C: Veggie Feedback

Create a page where the user is presented with the following options, via radio buttons:

The user should click on one of the radio buttons, and then click on a 'normal' button; you should then provide the user with feedback about each vegetable.  Please keep the feedback both positive and family-friendly. 

Part 1-D: One-Way Converter Page

Create a page where the user is presented with a textbox and several radio button options.  When a button is clicked the page will convert from whatever they typed in into whatever option they've selected.  While you're encouraged to come up with your own options, here's a couple of ideas to get you started:

Part 1-E: Two-Way Converter Page

This exercise builds on the previous one - you'll need to complete the prior one before doing this one.

In the prior exercise you converted from a single unit (say, US dollars) to the user's choice of units (Rubles, Francs, Yen).  For this exercise you should let the user choose which units to convert from in addition to the choice about to convert to.

For example, instead of assuming that the user is typing in U.S. dollars, you should present the user with radio buttons that let them select from US dollars, Rubles, Francs, or Yen as the starting currency, gives them a textbox to type in that starting currency, and then gives them another set of radio buttons to choose the currency that they want to convert to, as pictured below.  When the user clicks on the button the page will convert from the chosen currency to the destination currency.

What would you like to convert from?
US dollars
Rubles
Francs
Yen
Type the starting amount here:
What would you like to convert to?
US dollars
Rubles
Francs
Yen