Syllabus

Home

Class Resources

News

CS-100 In-Class Project: The Rainbow Calculator

Instructions:

  1. Download the form for this project from the website: Rainbow Calculator
  2. The form contains the objects shown above.
  3. For this project IGNORE all the blue command buttons on the right. You will not be using them.
  4. The purpose of this project is to make a number appear in the picture box at the bottom when you press a series of command buttons in the KEYPAD area of the calculator. (The command buttons for the digits 0-9, the MINUS and DOT). The form above shows the result after pressing the "2", the "5", the "DOT", the "1", and the "4" command buttons. 25.14 appears in the picture box.
  5. The form already has a global variable, num_str, declared as type string. (See the comments in the code part of the form file.)
  6. Your job is to concatenate a digit (or minus or dot) to the contents of the string variable each time one of the 12 keypad command buttons is pressed.
    1. In the case shown above the string variable starts out with no characters.
    2. The user presses the "2" command button.
    3. The character "2" is concatenated onto the value of the string variable:
      Let num_str = num_str & cmdTwo.Caption
    4. The picture box is cleared.
    5. The string is printed to the picture box.
    6. The user presses the "5" command button.
    7. The character "5" is concatenated onto the value of the string variable:
      Let num_str = num_str & cmdFive.Caption
    8. The picture box is cleared.
    9. The string is printed to the picture box.
    10. And so on, each time a command button is pressed.
  7. The code is provided for the "0" command button already, and empty subroutines alread exist for all the others. You just need to fill in the code.
  8. Also provide code for the Clear command button that clears the picture box and resets the string variable such that it contains no characters.
  9. Add code to the end command button that will terminate the program.
  10. Save your work to floppy disk.
  11. You may confer with classmates in working this problem.