The desired functionality is for your programs to input

Assignment Help JAVA Programming
Reference no: EM13346517

The desired functionality is for your programs to input pairs of natural numbers as they're entered by the user, until the user enters a zero as the first in a pair of numbers. The first number in each pair indicates a bin for the second number. For example, the pair of numbers 3 4 means that bin 3 contains the number 4. After the user enters a bin number of 0, your programs then allow the user to enter natural numbers until another 0 is entered; for every natural number i entered, your programs must output the product of all the numbers in bin i (or 0 if there are no numbers in that bin). Throughout all these operations, your programs must be reasonably efficient-there should never be long, noticeable pauses during execution.

Examples of Desired Behavior:

Enter a natural number: 1
Enter a natural number: 2
Enter a natural number: 1
Enter a natural number: 3
Enter a natural number: 1
Enter a natural number: 4
Enter a natural number: 0
Enter a natural number: 1
24
Enter a natural number: 0

(Here bin 1 contains 2, 3, and 4, so the product for bin 1 is 24)

Enter a natural number: 0
Enter a natural number: 2
0
Enter a natural number: 3
0
Enter a natural number: 1
0
Enter a natural number: 0

(Here no bins contain numbers, so 0 is returned for all of their products)

Enter a natural number: 0
Enter a natural number: 0

(Here no numbers are stored and no products are sought)

Enter a natural number: 70000
Enter a natural number: 9
Enter a natural number: 70000
Enter a natural number: 7
Enter a natural number: 100000
Enter a natural number: 1
Enter a natural number: 100000
Enter a natural number: 1
Enter a natural number: 200000
Enter a natural number: 5
Enter a natural number: 200000
Enter a natural number: 0
Enter a natural number: 200000
Enter a natural number: 7
Enter a natural number: 0

Enter a natural number: 70000
63
Enter a natural number: 100000
1
Enter a natural number: 200000
0
Enter a natural number: 1
0
Enter a natural number: 0

Reference no: EM13346517

Questions Cloud

1 is your nbspportfolio balancednbsp justify your answer2 : 1. is your nbspportfolio balanced?nbsp justify your answer.2. what changes would you make if any?a high portfolio beta
1 if a swot analysis reveals that an objective is : 1. if a swot analysis reveals that an objective is unattainable apart from changing the objective what other changes
Part aexplain why the payment to the taxpayer in fct v : part aexplain why the payment to the taxpayer in fct v dixon 1952 86 clr 540 was assessable income but the payment in
1- lets say you were tasked with designing a : 1- lets say you were tasked with designing a neuroprosthesis for the neurological disorders below. which brain
The desired functionality is for your programs to input : the desired functionality is for your programs to input pairs of natural numbers as theyre entered by the user until
Convergence of international financial reporting : convergence of international financial reporting standardsessay addressed the following questionsa. critical ly review
1 the approved budget for 1997 reduced government spending : 1. the approved budget for 1997 reduced government spending in housing and urban development health and human service
Stiglers private interest theory proposes that regulatory : stiglers private interest theory proposes that regulatory bodies including accounting standard setters are made up of
Write a profile on bishop poleniresearch on how to write : write a profile on bishop poleni.research on how to write profiles and write a profile on bishop

Reviews

Write a Review

JAVA Programming Questions & Answers

  Web engineering principles

web application development, Web Engineering methodology, UML-based Web Engineering (UWE), models to the expansion of web applications, Object Oriented Web Solutions (OOWS),Web Modeling Language (WebML) methodology, Object-Oriented Hypermedia Design..

  Java script program for song

Construct a JavaScript program that declares and prints an array that includes at least twenty of your favorite songs.

  Write a program in which a ball is released

Write a program in which a ball is released from a user-defined height and free-falls to the ground. The ball is pulled by earth's gravity of 9.8 m/sec 2 . Assume that each pixel represents 1 cm. Once the ball hits the ground

  Display random numbers to simulate rolling a die

1. Display random numbers to simulate rolling a die2. Create a java program that simulate a casino game. (rollin a die)

  Assume an ideal gas mixture is in contact with water

Assume an ideal gas mixture is in contact with water. Determine the equilibrium concentration of the contaminant in the liquid is the gas stream is composed of 200 ppm of benzene in air

  Create a class account that represents a banking account.

Create a class Account that represents a banking account.

  Solve the currently very un-pc cigarette smokers problem

Write solution to solve the currently very un-PC"cigarette smokers problem" in java using Java threads, and monitors (using the "synchronized" keyword) (If it bothers your PC sensibilities, think of it at the Pot-smokers problem and then it is all pr..

  Write java program using array list object

Write a java program (using eclipse) using ArrayList object to allow the professor to enter student's name, his or her's four test scores.

  Create a world class that contains a 2d array

You have to create a world class that contains a 2d array then create an abstract class called organism that contains move() method the organism should move randomly one step at the time.

  The data file being used contains records

The data file being used contains records with an employee's name, the number of hours they worked, and their hourly pay rate. Write a program to read the records of information and output (to the Output window or a dialog box) the employee's name..

  Java program to declares integer array

Write a complete Java program to declares integer array, intArray, and initialize it to {1, 2, 3, 4, 5, 6, 7}.

  Instance methods

instance methods: setWidth(double w), setHeight(double h), double getWidth(), double getHeight() and double getArea() * A triangle's area is calculated by width*height*0.5  * all variables are private and methods public.

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