Assignment 5 

Due Friday, May 1 at 11:59pm on Canvas


Important: You must only use concepts and methods taught in class to complete these assignments. If you use any outside concepts, you will automatically receive a 0.


Pair Programming Required - Or You Will Receive a 0
  • Both partners fill in, sign, date, and submit the pair programming contract
  • Only one partner submit the code.
  • Upload the document(s) along with your Lab code to Canvas.
  • Please make sure both your names are on your file (hint: use a proper Javadoc comment)
  • If you need help finding a partner, please contact me as soon as possible.


Assignment 5: The Longest Words (10 pts)

  • According to Grammarly.com, here are the 14 longest words in the English language.
  • We are going to write a program that prompts the user to enter a really long word and prints out some information about this word.
  • Open up a new Java file called LongWords.java and add a Javadoc comment with your names and section information
/** <-- note two stars!
* @author FILL_IN_HERE
* @author FILL_IN_HERE
* CIS 36A, Assignment 5
*/
  • Then declare a new Scanner variable to read in user input.
  • The program should then prompt the user for a really long word, and display the following information about it:
  1. It's length
  2. The index number of its first and last index
  3. Its first and last letters.
  • Note that your program should *only* use the length() and charAt() methods given in class - or you will not receive credit for this assignment.
  • A word of advice: copy and paste your words from the Grammarly.com article to save the trouble of typing such long words into the console.
  • Hint: The first character is always at which index? You can just print this number out without doing any calculations
  • Once your program works identically to the sample output below, please upload it to Canvas:

Example Output: Your program must work identically, except user input of the word may vary:

Enter a really long word: pseudopseudohypoparathyroidism
The length of pseudopseudohypoparathyroidism is 30
The first letter is at index 0, and the last letter is at index 29
The first letter is p
The last letter is m


Another Example:

Enter a really long word: Antidisestablishmentarianism
The length of Antidisestablishmentarianism is 28
The first letter is at index 0, and the last letter is at index 27
The first letter is A
The last letter is m