Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

OLD ORIGINAL PROBLEM- 1. In addition to the Java program, you will use 2 .txt filesone for input and one for output. (You might call

OLD ORIGINAL PROBLEM-

1. In addition to the Java program, you will use 2 .txt filesone for input and one for output. (You might call them RainIn.txt and RainOut.txt. RainIn.txt will contain the data below. RainOut.txt will be created when the program runs and it will contain the output from your program)

2. Generate a graph that compares, on a month-by-month basis, the monthly rainfall for a city for the first half of 2018 (i.e. Jan June) versus the 30 year average rainfall for a city for the same months. Include the scale and the legend as shown below.

3. Compute the totals in each case (i.e. the 2018 rainfall total for Jan. to June, and the 30 year average half-year total), and state whether 2018 was wetter or drier than average and by how much.

4. Determine which month in 2018 had the highest rainfall, and print the month, the rainfall amount and how that amount compares to the 30 year average amount for that month.

5. The input and output is same for the new and old problem.

Now Rewrite the above problem using methods and without using Arrays.

NEW PROBLEM: Don't Use Arrays to solve this problem. Re-do the Java program you wrote to use the following methods. Fix any problems you had with the original program. Produce the EXACT output shown at the end of the document. Do not use Array. Use of Arrays to solve this problem is not permitted.

1. In addition to the Java program, you will use 2 .txt filesone for input and one for output. (You might call them RainIn.txt and RainOut.txt. RainIn.txt will contain the data below. RainOut.txt will be created when the program runs and it will contain the output from your program)

2. Generate a graph that compares, on a month-by-month basis, the monthly rainfall for Kamloops for the first half of 2018 (i.e. Jan June) versus the 30 year average rainfall for Kamloops for the same months.

Create and call a method to return the month name to main()

Create and call ONE method to print a line of symbols.

call it the first time to print the line of *

call it a second time to print the line of !.

Do not use Array. Use of Arrays to solve this problem is not permitted.

3. Call a method to print the scale and the legend as shown below.

4. Call a method to compare the 2018 rainfall total for Jan. to June, and the 30 year average half-year total. The method will state whether 2018 was wetter or drier than average and by how much. Do not use Array. Use of Arrays to solve this problem is not permitted.

5. Determine which month in 2018 had the highest rainfall, and print the month (using the method described in #2), the rainfall amount and how that amount compares to the 30 year average amount for that month.

6. Do not use Array. Use of Arrays to solve this problem is not permitted.

Input will consist of 6 pairs of numbers representing the 30-year average rainfall for the month and the 2018 rainfall amount for the same month. Use the exact data shown below when you run your program.

Input (RainIn.txt) -

3.1 5.4 <-January data

4.7 4.4 <-February data

4.2 4.1

5.0 6.0

4.0 5.6

6.3 4.5

Output (RainOut.txt) -

Rainfall comparison for January to June 2018

January |***********

|!!!!!!!!!!!!!!!!!!!!!!!!!

|

February |***************

|!!!!!!!!!!!!!!!!!!!!!

|

March | etc for the rest of the months

|

June |*****************

|!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

|----1----2----3----4----5----6----7----8

LEGEND:

* - 30 year average rainfall for a given month

! - 2018 rainfall for a given month

Total 30 year average rainfall was _______ mm.

Total rainfall for 2018 was ______ mm.

2018 was a drier year than normal by _______ mm.

The month with the highest rainfall was ________ Month Name.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

1 2 3 Data Base Techniques

Authors: Dick Andersen

1st Edition

0880223464, 978-0880223461

Students also viewed these Databases questions

Question

8-15 Discuss the impact of the Equifax hack.

Answered: 1 week ago