Question
PROBLEM : Write a Java program that will produce the EXACT output shown at the end of the document. 1. In addition to the Java
PROBLEM: Write a Java program that will produce the EXACT output shown at the end of the document.
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) Read data from the input file. Use Notepad to create RainIn.txt.
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. 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. Solve this problem without using Array. Use of Array is not allowed.
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:
INPUT-
3.1 5.4 January data (30 year average comes first, then 2018 data)
4.7 4.4 February data
4.2 4.1
5.0 6.0
6.3 4.5
OUTPUT-
Rainfall comparison for January to June 2018
January |***********
|!!!!!!!!!!!!!!!!!!!!!!!!!
|
February |***************
|!!!!!!!!!!!!!!!!!!!!!
|
March | etc for the rest of the month
|
|
June |*****************
|!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|----1----2----3----4----5----6----7----8
LEGEND:
* - 30 year average rainfall for a given month (normal rainfall)
! - 2018 rainfall for a given month
Total 30 year average rainfall was 69.7 mm.
Total rainfall for 2018 was 65.6 mm.
2018 was a drier year than normal by 4.1 mm.
The month with the highest rainfall was .. name of month.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started