Cis 355 ilab 2 of 6

278 views

Published on

  • Be the first to comment

  • Be the first to like this

Cis 355 ilab 2 of 6

  1. 1. CIS/355 iLab 2 of 6STEP 1: Largest (10 points)Write a Java application program called Largest.java that inputs a series of 10 single-digit numbersand determines and prints the largest of the numbers. Except main() method, no other user-definedmethod 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.Grading Rubric Largest Points Description Must contain programs name, student name, andStandard header included 1 description of the programProgram compiles 2 Program does not have any errorProgram executes 2 Program runs without any errorOnly single digit numbers Program validates number entered is a single digit 2are entered numberProgram displays the largest Program displays the largest number after all 10 numbers 3number are entered Subtotal 10STEP 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 anapplication called Palindrome.java that asks the user to enter in a five-digit integer anddetermines whether it is a palindrome. If the number is not five digits long, display an errormessage dialog indicating the problem to the user. When the user dismisses the error dialog, allowthe 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;
  2. 2. 3. check() method, which determines whether it is a palindrome; and 4. display() method, which displays the result.Grading Rubric Palindrome Points Description Must contain program’s name, student name, andStandard header included 1 description of the programProgram compiles 1 Program does not have any errorProgram executes 1 Program runs without any errorProgram contains main 1 Program contains main methodmethodProgram contains retrieveInput method exists, retrieves the user input, and 2retrieveInput() method checks if input is numeric and has five digitsProgram contains check() check method exists and checks if number entered is a 2method palindromeProgram contains display() display method exists and displays the result if palindrome 2method or notValue entered is numeric Program validates input to make sure it is numeric and 2and has 5 digits has five digits Program displays the correct message for the numberCorrect output is displayed 3 entered Subtotal 15STEP 3: Diamond (15 points)Write a program called Diamond.java that uses a method diamondOfAsterisks() that displays adiamond (the row number of a diamond must be odd) of asterisks whose row is specified in aninteger parameter row. For example, if the user enters a 7, then the diamond will have seven rowsand the method will display the pattern of asterisks. Below is an example of the diamond displayedwhen 7 is entered. * *** ************ ***** *** *
  3. 3. Grading Rubric Diamond Points Description Must contain program’s name, student name, andStandard header included 1 description of the programProgram compiles 1 Program does not have any errorProgram executes 1 Program runs without any errorProgram contains main Program contains the main method where user is asked 2method to enter an odd numberProgram contains Program contains the diamondOfAsterisks method. ThisdiamondOfAsterisks() 3 method contains the code that builds and displays themethod diamond based on the odd number entered.Program asks for user input 2 User must enter an odd numberProgram displays correct The diamond must have the number of rows entered by 5diamond the user Subtotal 15CLICK HERE TO GET THE SOLUTION !!!!!!!!!!

×