Advertisement
Guest User

Untitled

a guest
Jul 24th, 2017
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.52 KB | None | 0 0
  1. Specifications
  2.  
  3. readNumberOfEntries→ This function will ask the user for a value greater than or equal to two. The function will keep asking values as long as the user provides a value less than two. For each incorrect value the function will print (using alert) the message:
  4.  
  5. "Error: Number must be greater than or equal to 2"
  6.  
  7. The function will end once a correct value is provided (the function returns this value).
  8.  
  9. isSorted→ This function will verify whether a set of values are sorted (in increasing order). The function will read a set of values from the user and will return true if the set of values are sorted and false otherwise. You must use the readNumberOfEntries function described above in order to read the number of entries the user will provide. The actual entries are read by the isSorted function.
  10.  
  11. isPalindrome→ This function will verify whether a set of values represent a palindrome. We define a palindrome as a set of numbers that when read from left to right and from right to left, present the same set of values. For example, the following are considered palindromes:
  12. Example1: 10 20 10
  13.  
  14. Example2: 10 10
  15.  
  16. The following are not considered palindromes:
  17. Example1: 10 20 8
  18.  
  19. Example2: 10 20
  20.  
  21. You must use the readNumberOfEntries function described above in order to read the number of entries the user will provide. The values the user provides must be read by this function and they should be stored in an array. Once in the array, your code should determine whether the values represent a palindrome.
  22. Requirements
  23.  
  24. As with all programming assignments:
  25. You must use meaningful variable names.
  26. You must use good indentation.
  27. Your code must follow the style guidelines provided at JavaScript Style Guidelines.
  28. You may not add any parameters to the readNumberOfEntries, isSorted and isPalindrome functions.
  29. You may not define any other functions besides the functions described above.
  30. You may not modify the main() function provided in analyzeValues.html.
  31. You must verify your program works for different sets of values (not just the ones provided above) and it should be able to handle any number of values.
  32. You must use a do while for the implementation of the readNumberOfEntries function.
  33. Make sure you submit a zip file with the file.
  34. Make sure you use Komodo Edit as your editor, otherwise indentation may not look correctly during the grading process.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement