Homework 2 Solution 2

In intlargestlargestnumber intnumberuserinput

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: lication = new Palindrome(); application.checkPalindrome(); } } I deserve 10 out of 10 points because I was able to compile and run the Palindrome.java and PalindromeTest.java successfully. I was able to write the code that identifies if the inputted 5 digit number is a palindrome or not. Part 3: Largest.java & LargestTest.java (10 points) /* Name: Cameron Kroeker Class: CSE292 Java Hw 2: Largest.java Desc: Program determines and prints the largest of ten numbers. */ import java.util.Scanner; 4 public class Largest { public void determineLargest() // determine the largest of 10 numbers { Scanner input = new Scanner( System.in ); int largest; // largest number int number; // user input int counter; // number of values entered System.out.println("Please enter a number: "); number = input.nextInt(); largest = 0; counter = 1; while(counter < 10) { System.out.println("Please input another number: "); number = input.nextInt(); if(number > largest) { largest = number; } counter++; } System.out.printf( "Largest number is %d\n", largest ); } } /* Name: Cameron Kroeker Class: CSE292 Java Hw 2: LargestTest.java Desc: Test application for class Largest */ public class LargestTest { public static void main( String args ) { Largest application = new Largest(); application.determineLargest(); } } 5 I deserve 10 out of 10 points because I was able to successfully run and compile this java program. Largest.java will ask the user to input 10 numbers and it will display the largest number out of the 10 inputted. Part 4: DrawPanel.java & DrawPanelTest.java (10 points) /* Name: Cameron Kroeker Class: CSE292 Java Hw 2: DrawPanel.java Desc: Displays a Circle, Ellipse, Triangle, Filled Red Rectan...
View Full Document

Ask a homework question - tutors are online