Problem Set Part 1
  • The ‘how are you feeling problem’, shows the use of equality between two strings.  It compares string one to string two and by using a conditional if/else statement produces an answer based on the results.
  • The second problem asks, ‘how many miles did you run’ and in how much time.  It requires the use of the number function to convert the string from the prompt command and convert it to a number.  It also requires us to check the string from the prompt command to make sure it is a number.  One way to do this is by using the is the not-a-number function(isNaN()).
  • The last problem the weather problem, ask for a user response about the condition of the weather.  Based on 6 possible choices, if the user picks one of the six, we provide a response.  Otherwise, the program defaults to a response generic response.  This problem uses the switch command.

WEEK TWO EXERCISES.

Leave a Reply

Your email address will not be published. Required fields are marked *

css.php