CIS355A iLab 2 Largest Palindrome and Diamond Programs

$ 15

CIS355A iLab 2 Largest Palindrome and Diamond Programs

In this lab you will create programs that use control structures and user-defined methods.

Deliverables
Program files for each of the following three programs.
1. Largest
2. Palindrome
3. Diamond
At the beginning of ALL your programs, put a comment box that includes the program name, your name, and a brief description of the program.

iLAB STEPS
STEP 1: Largest (10 points)
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
1. 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);
2. number: The current digit input to the program; and
3. largest: The largest number found so far.
When each number is entered, make sure it is a single digit number, that is 0 to 9.

STEP 2: Palindrome (15 points)
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 asks the user to enter 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
1. main() method, which controls the execution of the program;
2. retrieveInput() method, which prompts and retrieves the input values;
3. check() method, which determines whether it is a palindrome; and
4. display() method, which displays the result.

STEP 3: Diamond (15 points)
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 the user enters a 7, then the diamond will have seven rows and the method will display the pattern of asterisks. Below is an example of the diamond displayed when 7 is entered.
   *
  ***
 *****
*******
 *****
  ***
   *

61 in stock

SKU: CIS355ILAB2 Category:

Description

CIS355A iLab 2 Largest Palindrome and Diamond Programs

In this lab you will create programs that use control structures and user-defined methods.

Deliverables
Program files for each of the following three programs.
1. Largest
2. Palindrome
3. Diamond
At the beginning of ALL your programs, put a comment box that includes the program name, your name, and a brief description of the program.

iLAB STEPS
STEP 1: Largest (10 points)
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
1. 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);
2. number: The current digit input to the program; and
3. largest: The largest number found so far.
When each number is entered, make sure it is a single digit number, that is 0 to 9.

STEP 2: Palindrome (15 points)
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 asks the user to enter 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
1. main() method, which controls the execution of the program;
2. retrieveInput() method, which prompts and retrieves the input values;
3. check() method, which determines whether it is a palindrome; and
4. display() method, which displays the result.

STEP 3: Diamond (15 points)
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 the user enters a 7, then the diamond will have seven rows and the method will display the pattern of asterisks. Below is an example of the diamond displayed when 7 is entered.
   *
  ***
 *****
*******
 *****
  ***
   *

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.