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 a java applet for grade of gas in costco gas station

Write a java applet (not a java application program) for costco gas station. The applet will first ask you whether you are a costco customer, then the grade of gas you want to use.

  Create java application which creates random phone number

Create and implement Java application which creates and prints a random phone number of the form xxx-xxx-xxxx. Include the dashes in the output.

  Construct java program named collegelist

Construct a set of classes for a college to use in many student service and personnel applications. Classes you require to design include following:

  Utilizes a good design process

Analyze, design, and document a simple program that utilizes a good design process and incorporates sequential, selection and repetitive programming statements as well as at least one function call and the use of at least one array.

  Videorental store operatorrecord clients

Project is to design a program to help a videorental store operatorrecord clients' transactions - Design a primitive database indicating

  Java class to accept a user-s hourly rate of pay

Write a class that accepts a user's hourly rate of pay and the number of hours worked. Display the user's gross pay, the withholding tax (15% of gross pay), and the net pay (gross pay - withholding).

  Create a secure parts inventory catalog system

You will create a secure Parts Inventory Catalog system using Model 2 architecture. The application will require a user to have the proper access right to enter the system, and when satisfied, presents the catalog of items currently available in t..

  Distributed systems

Build robust, secure distributed systems using advanced programming techniques

  Write java program to read present basic hourly wage

Write down a java program which will input 1. Read present basic hourly wage. Read in workers fist name and socond name.

  Technical community blog

Write a blog article for a coding and technical community blog.

  Explain how the loop displaying the menu

Explain how the loop displaying the menu is exited, what value does menuSel have when the program finishes? Describe what happens next when menuSel gets this value.

  Create java applet to input miles driven and gallons used

Create the Java applet which will input miles driven and gallons used (both as integers) for each tankful. Program must compute and display miles per gallon obtained for each tankful.

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