How do I solve this code in Java? Statistics are often calculated with varying amounts of input
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Statistics are often calculated with varying amounts of input data. Write a program that takes any number of non-negative integers as input, and outputs the max and average. A negative integer ends the input and is not included in the statistics. Assume the input contains at least one non-negative integer. Output the average with two digits after the decimal point followed by a newline, which can be achieved as follows: average); System.out.printf("%.2f\n", Ex: When the input is: 15 20 0 3 -1 the output is: 20 9.50 Statistics are often calculated with varying amounts of input data. Write a program that takes any number of non-negative integers as input, and outputs the max and average. A negative integer ends the input and is not included in the statistics. Assume the input contains at least one non-negative integer. Output the average with two digits after the decimal point followed by a newline, which can be achieved as follows: average); System.out.printf("%.2f\n", Ex: When the input is: 15 20 0 3 -1 the output is: 20 9.50
Expert Answer:
Answer rating: 100% (QA)
CODE import javautilScanner public class StatisticsCalculator public static void mainString ... View the full answer
Related Book For
Management Accounting Information for Decision-Making and Strategy Execution
ISBN: 978-0137024971
6th Edition
Authors: Anthony A. Atkinson, Robert S. Kaplan, Ella Mae Matsumura, S. Mark Young
Posted Date:
Students also viewed these programming questions
-
Write a program that takes integers from the user one at a time. Assume the input is some number of positive integers. The user will type in 0 to end the input and the 0 should not be counted as...
-
An appropriate structure for large-scale distributed systems is as multiple, independently administered, firewall-protected, domains. Examples are a national health service, a national police service...
-
You are asked to identify the type of Business Information Systems that should be used for a proposed business (sections of business plan is attached). Next, you need to identify what kind of...
-
Vern Westby inherited a ticket from Anna Sjoblom, a survivor of the sinking of the Titanic, which had been pinned to the inside of her coat. He also inherited an album of postcards, some of which...
-
The Magic Teddy Bear Toy Company entered into the following transactions during January 2011: January 3:Purchased 7,000 teddy bears at $20 each with the terms 2/10, n/30. 3:Sold 2,000 teddy bears at...
-
How is the research of Trompenaars and Hampden-Turner similar to or different from that of Hofstede?
-
On April 20, 1992, Daniel Hubbard (plaintiff), a potato farmer, and UTZ Quality Foods, Inc. (UTZ) (defendant), a potato chip manufacturer, entered an installment contract under which Hubbard agreed...
-
Jim Andrews opened a delivery business in March. He rented a small office and has a part-time assistant. His trial balance shows accounts for the first three months of business. Andrews' transactions...
-
What are the reasons to use a relational database? What data does not fit well in the relational model?
-
On January 1, Year 2, PAT Ltd. acquired 90% of SAT Inc. when SAT's retained earnings were $1,000,000. There was no acquisition differential. PAT accounts for its investment under the cost method. SAT...
-
Use the data from the trial balance below to prepare an income statement. Please show your work to receive full credit. Some of the items will be needed and some will not. It can be a single step or...
-
The fundamental financial governing body for finance is the Chartered Financial Institute/Analyst Association (CFAI/CFA). Group of answer choices True False
-
Jacqui Capital has outstanding corporate bonds paying a 10% coupon semi annually, with a current yield to maturity of 8%. If Jacqui's tax rate is 35%, what is the company's effective cost of debt?
-
Stock a has a beta of 1.2. Stop B's better is 1.46. And stock sees better is 0.72 if you invest in stock a 3000 in Stock B and 5000 in stock C what will be the better of your portfolio?
-
The accrued salary expense journal entry is a debit to Salaries Expense and a credit to Salaries Payable for $1,000 on December 31. The company chooses not to record reversing entries and pays its...
-
A city in your state of residence is planning to host a concert that is expected to bring in several thousand people for the event. City planners will be managing the security and emergency services...
-
The graph of the parametric curve is O A circle with center (-37,-1) and with a clockwise direction. A circle with center (-37,-1) and with a counterclockwise direction. O A parabola with vertex...
-
The Dow Jones Industrial Average reached a high of $ 7801.63 on December 29, 1997. Recall from Example 18.4 that it reached a high of $ 1003 on November 14, 1972. The Consumer Price Index for...
-
Characteristics of a MACS: ethical framework List and describe the hierarchy of ethical considerations.
-
During data collection for the transition from an old management accounting system to a new activity-based cost management system, you see a managers reported time allotments. You know that the data...
-
Capacity and product mix decisions, linear programming Xu Company makes two types of wood doors: standard and deluxe. The doors are manufactured in a plant consisting of three departments: cutting,...
-
A change in chromosome structure that does not involve a change in the total amount of genetic material is a. a deletion. b. a duplication. c. an inversion. d. none of the above.
-
The term endopolyploidy refers to the phenomenon of having a. too many chromosomes. b. extra chromosomes inside the cell nucleus. c. extra sets of chromosomes in certain cells of the body. d. extra...
-
During transduction involving a P1 phage, a. any small fragment of the bacterial chromosome may be transferred to another bacterium by a new phage. b. only a specific fragment of DNA may be...
Study smarter with the SolutionInn App