Guest User

Untitled

a guest
Jan 13th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1.  
  2. Part I (40 points).
  3. Use a one-dimensional array to solve the following problem: Write an application called Unique.java that inputs five numbers, each between 10 and 100, inclusive. As each number is read from the console, display it only if it’s not a duplicate of a number already read. Use the smallest possible array to solve this problem. Display the complete set of unique values input after the user enters each new value. When the user has entered five different entries, the program terminates.
  4. Below a simple run is shown of this application:
  5. Enter number: 3
  6. number must be between 10 and 100
  7. Enter number: 15
  8. 15
  9. Enter number: 20
  10. 15 20
  11. Enter number: 30
  12. 15 20 30
  13. Enter number: 20
  14. 20 has already been entered
  15. 15 20 30
  16. Enter number: 40
  17. 15 20 30 40
  18. Enter number: 20
  19. 20 has already been entered
  20. 15 20 30 40
  21. Enter number: 200
  22. number must be between 10 and 100
  23. 15 20 30 40
  24. Enter number: 50
  25. 15 20 30 40 50
  26. End
Advertisement
Add Comment
Please, Sign In to add comment