Assignment No.5

  1. (Textbook Chapter 4 Exercise 11) Write a method called longestName that accepts a Scanner for the console and an integer n as parameters and prompts for n names, then prints the longest name (the name that contains the most characters) in the format shown below, which might result from a call of longestName(console, 4)

    name #1? Roy
    name #2? DANE
    name #3? sTeFaniE
    name #4? Mariana
    Stefanie's name is longest

  2. Write a method called printPalindrome that accepts a Scanner for the console as a parameter, prompts the user to enter one or more words, an prints whether the entered String is a palindrome. Make the mehod case insensitive.

Go back to the assignment list page.