Reads in up to 1000 non-negative integers

Assignment Help JAVA Programming
Reference no: EM13159557

Write a program that reads in up to 1000 non-negative integers and displays distinct numbers (i.e., if a number appears multiple times, it is displayed only once). (Hint: Read each number and store it in an array if it is new. If the number is already in the array, ignore it.) The user will indicate that they are done entering numbers by entering a negative number. After the input, the array must contain the distinct numbers. Here is a sample run:

Enter a non-negative integer (negative to quit): 1
Enter a non-negative integer (negative to quit): 2
Enter a non-negative integer (negative to quit): 3
Enter a non-negative integer (negative to quit): 2
Enter a non-negative integer (negative to quit): 1
Enter a non-negative integer (negative to quit): 6
Enter a non-negative integer (negative to quit): 3
Enter a non-negative integer (negative to quit): 4
Enter a non-negative integer (negative to quit): 5
Enter a non-negative integer (negative to quit): 2
Enter a non-negative integer (negative to quit): -4
You entered: 
1 2 3 6 4 5 

To get credit for this assignment you must use appropriate decomposition! You should have a method to read the numbers and a method to print the resulting array. The method to read the numbers should call an additional method that reads (and processes) a single number.

Reference no: EM13159557

Questions Cloud

Problem on unadjusted trial balance : Prepare the adjusting entry for Vizarro Co. to recognize bad debts under each of the following independent assumptions.
Find confidence interval and mean number of unoccupied seats : Assume the population standard deviation of unoccupied seats for all flights for this airline is equal to 4.103. Find a 90% confidence interval for μ and the mean number of unoccupied seats
Compute the ph at the equivalence point in titrating : Calculate the pH at the equivalence point in titrating 0.120 M solutions of each of the following with 8.0* 10^-2 M NaOH
When a continuous fermenter is in steady state which is true : When a continuous fermenter is in steady state which is true?
Reads in up to 1000 non-negative integers : Write a program that reads in up to 1000 non-negative integers and displays distinct numbers (i.e., if a number appears multiple times, it is displayed only once). (Hint: Read each number and store it in an array if it is new. If the number is alread..
Elasticity affect demand for higher education at college : How important were price considerations in making your college decision? Would a change of a few thousand dollars have mattered and would you expect the price elasticity of demand to be higher for financial-aid students or for non-aid students?
Causes of the sectional crisis : Evaluate the causes of the sectional crisis of the 1850s. could anything have been done to resolve the issues of the period?
Find margin of error if probability is given : It is known that the standard deviation of the population of checkout times is one minute. With a .95 probability, the sample mean will provide a margin of error of?
Circumstances would you not want to create : Under what circumstances would you not want to create one physical table for every relation in your logical data model? Give a concrete example.

Reviews

Write a Review

JAVA Programming Questions & Answers

  Write down java program for furniture company

Write down a Java program for the furniture company. Ask user to select P for Pine, O for Oak or M for Mahogany. Illustrate price of table manufactured with chosen wood.

  Uml exercise

UML Exercise: Automated Teller Machine (ATM),   1. To allow authorized card holders to make transactions,   Brief Summary of Requirements:

  Finding java code error

Indicate in the given code segment if an error occurs. If so, point to whether it is syntax, runtime or logic and how you would fix it.

  Write ijvm program to multiply two hexadecimal numbers

Write the IJVM program that multiplies two (hexadecimal) numbers. The user inputs the hex numbers and the result is printed out. The program then accepts another pair of numbers.

  Tracer for java

Implementation of a tracer of Java objects and the tracer can be invoked from any point of a Java program, accepting an object as argument.

  Write a program to register students for a college

Students have names, addresses and courses. Implement the interface class RegisterStudent. RegisterStudent has one method, public boolean register, which returns the boolean value of true or false if the student is successfully registered for the ..

  Mean and standard deviation using using eclipse

Java programming to calculate Mean and standard deviation using Using Eclipse.

  Write java program to find calories-conditional operator

Write down the answer for this program? Write down Java program (use Conditional (? Operator) which suggests number of calories a person must eat each day.

  Robot preparing for competition

Create an event so that the skateboard can be controlled by game player

  Write java program to compute how much federal need to pay

Write a java application to calculate how much federal and state tax you need to pay. The program should accomplish the following task.

  Java program which demonstrates cellular automata

Using the internet, locate a Java program (or Java applet) which demonstrates "Cellular Automata", in particular "the Game of Life".

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd