Assignment

    Program files for each of the following three programs:

    Largest
    Palindrome
    Diamond

    How to submit your assignment:

    The programs MUST have the same names as the assignment title.
    Each Java source file (*.java) must include a corresponding class file (*.class) program as evidence of success
    Put all program source files in a word document with a screen shot of all your program output.

    L A B  S T E P S

    STEP 1: Largest

    Write a Java application program called Largest.java that inputs a series of 10 single-digit numbers and determines and prints the largest of the numbers. Except main() method, no other user-defined method is required. Your program should use at least the following three variables:

    a) counter: A counter to count to 10 (that is, to keep track of how many numbers have been input and to determine when all 10 numbers have been processed);

    b) number: The current digit input to the program; and

    c) largest: The largest number found so far.

    STEP 2: Palindrome

    A palindrome is a sequence of characters that reads the same backward as forward. For example, each of the following five-digit integers is a palindrome: 12321, 55555, 45554, and 11611. Write an application called Palindrome.java that reads in a five-digit integer and determines whether it is a palindrome. If the number is not five digits long, display an error message dialog indicating the problem to the user. When the user dismisses the error dialog, allow the user to enter a new value.

    Your program will have the following four methods:

    main() method, which controls the execution of the program;
    retrieveInput() method, which prompts and retrieves the input values;
    check() method, which determines whether it is a palindrome; and
    display() method, which displays the result.

    STEP 3: Diamond

    Write a program called Diamond.java that uses a method diamondOfAsterisks() that displays a diamond (the row number of a diamond must be odd) of asterisks whose row is specified in an integer parameter row. For example, if row is 7, the method displays the pattern of asterisks at the top of the next page.

    *

    ***

    *****

    *******

    *****

    ***

    *

                                                                                                                                      Order Now