Write a program that asks the user to input integers. The program should count the numbers...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a program that asks the user to input integers. The program should count the numbers and compute the total of all numbers entered and repeatedly ask the user to enter an integer until the user enters a negative intger. Then, it should display "The sum of the XX numbers processed is YYY" and end (where XX is the count value and YYY is the sum value). The program must use a JOptionPane for both the input of the number and to display the output of the count and sum of all numbers entered. Sample Run Screens Input ? Input Input ? Enter a number 21 OK Enter a number 76 Cancel Enter a number -1 Cancel OK Cancel X Write a program that asks the user to input integers. The program should count the numbers and compute the total of all numbers entered and repeatedly ask the user to enter an integer until the user enters a negative intger. Then, it should display "The sum of the XX numbers processed is YYY" and end (where XX is the count value and YYY is the sum value). The program must use a JOptionPane for both the input of the number and to display the output of the count and sum of all numbers entered. Sample Run Screens Input ? Input Input ? Enter a number 21 OK Enter a number 76 Cancel Enter a number -1 Cancel OK Cancel X
Expert Answer:
Answer rating: 100% (QA)
Here is the code import javaxswingJOptionPane public class Main public static void mainString args S... View the full answer
Related Book For
Java An Introduction To Problem Solving And Programming
ISBN: 9780134462035
8th Edition
Authors: Walter Savitch
Posted Date:
Students also viewed these programming questions
-
Wittwater Mining ple has bought mine where it plans to extract gravel for use in the construction industry. The mine is expected to supply gravel for five years and then be sold. The following...
-
Write a program that asks the user to input a vector of integers of arbitrary length. The program then counts the number of elements, the number of positive elements, and the number of negative...
-
Alpha Company used the periodic inventory system for purchase & sales of merchandise. Discount terms for both purchase & sales are, FOB Destination, 2/10, n30 and the gross method is used. > Alpha...
-
Oliveras Company had net credit sales during the year of $800,000 and cost of goods sold of $500,000. The balance in accounts receivable at the beginning of the year was $100,000, and the end of the...
-
What type of bonding mechanism would you expect for (a) HF, (b) KBr, (c) N2?
-
Discuss why the equity market is important to the economy.
-
Texas Inpatient Consultants, LLLP, is a partnership that employs physicians to deliver medical care to hospitalized patients of other physicians. Texas Inpatient recruited Julius Tabe, M.D., to work...
-
Gil Vogel started his own consulting firm, Vogel Consulting, on June 1, 2012. The trial balance at June 30 is as follows. In addition to those accounts listed on the trial balance, the chart of...
-
-. Use the Average Annual Costs of Owning and Operating a Car table below. If you drive 40,000 miles per year, what is the total annual expense for an electric car? (2 points) Average Annual Costs of...
-
Lydia Hartley, manager of UltraProducts New Zealand Division, is trying to set the production schedule for the last quarter of the year. The New Zealand Division had planned to sell 100,000 units...
-
For the frames below, classify each structure as stable, unstable, determinate, or indeterminate. If indeterminate, determine the degree of indeterminacy. (Show your work). (a) (b)
-
Analyze how Victors & Spoils could benefit from using a SWOT analysis, including the potential advantages of using a SWOTT over a SWOT. (Strength and Weaknesses: internal) (Opportunities and threats:...
-
Discuss interpretivism resea philpsophy in supply chain management in mining construction and projects using appropriate literature and explain why you chose it , , and add sources
-
Edgar accumulated $ 2 , 0 0 0 in credit card debt. If the interest rate is 4 0 % per year and he does not make any payments for 5 years, how much will he owe on this debt in 5 years for quarterly...
-
what ways can mindfulness and self-awareness practices enhance leaders' capacity to authentically inspire and empower others?
-
If the length of the pendulum is increased four times, a. the time-period will increase by four times b. decrease by four times increase by two times c. decrease by two times d. no change.
-
4. (30pts) Choose a point uniformly at random to be one of the four vertices of the diamond below. Let (X,Y) denote its coordinates, where X and Y are random variables that denote the horizontal and...
-
Suppose you need to answer any four of seven essay questions on a history test and you can answer them in any order. a. How many different question combinations are possible? b. What is the...
-
Revise the method selectionSort that appears in Listing 7.10 so that it calls the method described in the previous exercise. Listing 7.10 /** Class for sorting an array of base type int from smallest...
-
Write a fragment of code that computes the final score of a baseball game. Use a loop to read the number of runs scored by both teams during each of nine innings. Display the final score afterwards.
-
Consider a class that could be used to play a game of hangman. The class has the following attributes: The secret word. The disguised word, in which each unknown letter in the secret word is replaced...
-
A Consider \[\begin{cases}\dot{x}_{1}=-x_{1}\left|x_{1} ight|+a x_{2}-\frac{2}{3}+\sin t & x_{1}(0)=\frac{2}{3} \\ \dot{x}_{2}=-x_{1}-\frac{1}{2} x_{2}-1, & x_{2}(0)=1\end{cases}\] where \(a\) is a...
-
The governing equation for an RLC circuit driven by the applied voltage \(v_{a}(t)\) is derived as \[L \frac{d i}{d t}+R i+\frac{1}{C} \int i d t=v_{a}(t)\] where \(L=4 \mathrm{H}, R=4 \Omega\), and...
-
The pendulum system in Figure 8.35 consists of a uniform thin rod of length \(l\) and a concentrated mass \(m\) at its tip. The friction at the pivot causes the system to be damped. When the angular...
Study smarter with the SolutionInn App