In this question you are required to define a class named Rainfall that contain the following:...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
In this question you are required to define a class named Rainfall that contain the following: • Define private instance variable array for rainAmount and for month Name. You may consider these two array as parallel array. Example: private String monthName []; • Define default constructor and constructor that takes two arguments for rain amount and name of the month to initialize the instance variables. Define getter and setter methods for each instance variable. • Define public method compute TotalRainfall to calculate and return the amount of rain. • Define public method computeAverageRainFall that calculate and return the average rainfall for a year. . Define computeMinRainFall and computeMaxRainFall mehods. • Define toString() and equals () method also. . 1. Write the code for the class Rainfall as described. 2. Write a TestRainfall class with main method that creates two Rainfall objects and invokes all methods of Rainfall class 3. Create an array of ten Rainfall objects. After creating this array, use a loop to print all ten elements. java output In this question you are required to define a class named Rainfall that contain the following: • Define private instance variable array for rainAmount and for month Name. You may consider these two array as parallel array. Example: private String monthName []; • Define default constructor and constructor that takes two arguments for rain amount and name of the month to initialize the instance variables. Define getter and setter methods for each instance variable. • Define public method compute TotalRainfall to calculate and return the amount of rain. • Define public method computeAverageRainFall that calculate and return the average rainfall for a year. . Define computeMinRainFall and computeMaxRainFall mehods. • Define toString() and equals () method also. . 1. Write the code for the class Rainfall as described. 2. Write a TestRainfall class with main method that creates two Rainfall objects and invokes all methods of Rainfall class 3. Create an array of ten Rainfall objects. After creating this array, use a loop to print all ten elements. java output
Expert Answer:
Answer rating: 100% (QA)
Below is the Java code for the Rainfall class and the TestRainfall class public class Rainfall private double rainAmount private String monthName Default constructor public Rainfall rainAmount new dou... 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
-
6. Consider the linear system 3x1 +52 = 3 3x1 + 4x2 = 4 2x1 +32=5 (a) Find the projection b, of the vector of the right hand sides to the column space of the coefficient matrix. (b) Compute the...
-
Garth is married to Hana, a native and citizen of Norway. Garth is a U.S. citizen. They live in New York City. He owns a life insurance policy on his life. The latest statement from the life...
-
Case Study: Quick Fix Dental Practice Technology requirements Application must be built using Visual Studio 2019 or Visual Studio 2017, professional or enterprise. The community edition is not...
-
The roller coaster in Figure P6.36 starts with a velocity of 15 m/s. One of the riders is a small girl of mass 30 kg. Find her apparent weight when the roller coaster is at locations B and C. At...
-
In this chapter and elsewhere we have argued that a stocks market price can deviate from its intrinsic value. Discuss the following question: If all investors attempt to behave in an entirely...
-
An empty cannister of volume 1 L is filled with R-134a from a line flowing saturated liquid R-134a at 0oC. The filling is done quickly so it is adiabatic. How much mass of R-134a is there after...
-
Suppose you know that the receptor for a hormone you are studying is found in the target cells cytoplasm. Are you studying a protein hormone or a steroid hormone?
-
Tricorn Engineering performs cement core tests in its Dallas laboratory. The following standard costs for the tests have been developed by the company's controller, Andrew Nichols, based on...
-
What specific recommendations do you have for Marguerite with respect to earned and paid media?
-
Paul and his wife Gail jointly own (50% each) a piece of vacant land north of Toronto. This land was purchased on January 1, 2017 at a cost of $500,000. On the purchase they paid $25,000 in legal...
-
Create an Echo Client Server Application using TCP Protocol with close chat With a simple explanation code
-
If a company spends $80 million to build facility space sufficient to hold 5 million pairs of footwear-making equipment at a site in Latin America, then the company's annual depreciation costs for...
-
What constitutes the most formidable aspect of assuming a managerial role, considering the intricate array of responsibilities, decision-making processes, and interpersonal dynamics inherent in...
-
Aggie Grill is considering the purchase of an $8,000,000 flat-top grill. The grill has an economic life of 6 years and will be fully depreciated using the straight-line method. The grill is expected...
-
What attributes and characteristics distinguish an effective manager, encompassing a spectrum of competencies, leadership styles, and strategic acumen essential for navigating the complexities of...
-
Regardless of what number you calculated for Scott's 2023-equivalent rent payment, assume $12,000/ month. Given this, what annual interest rate is needed to get from their $300/mo. in 1923 to...
-
An investment company is studying the creation of a financial security that will bear the symbol CSI and will give right to a payment in one year of $150 in the pessimistic scenario and $260 in the...
-
Using the information presented in Problem 13.4B, prepare a partial statement of cash flows for the current year, showing the computation of net cash flows from operating activities using the...
-
What output will be produced by the following code? public class Demo { public static void main(String[] args) { System.out.println("The output is:"); foo(23); System.out.println(); } public static...
-
Consider the previous question, but include + or letter grades. A+ is 4.25, A is 3.75, B+ is 3.25, B is 2.75, and so on. a. Why cant we use one switch statement with no other conditionals to convert...
-
Write a program that will read a text file that contains an unknown number of movie review scores. Read the scores as Double values and put them in an instance of ArrayList. Compute the average score.
-
Determine and plot the frequency response of the filter shown in Figure 4.41, considering the two possible positions for the switches. x(n) -z-2 -z-2 -z-2 z-4 z-4 Fig. 4.41. Signal flowgraph of a...
-
Determine the impulse response of the filter shown in Figure 4.42. x(n) 0.5 z-1 -0.75 0.5 y(n) Z-1 Fig. 4.42. Signal flowgraph of a digital filter.
-
Show that if two given networks are described by \(Y_{i}=\sum_{j=1}^{M} T_{i j} X_{j}\) and \(Y_{i}^{\prime}=\) \(\sum_{j=1}^{M} T_{i j}^{\prime} X_{j}^{\prime}\), then these networks are...
Study smarter with the SolutionInn App