SlideShare une entreprise Scribd logo
1  sur  3
CIS/355 iLab 2 of 6



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.



Grading Rubric
            Largest               Points                         Description

                                           Must contain program's name, student name, and
Standard header included             1
                                           description of the program

Program compiles                     2     Program does not have any error

Program executes                     2     Program runs without any error

Only single digit numbers                  Program validates number entered is a single digit
                                     2
are entered                                number

Program displays the largest               Program displays the largest number after all 10 numbers
                                     3
number                                     are entered

                       Subtotal     10



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.


Grading Rubric
          Palindrome              Points                          Description

                                           Must contain program’s name, student name, and
Standard header included            1
                                           description of the program

Program compiles                    1      Program does not have any error

Program executes                    1      Program runs without any error

Program contains main
                                    1      Program contains main method
method

Program contains                           retrieveInput method exists, retrieves the user input, and
                                    2
retrieveInput() method                     checks if input is numeric and has five digits

Program contains check()                   check method exists and checks if number entered is a
                                    2
method                                     palindrome

Program contains display()                 display method exists and displays the result if palindrome
                                    2
method                                     or not

Value entered is numeric                   Program validates input to make sure it is numeric and
                                    2
and has 5 digits                           has five digits

                                           Program displays the correct message for the number
Correct output is displayed         3
                                           entered

                       Subtotal    15



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.

   *
  ***
 *****
*******
 *****
  ***
   *
Grading Rubric
         Diamond               Points                        Description

                                        Must contain program’s name, student name, and
Standard header included         1
                                        description of the program

Program compiles                 1      Program does not have any error

Program executes                 1      Program runs without any error

Program contains main                   Program contains the main method where user is asked
                                 2
method                                  to enter an odd number

Program contains                        Program contains the diamondOfAsterisks method. This
diamondOfAsterisks()             3      method contains the code that builds and displays the
method                                  diamond based on the odd number entered.

Program asks for user input      2      User must enter an odd number

Program displays correct                The diamond must have the number of rows entered by
                                 5
diamond                                 the user

                    Subtotal    15



CLICK HERE TO GET THE SOLUTION !!!!!!!!!!

Contenu connexe

Tendances

Tendances (20)

9781111530532 ppt ch02
9781111530532 ppt ch029781111530532 ppt ch02
9781111530532 ppt ch02
 
Computer Programming, Loops using Java
Computer Programming, Loops using JavaComputer Programming, Loops using Java
Computer Programming, Loops using Java
 
Chapter 3 branching v4
Chapter 3 branching v4Chapter 3 branching v4
Chapter 3 branching v4
 
Chapter 13 exceptional handling
Chapter 13 exceptional handlingChapter 13 exceptional handling
Chapter 13 exceptional handling
 
C++ lab assignment
C++ lab assignmentC++ lab assignment
C++ lab assignment
 
c++ lab manual
c++ lab manualc++ lab manual
c++ lab manual
 
Computer Programming, Loops using Java - part 2
Computer Programming, Loops using Java - part 2Computer Programming, Loops using Java - part 2
Computer Programming, Loops using Java - part 2
 
Python Lecture 2
Python Lecture 2Python Lecture 2
Python Lecture 2
 
Cp manual final
Cp manual finalCp manual final
Cp manual final
 
03b loops
03b   loops03b   loops
03b loops
 
Lecture 1
Lecture 1Lecture 1
Lecture 1
 
Python Flow Control
Python Flow ControlPython Flow Control
Python Flow Control
 
C programming notes
C programming notesC programming notes
C programming notes
 
Preprocessor
PreprocessorPreprocessor
Preprocessor
 
Csphtp1 04
Csphtp1 04Csphtp1 04
Csphtp1 04
 
C++ ppt
C++ pptC++ ppt
C++ ppt
 
02 iec t1_s1_oo_ps_session_02
02 iec t1_s1_oo_ps_session_0202 iec t1_s1_oo_ps_session_02
02 iec t1_s1_oo_ps_session_02
 
C language UPTU Unit3 Slides
C language UPTU Unit3 SlidesC language UPTU Unit3 Slides
C language UPTU Unit3 Slides
 
COMP 122 Entire Course NEW
COMP 122 Entire Course NEWCOMP 122 Entire Course NEW
COMP 122 Entire Course NEW
 
Debugging
DebuggingDebugging
Debugging
 

Similaire à Cis 355 ilab 2 of 6

CIS/355 ilab 6 of 6
CIS/355 ilab 6 of 6CIS/355 ilab 6 of 6
CIS/355 ilab 6 of 6helpido6
 
Cis 355 ilab 6 of 6
Cis 355 ilab 6 of 6Cis 355 ilab 6 of 6
Cis 355 ilab 6 of 6ashhadiqbal
 
Cis 355 i lab 1 of 6
Cis 355 i lab 1 of 6Cis 355 i lab 1 of 6
Cis 355 i lab 1 of 6helpido6
 
Cis 355 ilab 6 of 6
Cis 355 ilab 6 of 6Cis 355 ilab 6 of 6
Cis 355 ilab 6 of 6comp274
 
Cis 355 i lab 6 of 6
Cis 355 i lab 6 of 6Cis 355 i lab 6 of 6
Cis 355 i lab 6 of 6solutionjug4
 
Cis 355 i lab 6 of 6
Cis 355 i lab 6 of 6Cis 355 i lab 6 of 6
Cis 355 i lab 6 of 6helpido9
 
Cis 355 ilab 3 of 6
Cis 355 ilab 3 of 6Cis 355 ilab 3 of 6
Cis 355 ilab 3 of 6ashhadiqbal
 
Cis 355 i lab 3 of 6
Cis 355 i lab 3 of 6Cis 355 i lab 3 of 6
Cis 355 i lab 3 of 6helpido6
 
Cis 355 ilab 3 of 6
Cis 355 ilab 3 of 6Cis 355 ilab 3 of 6
Cis 355 ilab 3 of 6solutionjug2
 
Examples Of Algorithm.pptx
Examples Of Algorithm.pptxExamples Of Algorithm.pptx
Examples Of Algorithm.pptxNomAnAli231509
 
Oop lab assignment 01
Oop lab assignment 01Oop lab assignment 01
Oop lab assignment 01Drjilesh
 
Unit 1 program development cycle
Unit 1 program development cycleUnit 1 program development cycle
Unit 1 program development cycleDhana malar
 
Fundamentals of programming with C++
Fundamentals of programming with C++Fundamentals of programming with C++
Fundamentals of programming with C++Seble Nigussie
 
Important C program of Balagurusamy Book
Important C program of Balagurusamy BookImportant C program of Balagurusamy Book
Important C program of Balagurusamy BookAbir Hossain
 
9781111530532 ppt ch02
9781111530532 ppt ch029781111530532 ppt ch02
9781111530532 ppt ch02Terry Yoast
 
Cis 355 ilab 4 of 6
Cis 355 ilab 4 of 6Cis 355 ilab 4 of 6
Cis 355 ilab 4 of 6ashhadiqbal
 

Similaire à Cis 355 ilab 2 of 6 (20)

CIS/355 ilab 6 of 6
CIS/355 ilab 6 of 6CIS/355 ilab 6 of 6
CIS/355 ilab 6 of 6
 
Cis 355 ilab 6 of 6
Cis 355 ilab 6 of 6Cis 355 ilab 6 of 6
Cis 355 ilab 6 of 6
 
Cis 355 i lab 1 of 6
Cis 355 i lab 1 of 6Cis 355 i lab 1 of 6
Cis 355 i lab 1 of 6
 
Cis 355 ilab 6 of 6
Cis 355 ilab 6 of 6Cis 355 ilab 6 of 6
Cis 355 ilab 6 of 6
 
Cis 355 i lab 6 of 6
Cis 355 i lab 6 of 6Cis 355 i lab 6 of 6
Cis 355 i lab 6 of 6
 
Cis 355 i lab 6 of 6
Cis 355 i lab 6 of 6Cis 355 i lab 6 of 6
Cis 355 i lab 6 of 6
 
Cis 355 ilab 3 of 6
Cis 355 ilab 3 of 6Cis 355 ilab 3 of 6
Cis 355 ilab 3 of 6
 
Cis 355 i lab 3 of 6
Cis 355 i lab 3 of 6Cis 355 i lab 3 of 6
Cis 355 i lab 3 of 6
 
Cis 355 ilab 3 of 6
Cis 355 ilab 3 of 6Cis 355 ilab 3 of 6
Cis 355 ilab 3 of 6
 
Module 1 python.pptx
Module 1 python.pptxModule 1 python.pptx
Module 1 python.pptx
 
Examples Of Algorithm.pptx
Examples Of Algorithm.pptxExamples Of Algorithm.pptx
Examples Of Algorithm.pptx
 
09 Methods
09 Methods09 Methods
09 Methods
 
Cpp Homework Help
Cpp Homework Help Cpp Homework Help
Cpp Homework Help
 
Oop lab assignment 01
Oop lab assignment 01Oop lab assignment 01
Oop lab assignment 01
 
If switch structure
If switch structureIf switch structure
If switch structure
 
Unit 1 program development cycle
Unit 1 program development cycleUnit 1 program development cycle
Unit 1 program development cycle
 
Fundamentals of programming with C++
Fundamentals of programming with C++Fundamentals of programming with C++
Fundamentals of programming with C++
 
Important C program of Balagurusamy Book
Important C program of Balagurusamy BookImportant C program of Balagurusamy Book
Important C program of Balagurusamy Book
 
9781111530532 ppt ch02
9781111530532 ppt ch029781111530532 ppt ch02
9781111530532 ppt ch02
 
Cis 355 ilab 4 of 6
Cis 355 ilab 4 of 6Cis 355 ilab 4 of 6
Cis 355 ilab 4 of 6
 

Plus de ashhadiqbal

Comp 220 ilab 6 of 7
Comp 220 ilab 6 of 7Comp 220 ilab 6 of 7
Comp 220 ilab 6 of 7ashhadiqbal
 
Comp 220 ilab 5 of 7
Comp 220 ilab 5 of 7Comp 220 ilab 5 of 7
Comp 220 ilab 5 of 7ashhadiqbal
 
Comp 220 ilab 3 of 7
Comp 220 ilab 3 of 7Comp 220 ilab 3 of 7
Comp 220 ilab 3 of 7ashhadiqbal
 
Comp 220 ilab 7 of 7
Comp 220 ilab 7 of 7Comp 220 ilab 7 of 7
Comp 220 ilab 7 of 7ashhadiqbal
 
CIS/336 ilab 5 of 7
CIS/336 ilab 5 of 7CIS/336 ilab 5 of 7
CIS/336 ilab 5 of 7ashhadiqbal
 
CIS/336 ilab 1 of 7
CIS/336 ilab 1 of 7CIS/336 ilab 1 of 7
CIS/336 ilab 1 of 7ashhadiqbal
 
CIS/115 ilab 4 of 7
CIS/115 ilab 4 of 7CIS/115 ilab 4 of 7
CIS/115 ilab 4 of 7ashhadiqbal
 

Plus de ashhadiqbal (11)

Ilab 2 of 7
Ilab 2 of 7Ilab 2 of 7
Ilab 2 of 7
 
Comp 220 ilab 6 of 7
Comp 220 ilab 6 of 7Comp 220 ilab 6 of 7
Comp 220 ilab 6 of 7
 
Comp 220 ilab 5 of 7
Comp 220 ilab 5 of 7Comp 220 ilab 5 of 7
Comp 220 ilab 5 of 7
 
Comp 220 ilab 3 of 7
Comp 220 ilab 3 of 7Comp 220 ilab 3 of 7
Comp 220 ilab 3 of 7
 
Comp 220 ilab 7 of 7
Comp 220 ilab 7 of 7Comp 220 ilab 7 of 7
Comp 220 ilab 7 of 7
 
CIS/336 ilab 5 of 7
CIS/336 ilab 5 of 7CIS/336 ilab 5 of 7
CIS/336 ilab 5 of 7
 
CIS/336 ilab 1 of 7
CIS/336 ilab 1 of 7CIS/336 ilab 1 of 7
CIS/336 ilab 1 of 7
 
CIS/115 ilab 4 of 7
CIS/115 ilab 4 of 7CIS/115 ilab 4 of 7
CIS/115 ilab 4 of 7
 
PRG/421 Week 4
PRG/421 Week 4PRG/421 Week 4
PRG/421 Week 4
 
PRG/421 Week 2
PRG/421 Week 2PRG/421 Week 2
PRG/421 Week 2
 
PRG/421 Week 1
PRG/421 Week 1PRG/421 Week 1
PRG/421 Week 1
 

Cis 355 ilab 2 of 6

  • 1. CIS/355 iLab 2 of 6 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. Grading Rubric Largest Points Description Must contain program's name, student name, and Standard header included 1 description of the program Program compiles 2 Program does not have any error Program executes 2 Program runs without any error Only single digit numbers Program validates number entered is a single digit 2 are entered number Program displays the largest Program displays the largest number after all 10 numbers 3 number are entered Subtotal 10 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;
  • 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, and Standard header included 1 description of the program Program compiles 1 Program does not have any error Program executes 1 Program runs without any error Program contains main 1 Program contains main method method Program contains retrieveInput method exists, retrieves the user input, and 2 retrieveInput() method checks if input is numeric and has five digits Program contains check() check method exists and checks if number entered is a 2 method palindrome Program contains display() display method exists and displays the result if palindrome 2 method or not Value entered is numeric Program validates input to make sure it is numeric and 2 and has 5 digits has five digits Program displays the correct message for the number Correct output is displayed 3 entered Subtotal 15 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. * *** ***** ******* ***** *** *
  • 3. Grading Rubric Diamond Points Description Must contain program’s name, student name, and Standard header included 1 description of the program Program compiles 1 Program does not have any error Program executes 1 Program runs without any error Program contains main Program contains the main method where user is asked 2 method to enter an odd number Program contains Program contains the diamondOfAsterisks method. This diamondOfAsterisks() 3 method contains the code that builds and displays the method diamond based on the odd number entered. Program asks for user input 2 User must enter an odd number Program displays correct The diamond must have the number of rows entered by 5 diamond the user Subtotal 15 CLICK HERE TO GET THE SOLUTION !!!!!!!!!!