Hello, can you please help me do this Java program using the two attached pics, here are the instructions: Problem Description: Use a one-dimensional array to solve the following problem: Request five unique numbers, each of which is between 10 and 100, inclusively. As each number is read, display it only if it is not a duplicate of a number already read, providing for the “worst case”, which is all five numbers are different. Use the smallest possible array to solve this problem. Display the complete set of unique values input after the user inputs each new value. Programming Steps 1. Download the provided programs Project7_UniqueNumbers.java and Project7_UniqueNumbersTest.java 2. Complete the programs to use arrays in your compiler a. There are nine (9) TODOs i. Seven (7) in Project7_UniqueNumbers.java ii. Two (2) in Project7_UniqueNumbersTest.java b. You should add necessary statements/structures to the given programs as instructed in the comments 3. Debug and run your application

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter4: More Object Concepts
Section: Chapter Questions
Problem 5RQ
icon
Related questions
Question

Hello, can you please help me do this Java program using the two attached pics, here are the instructions:


Problem Description:
Use a one-dimensional array to solve the following problem:
Request five unique numbers, each of which is between 10 and 100, inclusively. As each number is read,
display it only if it is not a duplicate of a number already read, providing for the “worst case”, which is all
five numbers are different.
Use the smallest possible array to solve this problem. Display the complete set of unique values input
after the user inputs each new value.
Programming Steps
1. Download the provided programs Project7_UniqueNumbers.java and
Project7_UniqueNumbersTest.java
2. Complete the programs to use arrays in your compiler
a. There are nine (9) TODOs
i. Seven (7) in Project7_UniqueNumbers.java
ii. Two (2) in Project7_UniqueNumbersTest.java
b. You should add necessary statements/structures to the given programs as instructed in
the comments
3. Debug and run your application

* Project Assignment
7: Project7_UniqueNumbers Test.java
* A Java application for class Project7_UniqueNumbers
* TODO1b: change the name to your name and date to the current date
* Creaed by Your Name, Current date
public class Project7_UniqueNumbers Test
{
public static void main(String args[])
{
//TODO#8: Create an object of Project7_UniqueNumbers named app
//TODO#9: Call the method getNumbers to invoke the task
}//end main method
} //end class Project7_UniqueNumbers Test
Transcribed Image Text:* Project Assignment 7: Project7_UniqueNumbers Test.java * A Java application for class Project7_UniqueNumbers * TODO1b: change the name to your name and date to the current date * Creaed by Your Name, Current date public class Project7_UniqueNumbers Test { public static void main(String args[]) { //TODO#8: Create an object of Project7_UniqueNumbers named app //TODO#9: Call the method getNumbers to invoke the task }//end main method } //end class Project7_UniqueNumbers Test
/*************
* Project Assignment 7: Project7_UniqueNumbers.java
* Program reads in 5 unique numbers,
eliminates the duplicate if there is any
***********
TODO1a: change the name to your name and date to the current date
* Creaed by Your Name, Current date
import java.util.Scanner;
public class Project7_UniqueNumber's
//Get 5 unique numbers from the user
public void getNumbers()
{
Scanner input new Scanner(System.in);
/* TODOI12: Create an integer array called uniqueList with five elements */
int count=0; //number of uniques read in
int enteredNumber; //to hold the number user cered
boolean containsNumber; //to flag whether the entered number already exists
while (count < uniqueList.length)
{
//Initialize it for the next entered number
containsNumber = false;
System.out.print("Enter an integer (10 - 100): ");
/* TODO#3: Write code here to retrieve the input from the user and assign to enteredNumber */
//Validate the input
/* TODO||4: Write an if statement that validates the input enteredNumber */
{
}
//Add the first number to uniqueList, no comparison needed
if (count==0)
{
uniqueList[0] = enteredNumber;
System.out.println(uniqueList[0]);
count++;
continue;
}
/* TODOS: Compare the user input to the unique numbers in the array using a for loop.
If the entered number is not unique, set contains Number to true */
//Add the user input to the array only if the number is not already in the array
if (!containsNumber) //searched to the end of the list, no duplicate
{
/* TODO#16: Write code to add the entered number to the array and increment unique items count */
}
else //if (contains Number)
{
}
}//end of if branch to validate the input enteredNumber
else
{
System.out.printf("%d has already been entered!\n\n", entered Number);
}//end class Project7_UniqueNumbers
System.out.println("The entered number must be between 10 and 100, inclusively! \n");
//Print the list of unique values
/* TODO#7: Write code to output the contents of the array using a for loop */
}//end while (count < uniqueList.length)
}//end getNumbers method
Transcribed Image Text:/************* * Project Assignment 7: Project7_UniqueNumbers.java * Program reads in 5 unique numbers, eliminates the duplicate if there is any *********** TODO1a: change the name to your name and date to the current date * Creaed by Your Name, Current date import java.util.Scanner; public class Project7_UniqueNumber's //Get 5 unique numbers from the user public void getNumbers() { Scanner input new Scanner(System.in); /* TODOI12: Create an integer array called uniqueList with five elements */ int count=0; //number of uniques read in int enteredNumber; //to hold the number user cered boolean containsNumber; //to flag whether the entered number already exists while (count < uniqueList.length) { //Initialize it for the next entered number containsNumber = false; System.out.print("Enter an integer (10 - 100): "); /* TODO#3: Write code here to retrieve the input from the user and assign to enteredNumber */ //Validate the input /* TODO||4: Write an if statement that validates the input enteredNumber */ { } //Add the first number to uniqueList, no comparison needed if (count==0) { uniqueList[0] = enteredNumber; System.out.println(uniqueList[0]); count++; continue; } /* TODOS: Compare the user input to the unique numbers in the array using a for loop. If the entered number is not unique, set contains Number to true */ //Add the user input to the array only if the number is not already in the array if (!containsNumber) //searched to the end of the list, no duplicate { /* TODO#16: Write code to add the entered number to the array and increment unique items count */ } else //if (contains Number) { } }//end of if branch to validate the input enteredNumber else { System.out.printf("%d has already been entered!\n\n", entered Number); }//end class Project7_UniqueNumbers System.out.println("The entered number must be between 10 and 100, inclusively! \n"); //Print the list of unique values /* TODO#7: Write code to output the contents of the array using a for loop */ }//end while (count < uniqueList.length) }//end getNumbers method
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 3 images

Blurred answer
Knowledge Booster
Array
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT