Design and implement a program called RainfallV2 that reads a list of floating-point numbers from the standard input (console) representing daily rainfall amounts in millimeters as entered by a user. Ignore negative values, but include zero values. Produce the following statistics based on the non-negative values in the list up to end of file: • total number of (nonnegative) values read • average rainfall • cumulative rainfall • number of rainy days (defined as above the daily average) • number of dry days (defined as at most 5% of the daily average) Input items (whole and/or floating point numbers) can be spread over one or more lines. If there is at least one input item, the program prints the resulting statistics and exits. If there is no valid numerical input item, the program prints nothing and exits. Nonfunctional requirements • Performance: o Time: For each additional input item, the program should produce a small, finite number of steps. o Space: For each additional input item, the program should use at most a constant amount of space. Testability: Your program could support automatic unit testing of the core functionality, without the user entering any data or reading any data from an external file. Implement your solution to the recurring rainfall problem as a working Java program using JUnit for testing. • Define separate classes for main (i/o), core logic, and testing. • Define a class called Rainfallstats for representing the statistics given above as a single object. • In the core logic class, define a (static) method that takes a List (important: List , not just an ArrayList ) and returns a RainfallStats instance. • In main, read the data into a list, initialized as an empty ArrayList , invoke the method for generating the stats, and print the resulting stats.
Design and implement a program called RainfallV2 that reads a list of floating-point numbers from the standard input (console) representing daily rainfall amounts in millimeters as entered by a user. Ignore negative values, but include zero values. Produce the following statistics based on the non-negative values in the list up to end of file: • total number of (nonnegative) values read • average rainfall • cumulative rainfall • number of rainy days (defined as above the daily average) • number of dry days (defined as at most 5% of the daily average) Input items (whole and/or floating point numbers) can be spread over one or more lines. If there is at least one input item, the program prints the resulting statistics and exits. If there is no valid numerical input item, the program prints nothing and exits. Nonfunctional requirements • Performance: o Time: For each additional input item, the program should produce a small, finite number of steps. o Space: For each additional input item, the program should use at most a constant amount of space. Testability: Your program could support automatic unit testing of the core functionality, without the user entering any data or reading any data from an external file. Implement your solution to the recurring rainfall problem as a working Java program using JUnit for testing. • Define separate classes for main (i/o), core logic, and testing. • Define a class called Rainfallstats for representing the statistics given above as a single object. • In the core logic class, define a (static) method that takes a List (important: List , not just an ArrayList ) and returns a RainfallStats instance. • In main, read the data into a list, initialized as an empty ArrayList , invoke the method for generating the stats, and print the resulting stats.
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
Related questions
Question
using JAVA

Transcribed Image Text:Design and implement a program called RainfallV2 that reads a list of floating-point numbers from the standard input
(console) representing daily rainfall amounts in millimeters as entered by a user. Ignore negative values, but include zero
values. Produce the following statistics based on the non-negative values in the list up to end of file:
• total number of (nonnegative) values read
• average rainfall
• cumulative rainfall
• number of rainy days (defined as above the daily average)
• number of dry days (defined as at most 5% of the daily average)
Input items (whole and/or floating point numbers) can be spread over one or more lines. If there is at least one input item, the
program prints the resulting statistics and exits. If there is no valid numerical input item, the program prints nothing and exits.
Nonfunctional requirements
• Performance:
o Time: For each additional input item, the program should produce a small, finite number of steps.
o Space: For each additional input item, the program should use at most a constant amount of space.
Testability: Your program could support automatic unit testing of the core functionality, without the user entering any data
or reading any data from an external file.
Implement your solution to the recurring rainfall problem as a working Java program using JUnit for testing.
• Define separate classes for main (i/o), core logic, and testing.
• Define a class called Rainfallstats for representing the statistics given above as a single object.
• In the core logic class, define a (static) method that takes a List (important: List , not just an ArrayList ) and returns a
Rainfallstats instance.
• In main, read the data into a list, initialized as an empty ArrayList , invoke the method for generating the stats, and print
the resulting stats.
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 3 images

Recommended textbooks for you

Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON

Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning

Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON

Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning

Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning

Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education

Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY