bartleby

Concept explainers

Expert Solution & Answer
Book Icon
Chapter 30.3, Problem 30.3.2CP

Explanation of Solution

Purpose of given code:

Purpose of given code is to display the count value, maximum value, minimum value, sum value, and average value of integer array “numbers”.

Given code:

//Variable definition

int[] numbers = {1, 4, 2, 3, 1};

/*Error #1*/

DoubleSummaryStatistics stats = DoubleStream.of(numbers).summaryStatistics();

/*Print statement with aggregate functions*/

/*Error #2*/

System.out.printf("The summary of the stream is\n%-10s%10d\n" +"%-10s%10.2f\n%-10s%10.2f\n%-10s%10.2f\n%-10s%10.2f\n","  Count:", stats.getCount(), "  Max:", stats.getMax(),"  Min:", stats.getMin(), "  Sum:", stats.getSum(),"  Average:", stats.getAverage());

Error #1:

The values of variable “numbers” are in “int” array. The above program uses “DoubleSummaryStatistics” instead of “IntSummaryStatistics”.

Error #2:

The resultant minimum, maximum, and sum value is integer...

Blurred answer
Students have asked these similar questions
https://docs.google.com/document/d/1lk0DgaWfVezagyjAEskyPoe9Ciw3J2XUH_HQfnWSmwU/edit?usp=sharing use the link to answer the question below  b) As part of your listed data elements, define the following metadata for each: Data/FieldType, Field Size, and any possible constraint/s or needed c) Identify and describe the relationship/s among the tables. Please provide an example toillustrate Referential Integrity and explain why it is essential for data credibility. I have inserted the data elements below for reference
Why do we use NAT and PAT technologies?  What happens without them? What is the major difference between NAT and PAT (Port Address Translation)? please answer it in the simplest way as possible
What is the difference between physical connection (Physical topology) and logical connection (Logical topology)? Why are both necessary? Why do we need the Seven-Layer OSI model? What will happen If we don’t have it? Why do we need official standards for copper cable and fiber-optic cable? What happens without the standard?  please answer in the simplest way as possible

Chapter 30 Solutions

MyLab Programming with Pearson eText -- Access Card -- for Introduction to Java Programming and Data Structures, Comprehensive Version

Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Text book image
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
Text book image
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:9781337102124
Author:Diane Zak
Publisher:Cengage Learning
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781305480537
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT