View
 

Lab 19: Swapper II

Page history last edited by Mr. Kretsch 2 months, 3 weeks ago

Name: ________________________________

Objective: Functions

Instructions

  1. Open your swapper project
  2. Add to the form two labels and one button
  3. Add to the code:
    1. A function called isValid
      1. The function takes one parameter, a string
      2. The function returns a boolean: true if the string is an integer between 1 and 20; false otherwise
    2. A function called power
      1. The function takes two strings.
      2. The function returns the first string raised to the power of the second.
    3. When the user clicks the new button:
      1. Use the isValid to check that all four text boxes are valid
      2. If text boxes 1 and 2 are valid, copy in to the first label text box 1 raised to the power of text box 2
      3. If text boxes 3 and 4 are valid, copy into the second label text box 3 raised to the power of text box 4

Extra Credit

  1. Pop up a message box if the string is no valid. Make sure the message is specific

Grading

Feature  Points  Out of  Note 
Form features   1  
The isValid function     
The power function     
The third button click     
Extra   4  
Total   12  

 

Notes

 
 
 
 
 
 

 

 

Comments (0)

You don't have permission to comment on this page.