(**Find the Largest Number**) The process of finding the largest value is used frequently in computer applications. For example, a program that determines the winner of a sales contest would input the number of units sold by each salesperson. The salesperson who sells the most units wins the contest. Write a pseudo code program, then a Java application that inputs a series of 10 integers and determines and prints the largest integer. Your program should use at least the following three variables:

a) counter: A counter to count to 10 (i.e., to keep track of how many numbers have been

input and to determine when all 10 numbers have been processed).

b) number: The integer most recently input by the user.

c) largest: The largest number found so far.

## Find the Largest Number in Java Program

**LargestNumber.java**

```
/*
* Filename: LargestNumber.java
*
* Description: Exercise 4.21 - Find the Largest Number
*
* @Author: Bilal Tahir Khan Meo
* Website: https://codeblah.com
*
* =====================================================================================
*/
public class LargestNumber{
int largest = 0;
public void enterNumber(int x){
largest = Math.max(x, largest);
}
public int getLargestNumber(){
return largest;
}
}
```

**LargestNumberTest.java**

```
/*
* Filename: LargestNumberTest.java
*
* Description: 4.21 - Find the largest in a sequence of 10 numbers
*
* @Author: Bilal Tahir Khan Meo
* Website: https://codeblah.com
*
* =====================================================================================
*/
import java.util.Scanner;
public class LargestNumberTest{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
LargestNumber ln = new LargestNumber();
for(int i=0; i<10; i++){
System.out.printf("%d/10. Enter a number: ", i+1);
ln.enterNumber(sc.nextInt());
}
System.out.printf("The largest number is: %d\n", ln.getLargestNumber());
}
}
```