Write a RainFall class that stores the total rainfall for each of 12 months into an array of doubles. The program should have methods that return the following:
the total rainfall for the year
the average monthly rainfall
the month with the most rain
the month with the least rain
Demonstrate the class in a complete program.
Input Validation: Do not accept negative numbers for monthly rainfall figures.
import java.io.*;
import java.util.*;
public class Rainfall
{
Scanner in = new Scanner(System.in);
private int month = 12;
private double total = 0;
private double average;
private double standard_deviation;
private double largest;
private double smallest;
private double months[];
public Rainfall()
{
months = new double[12];
}
public void setMonths()
{
for(int n=1; n <= month; n++)
{
System.out.println("Enter the rainfall (in inches) for month #" + n + ":" );
months[n-1] = in.nextInt();
}
}
public double getTotal()
{
total = 0;
for(int i = 0; i < 12; i++)
{
total = total + months[i];
}
System.out.println("The total rainfall for the year is" + total);
return total;
}
public double getAverage()
{
average = total/12;
System.out.println("The average monthly rainfall is" + average);
return average;
}
public double getLargest()
{
double largest = 0;
int largeind = 0;
for(int i = 0; i < 12; i++)
{
if (months[i] > largest)
{
largest = months[i];
largeind = i;
}
}
System.out.println("The largest amout of rainfall was" + largest +
"inches in month" + (largeind + 1));
return largest;
}
public double getSmallest()
{
double smallest = Double.MAX_VALUE;
int smallind = 0;
for(int n = 0; n < month; n++)
{
if (months[n] < smallest)
{
smallest = months[n];
smallind = n;
}
}
System.out.println("The smallest amout of rainfall was" + smallest +
"inches in month " + (smallind + 1));
return smallest;
}
public static void main(String[] args)
{
Rainfall r = new Rainfall();
r.setMonths();
System.out.println("Total" + r.getTotal());
System.out.println("Smallest" + r.getSmallest());
System.out.println("Largest" + r.getLargest());
System.out.println("Average" + r.getAverage());
}
}

Answers

Answer 1

Answer:

Explanation:

The code provided worked for the most part, it had some gramatical errors in when printing out the information as well as repeated values. I fixed and reorganized the printed information so that it is well formatted. The only thing that was missing from the code was the input validation to make sure that no negative values were passed. I added this within the getMonths() method so that it repeats the question until the user inputs a valid value. The program was tested and the output can be seen in the attached image below.

import java.io.*;

import java.util.*;

class Rainfall

{

   Scanner in = new Scanner(System.in);

   private int month = 12;

   private double total = 0;

   private double average;

   private double standard_deviation;

   private double largest;

   private double smallest;

   private double months[];

   public Rainfall()

   {

       months = new double[12];

   }

   public void setMonths()

   {

       for(int n=1; n <= month; n++)

       {

           int answer = 0;

           while (true) {

               System.out.println("Enter the rainfall (in inches) for month #" + n + ":" );

               answer = in.nextInt();

               if (answer > 0) {

                   months[n-1] = answer;

                   break;

               }

           }

       }

   }

   public void getTotal()

   {

       total = 0;

       for(int i = 0; i < 12; i++)

       {

           total = total + months[i];

       }

       System.out.println("The total rainfall for the year is " + total);

   }

   public void getAverage()

   {

       average = total/12;

       System.out.println("The average monthly rainfall is " + average);

   }

   public void getLargest()

   {

       double largest = 0;

       int largeind = 0;

       for(int i = 0; i < 12; i++)

       {

           if (months[i] > largest)

           {

               largest = months[i];

               largeind = i;

           }

       }

       System.out.println("The largest amount of rainfall was " + largest +

               " inches in month " + (largeind + 1));

   }

   public void getSmallest()

   {

       double smallest = Double.MAX_VALUE;

       int smallind = 0;

       for(int n = 0; n < month; n++)

       {

           if (months[n] < smallest)

           {

               smallest = months[n];

               smallind = n;

           }

       }

       System.out.println("The smallest amount of rainfall was " + smallest +

               " inches in month " + (smallind + 1));

   }

   public static void main(String[] args)

   {

       Rainfall r = new Rainfall();

       r.setMonths();

       r.getTotal();

       r.getSmallest();

       r.getLargest();

       r.getAverage();

   }

}

Write A RainFall Class That Stores The Total Rainfall For Each Of 12 Months Into An Array Of Doubles.

Related Questions

g Add a throw statement to the processNumbers function that throws the message "An element in the list is not a number." if one of the elements in toProcess is not a number. Hint: The function isNaN() returns true if the parameter is not a number.

Answers

Answer and Explanation:

function processNumbers(alist){

var Ourarray= new array(alist);

Ourarray.foreach(

if(isNaN()){

Console.log( "An element in the list is not a number."};

break;

}

}

processNumbers(alist)

From the above, we have defined a function that takes an array parameter(the following array variable will make sure of that). We test each element in the array using foreach array function. The for each function runs the if statement and if isNan is true for each of the elements in the array.

What will be the pseudo code for this

Answers

Answer:

Now, it has been a while since I have written any sort of pseudocode. So please take this answer with a grain of salt. Essentially pseudocode is a methodology used by programmers to represent the implementation of an algorithm.

create a variable(userInput) that stores the input value.

create a variable(celsius) that takes userInput and applies the Fahrenheit to Celsius formula to it

Fahrenheit to Celsius algorithm is (userInput - 32) * (5/9)

Actual python code:

def main():

   userInput = int(input("Fahrenheit to Celsius: "))

   celsius = (userInput - 32) * (5/9)

   print(str(celsius))

main()

Explanation:

I hope this helped :) If it didn't tell me what went wrong so I can make sure not to make that mistake again on any question.    

Create a python program that display this
Factorial Calculator
Enter a positive integer: 5
5! = 1 x 2 x 3 x 4 x 5
The factorial of 5 is: 120
Enter a positive integer: 4
4! = 1 x 2 x 5 x 4
.
The factorial of 4 is: 24
Enter a positive integer: -5
Invalid input! Program stopped!​

Answers

Answer:

vxxgxfufjdfhgffghgfghgffh

3. Coaxial/telephone cable sends
during the data transmission
signal

Answers

Answer:

high frequency signal.

A computer has many resources. A resource can be memory, disk drive, network bandwidth, battery power, or a monitor. It can also be system objects such as shared memory or a linked list data structure. This principle is based in object-oriented programming (OOP). In OOP, a class definition encapsulates all data and functions to operate on the data. The only way to access a resource is through the provided interface. Which security principle are we referring to

Answers

Answer:

The security principle being referred to here is:

Resource Encapsulation.

Explanation:

Resource Encapsulation is one of the cybersecurity first principles.  It allows access or manipulation of the class data as intended by the designer. The cybersecurity first principles are the basic or foundational propositions that define the qualities of a system that can contribute to cybersecurity.  Other cybersecurity first principles, which are applied during system design, include domain separation, process isolation, modularization, abstraction, least principle, layering, data hiding, simplicity, and minimization.

Secure email technique that provides confidentiality, along with authentication, integrity, and non-repudiation. It uses a centralized trust model where users get a certificate from a trusted CA.

a. True
b. False

Answers

Answer:

a

Explanation:

just put a

Write a program that takes a date as input and outputs the date's season. The input is an integer to represent the month and an integer to represent the day. Ex: If the input is: 4 11 the output is: spring In addition, check if both integers are valid (an actual month and day). Ex: If the input is: 14 65 the output is: invalid The dates for each season are: spring: March 20 - June 20 summer: June 21 - September 21 autumn: September 22 - December 20 winter: December 21 - March 19

Answers

Answer:

Explanation:

The following program is written in Java. It is a function that takes in the two parameters, combines them as a String, turns the combined String back into an integer, and uses a series of IF statements to check the parameters and determine which season it belongs to. Then it prints the season to the screen. The code has been tested with the example provided in the question and the output can be seen in the attached image below.

class Brainly {

   public static void main(String[] args) {

       getSeason(4, 65);

       getSeason(4, 11);

   }

   public static void getSeason(int month, int day) {

       String combined = String.valueOf(month) + String.valueOf(day);

       int combinedInt = Integer.parseInt(combined);

       if ((month > 0 && month < 12) && (day > 0 && day < 31)) {

           if ((combinedInt >= 320) && (combinedInt <= 620)) {

               System.out.println("The Season is Spring");

           } else if ((combinedInt >= 621) && (combinedInt <= 921)) {

               System.out.println("The Season is Summer");

           } else if ((combinedInt >= 922) && (combinedInt <= 1220)) {

               System.out.println("The season is Autumn");

           } else {

               System.out.println("The Season is Winter");

           }

       } else {

           System.out.println("Invalid date");

       }

   }

}

The tax calculator program of the case study outputs a floating-point number that might show more than two digits of precision. Use the round function to modify the program to display at most two digits of precision in the output number.

Answers

Answer:

Explanation:

The following code is written in Python. The tax calculator program was not provided, therefore I created a tax calculator that takes in the total price as an input and adds a 7% tax to it. Then it uses the round() function to make sure that the total is outputted as a decimal with two decimal digits at most.

def taxCalculator(price):

   total = price * 1.07

   formattedTotal = round(total, 2)

   return formattedTotal

Which of the following BEST describes an inside attacker?
An agent who uses their technical knowledge to bypass security.
An attacker with lots of resources and money at their disposal.
A good guy who tries to help a company see their vulnerabilities.
An unintentional threat actor. This is the most common threat.​

Answers

The inside attacker should be a non-intentional threat actor that represents the most common threat.

The following information related to the inside attacker is:

It is introduced by the internal user that have authorization for using the system i.e. attacked.It could be intentional or an accidental.So it can be non-intentional threat.

Therefore we can conclude that The inside attacker should be a non-intentional threat actor that represents the most common threat.

Learn more about the threat here: brainly.com/question/3275422

you get a call from a customer who says she can't access your site with her username and password. both are case-sensitive and you have verified she is entering what she remembers to be her user and password correctly. what should you do to resolve this problem?

a. have the customer clear her browser history and retry

b. look up her username and password, and inform her of the correct information over the phone

c. have the user reboot her system and attempt to enter her password again

d. reset the password and have her check her email account to verify she has the information

Answers

Answer:

answer would be D. I do customer service and would never give information over the phone always give a solution

In order to resolve this problem correctly, you should: D. reset the password and have her check her email account to verify she has the information.

Cybersecurity can be defined as a group of preventive practice that are adopted for the protection of computers, software applications (programs), servers, networks, and data from unauthorized access, attack, potential theft, or damage, through the use of the following;

Processes.A body of technology.Policies.Network engineers.Frameworks.

For web assistance, the security standard and policy which must be adopted to enhance data integrity, secure (protect) data and mitigate any unauthorized access or usage of a user's sensitive information such as username and password, by a hacker, is to ensure the information is shared discreetly with the user but not over the phone (call).

In this context, the most appropriate thing to do would be resetting the password and have the customer check her email account to verify she has the information.

Read more: https://brainly.com/question/24112967

A good machine should have the mechanical advantage of......?​

Answers

Answer:

The ideal mechanical advantage (IMA) of an inclined plane is the length of the incline divided by the vertical rise, the so-called run-to-rise ratio. The mechanical advantage increases as the slope of the incline decreases, but then the load will have to be moved a greater distance.

Explanation:

Create a multimedia project that contains the text element and all the contents that you have studied about that element

Answers

Answer:

no sé jejejejeje

lslsl

lonsinet

ko

Alexis received an email message from an unknown sender that included an attachment.

If she opens the attachment, what kind of malicious software might be activated, and what are the consequences?


Opening the attachment would release a worm, which would infect her system with a virus.


Opening the attachment would release a worm, which would infect her system with spyware.


Opening the attachment would release an active worm, which would infect her system with adware.


Opening the attachment would release a passive worm, which would infect her system with adware.

Answers

Answer:

Opening the attachment would release a worm, which would infect her system with a virus.

Answer:  B. Opening the attachment would release a worm, which would infect her system with a virus.

Instructions
Create a multimedia project that contains the text element and all the contents that you have studied about that element

Answers

Answer:

iiiio888887776558777u765

Which is the most correct option regarding subnet masks?

Answers

Answer:

thanks for your question

_________ are standard devices, such as switches and routers, that have small onboard computers to monitor traffic flows through the device as well as the status of the device and other devices connected to it

Answers

Answer:

Managed devices

Explanation:

hope it helps u

What are the benefits of using LinkedIn Sales Navigator?

Answers

Answer:

Well, there are a number of advantages that come with this advanced LinkedIn automation tool. Here are some of the top benefits of a Sales Navigator:

1. Can find and export up to 5000 prospects at a time.

2. Enables you to send 30 InMails per month

3. Easy access Teamlink -enabling you to expand your network by pooling connections

4. Integrate with existing systems

A test for logical access at an organization being audited would include: Group of answer choices Checking that the company has a UPS and a generator to protect against power outages Making sure there are no unmanaged third-party service level agreements Performing a walkthrough of the disaster recovery plan Testing that super user (SYSADMIN) access is limited to only appropriate personnel

Answers

Answer:

Testing that super user (SYSADMIN) access is limited to only appropriate personnel.

Explanation:

A test for logical access at an organization being audited would include testing that super user (SYSADMIN) access is limited to only appropriate personnel.

Which of the following is not a computer application?

a. Internet Explorer

b. Paint

c. Apple OSX

d. Microsoft Word

Answers

Answer:C.apple Osx
Answer C

Apple OSX is not a computer application.

The information regarding the computer application is as follows:

The program of the computer application should give the skills that are required for usage of the application software on the computer.An application like word processing, internet, etc.Also, the computer application includes internet explorer, paint, and Microsoft word.

Therefore we can conclude that Apple OSX is not a computer application.

Learn more about the computer here: brainly.com/question/24504878

Consider a network that is a rooted tree, with the root as its source, the leaves as its sinks, and all the edges directed along the paths from the root to the leaves. Design an efficient algorithm for finding a maximum flow in such a network. What is the time efficiency of your algorithm

Answers

Answer:

please mark me brainlist

Explanation:

The Cartesian product of two lists of numbers A and B is defined to be the set of all points (a,b) where a belongs in A and b belongs in B. It is usually denoted as A x B, and is called the Cartesian product since it originated in Descartes' formulation of analytic geometry.

a. True
b. False

Answers

The properties and origin of the Cartesian product as stated in the paragraph

is true, and the correct option is option;

a. True

The reason why the above option is correct is stated as follows;

In set theory, the Cartesian product of two number sets such as set A and set

B which can be denoted as lists of numbers is represented as A×B and is the

set of all ordered pair or points (a, b), with a being located in A and b located

in the set B, which can be expressed as follows;

[tex]\left[\begin{array}{c}A&x&y\\z\end{array}\right] \left[\begin{array}{ccc}B(1&2&3)\\\mathbf{(x, 1)&\mathbf{(x, 2)}&\mathbf{(x, 3)}\\\mathbf{(y, 1)}&\mathbf{(y, 2)}&\mathbf{(y, 3)}\\\mathbf{(z, 1)}&\mathbf{(z, 2)}&\mathbf{(z, 3)}\end{array}\right]}[/tex]

The name Cartesian product is derived from the name of the philosopher,

scientist and mathematician Rene Descartes due to the concept being

originated from his analytical geometry formulations

Therefore, the statement is true

Learn more about cartesian product here:

https://brainly.com/question/13266753

Write the following numbers in binary. 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 46. 55. 61.​

Answers

0 1 10 11
Explanaition:

g A catch block that expects an integer argument will catch Group of answer choices all exceptions all integer exceptions any exception value that can be coerced into an integer C

Answers

Answer:

Hence the correct option is 2nd option. all integer exceptions.

Explanation:

A catch block that expects an integer argument will catch all integer exceptions.

We canconnect  two or more computer together using cables true or false​

Answers

This is true for most modern computers

Identify the class of the address, the number of octets in the network part of the address, the number of octets in the host part of the address, the network number, and the network broadcast address g

Answers

Answer:

1.

190.190.190.190

Class B

Number of octets in the network part of the address: 2

Number of octets in the host part of the address: 2

Network number: 190.190.0.0/16

Network broadcast address: 190.190.255.255

2.

200.1.1.1

Class C

Number of octets in the network part of the address: 3

Number of octets in the host part of the address: 1

Network number: 200.1.1.0/24

Network broadcast address: 200.1.1.255

Explanation:

a computer works on input processing output device
true
false​

Answers

a computer works on input processing output device true

Answer:

a computer works on input processing output device. True

Explanation:

God bless you.

Sites like Zillow get input about house prices from a database and provide nice summaries for readers. Write a program with two inputs, current price and last month's price (both integers). Then, output a summary listing the price, the change since last month, and the estimated monthly mortgage computed as (current_price * 0.051) / 12. Output each floating-point value with two digits after the decimal point, which can be achieved as follows: print('{:.2f}'.format(your_value))

Answers

Answer:

The program in Python is as follows:

current_price = int(input("Current Price: "))

last_price = int(input("Last Month Price: "))

change = current_price - last_price

mortgage = (current_price * 0.051) / 12

print('Change: {:.2f} '.format(change))

print('Mortgage: {:.2f}'.format(mortgage))

Explanation:

This gets input for current price

current_price = int(input("Current Price: "))

This gets input for last month price

last_price = int(input("Last Month Price: "))

This calculates the price change

change = current_price - last_price

This calculates the mortgage

mortgage = (current_price * 0.051) / 12

This prints the calculated change

print('Change: {:.2f} '.format(change))

This prints the calculated monthly mortgage

print('Mortgage: {:.2f}'.format(mortgage))

Answer:

current_price = int(input())

last_months_price = int(input())

change = current_price - last_months_price

mortgage = current_price * 0.051 / 12

print('This house is $', end= '')

print(current_price, end= '. ')

print('The change is $', end= '')

print(change, end= ' ')

print('since last month.')

print('The estimated monthly mortgage is $', end= '')

print(mortgage, end='0.\n')

the base on which the number n=(34)? is written if it has a value of n= (22)10​

Answers

If I'm understanding the question correctly, you are looking for an integer b (b ≠ 0, b ≠ 1) such that

[tex]34_b = 22_{10}[/tex]

In other words, you're solving for b such that

b ¹ + 4×b ⁰ = 22

or

3b + 4 = 22

Solving this is trivial:

3b + 4 = 22

3b = 18

b = 6

So we have

34₆ = 22₁₀

T
N
O
?
You can insert only the row
only to
True or false

Answers

false

Explanation:

good luck bro

have a great day

Answer:

false

Explanation:

5 Major of computer application

Answers

Im assuming you means applications as in Apps.

Microsoft windows
Microsoft internet Explorer
Microsoft office or outlook
Mcafee antivirus
Adobe pdf

Answer:

Basic Applications of Computer

1 ) Home. Computers are used at homes for several purposes like online bill payment, watching movies or shows at home, home tutoring, social media access, playing games, internet access, etc.

2 ) Medical Field.

3 ) Entertainment.

4 ) Industry.

5 ) Education.

Explanation:

Hope it helps you

Mark my answer as brainlist

have a good day

Other Questions
A tutor should be able to work around a. Your house c. Your teachers schedule b. Your schedule d. All of these Please select the best answer from the choices provided A B C D Please help me with my work what is the aswer to 5 is 2 more than? What does the word Photosynthesis mean?A. Release of energy through the breakdown of Glucose.B. Creating photographs.C. Taking apart with light.D. Putting together with light. the guys is wrong i checked simplify by using the distributive property and then combine like terms:4 (3x 9)ANSWER PLS What is the slope of a line perpendicular to line A? Length of a line segment with endpoints (3,-2) and (-3,4). An electric motor converts electrical energy from mechanical energy. Match each sentence with the correct prepostion to complete it para: purpose or goal 1. Viajan a la republica dominicana _____ avionpor: reason or motive 2. No tengo gasolina para viajar en mi coche; _____ eso viajo por autobuspara: recpipient 3. Hablamos con Fabio ______ r ir a Cali en octubre por: transportation 4. Compramos flores _____ mi h hermana para su boda What's the distance between the points (7,3) and (7,8)? write a story in which a person or a group of people face a dangerous event Approximately how many mutations occur naturally in DNA per 10,000 bases?A. 2B. 2000C. 200D. 20 Plz help help helpWhat was the first electromechanical digital computer?For your kind information I would like to tell you that don't search on internet because it will show ENIAC and that is not the answer the answeris may be ABC or MARK I. I am just confused, Please help me One moth population carries three alleles at a genetic locus: X1, X2and X3. X1is dominant to X2and X3; X1produces red antennae. X2is co-dominant to X3; X2X2produces yellow antennae, X3X3produces white antennae, and X2X3produces light yellow antennae. The phenotypes in a population are as follows: 0.04 white; 0.16 light yellow; 0.16 yellow; 0.64 red.Assuming that this population is in Hardy-Weinberg equilibrium, what is the frequency of the X3allele in this population How much is this house_________ ?1 pointchargeworthcostpay (06.02 LC)Which invention allowed the production of 100% cotton cloth, resulting in much cheaper textiles?O Cotton ginO Flying shuttleSpinning jennyO Water frame A car start from rest . If the acceleration of the car is 0.2m/s^2, what will be it's velocity at the end of 3 minutes?And what distance will it cover at that time? Murder investigationDetective Leong was involved in a murder investigation. In the suspect's house, the only thing he found useful was a password protected computer and a piece of paper nailed to the wall. He suspected that the paper was the answer to accessing the computer, but could not figure out what the password is. Written on the paper was "ShE IS ILL". Do you know what the password is?HINT: There is no spelling mistake. You might want to write it on a piece of paper. 730 million, 5 how to write it in digits