Using JAVA Write a program that uses a 2-D array to store the highest and lowest temperatures for each month of the year. The program should output the average high, average low, and highest and lowest temperatures of the year. Your program must consist of the following methods with their appropriate parameters: a.) getData: This method reads and stores the data in the 2-D array. b.) averageHigh: This method calculates and returns the average high temperature of the year. c.) averageLow: This method calculates and returns the average low temperature of the year. d.) indexHighTemp: This method returns the index of the highest temperature in the array. e.) indexLowTemp: This method returns the index of the lowest temperature in the array. Use the following input: High temp for each month: 30 40 45 60 70 90 89 95 79 90 70 40 Low temp for each month: 10 -10 20 30 50 75 85 79 50 80 30 20
So I have written a code for it but i just have a problem with the output. For the month with the highest temperature and lowest temperature, my code starts at 0 instead of 1. For example if I input that month 1 had a high of 20 and low of -10, and every other month had much warmer weather than that, it should say "The month with the lowest temperature is 1" but instead it says "The month with the lowest temperature is 0" So i just want to know what i have to change to do that. The code below is the one i have written
import java.util.Scanner;
public class Lab2 {
public static int[][] getData() {
Scanner sc = new Scanner(System.in);
int num;
System.out.println("Enter The Number of Months: ");
num = sc.nextInt();
int[][] temps = new int[2][num];
for(int i=0; i < num; i++) {
System.out.println("Enter The High Temperature For Month " + (i+1) + " : ");
temps[0][i] = sc.nextInt();
System.out.println("Enter The Low Temperature For Month " + (i+1) + " : ");
temps[1][i] = sc.nextInt();
}
return temps;
}
public static double averageHigh(int[][] temps) {
double sum = 0;
for(int i=0; i < temps[0].length; i++) {
sum += temps[0][i];
}
return sum / (double)(temps[0].length);
}
public static double averageLow(int[][] temps) {
double sum = 0;
for(int i=0; i < temps[1].length; i++) {
sum += temps[1][i];
}
return sum / (double)(temps[1].length);
}
public static int indexHighTemp(int[][] temps) {
int index = 0;
int high = temps[0][0];
for(int i=0; i < temps[0].length; i++) {
if (high < temps[0][i]) {
high = temps[0][i];
index = i;
}
}
return index;
}
public static int indexLowTemp(int[][] temps) {
int index = 0;
int low = temps[1][0];
for(int i=0; i < temps[1].length; i++) {
if (low > temps[1][i]) {
low = temps[1][i];
index = i;
}
}
return index;
}
public static void main(String[] args) {
int temps[][] = getData();
System.out.println("\nAverage High Temperature : "+averageHigh(temps));
System.out.println("\nAverage Low Temperature : "+averageLow(temps));
System.out.println("\nThe The Month With The Highest Temperature : "+indexHighT$
System.out.println("\nThe The Month With The Lowest Temperature : "+indexLowTem$
}
}
Thank you!
In: Computer Science
The comparisons of Scholastic Aptitude Test (SAT) scores based on the highest level of education attained by the test taker's parents were provided. A research hypothesis was that students whose parents had attained a higher level of education would on average score higher on the SAT. The overall mean SAT math score was (College Board website, January 8, 2012). SAT math scores for independent samples of students follow. The first sample shows the SAT math test scores for students whose parents are college graduates with a bachelor's degree. The second sample shows the SAT math test scores for students whose parents are high school graduates but do not have a college degree.
| Student's Parents | ||||
|---|---|---|---|---|
| College Grads | High School Grads | |||
| 528 | 672 | 456 | 456 | |
| 576 | 528 | 576 | 444 | |
| 464 | 448 | 588 | 444 | |
| 448 | 640 | 516 | 564 | |
| 464 | 576 | 408 | 384 | |
| 432 | 496 | 576 | 408 | |
| 480 | 496 | |||
| 608 | 496 | |||
a. Formulate the hypotheses that can be used to determine whether the sample data support the hypothesis that students show a higher population mean math score on the SAT if their parents attained a higher level of education.
population mean verbal score parents college grads.
population mean verbal score parents high school grads.
| - Select your answer -<>≤≥=≠Item 1 | ||
| - Select your answer -<>≤≥=≠Item 2 |
b. What is the point estimate of the difference between the means for the two populations? (to 1 decimal)
points - Select your answer -lowerhigherItem 4 if parents are college grads.
c. Compute the -value for the hypothesis test.
| -value | (to 3 decimals) |
| Degrees of freedom | (round your answer to previous whole number) |
-value is - Select your answer -lower than .005between .005 and .01between .01 and .025between .025 and .05between .05 and .10between .10 and .20greater than .20Item 7
d. At , what is your conclusion?
We - Select your answer -cancannotItem 8 reject .
In: Statistics and Probability
In 2006, the top ten nations with the highest HDI rating are listed below. Each observation shows a country and in parentheses the proportion of women in that country’s parliament and the HDI Score (% women, HDI Score). Norway (38, .94), Iceland (33, .90), Australia (28, .93) Ireland (14, .92), Sweden (45, .91), Canada (24, .91), Japan (11, .89), United States (15, .92), Switzerland (25, .93), Netherlands (34, .92). (i.e. the US had 15 percent of seats held by women and an HDI score of .92)
a) Calculate the mean and the standard deviation for the percentage of seats in parliament held by women in these states.
b) Calculate the mean and the standard deviation for HDI index and interpret your results.
c) Calculate the correlation between the HDI index score and the percentage of seats in the country’s parliament held by women.
d) Calculate the coefficient on the HDI score of a regression in which the HDI score is the independent variable and the proportion of seats held by women is the dependent variable.
e) Calculate the r2 from this simple regression model.
f) Input these observations into Stata and show (simply circle or highlight) where the answers to (c), (d), and (e) appear in the regression output. (Here it is ok to paste Stata output into your answer.)
In: Statistics and Probability
With all other variables remaining equal, rank the payment amounts from lowest to highest for the following types of mortgages (interest only, fully amortized, partially amortized, negatively amortized)
Which of the loan types in last question has the most lender risk? Why?
In: Finance
Oliban is an Omani company offers beauty products of the highest quality of natural frankincense based on scientific research to deliver the best results. It is one of a leading innovation company in GCC in health & wellness. It produces products from Omani frankincense oil branded as oliban which is best grade of its kind.
A. Because of the Coronavirus disease (Covet-19) Oliban management decided to set a new strategy. Explain in your words in no less than 200 words, the strategic management process phases the Oliban’s strategic team should follow.
B. If Oliban management decided to give a consultant agency to set their strategy, discuss in your words in no less than 200 words, the advantage and disadvantage of this action?
In: Operations Management
The College Board provided comparisons of SAT scores based on the highest level of education attained by the test taker's parents. A research hypothesis was that students whose parents had attained a higher level of education would on average score higher on the SAT. This data set contains verbal SAT scores for a sample of students whose parents are college graduates and a sample of students whose parents are high school graduates. Use 0.01 as your level of significance.
| College | High School |
| 485 | 442 |
| 534 | 580 |
| 650 | 479 |
| 554 | 486 |
| 550 | 528 |
| 572 | 524 |
| 497 | 492 |
| 592 | 478 |
| 487 | 425 |
| 533 | 485 |
| 526 | 390 |
| 410 | 535 |
| 515 | |
| 578 | |
| 448 | |
| 469 | |
| College | High School |
| 485 | 442 |
| 534 | 580 |
| 650 | 479 |
| 554 | 486 |
| 550 | 528 |
| 572 | 524 |
| 497 | 492 |
| 592 | 478 |
| 487 | 425 |
| 533 | 485 |
| 526 | 390 |
| 410 | 535 |
| 515 | |
| 578 | |
| 448 | |
| 469 |
In: Statistics and Probability
Using C++:
Create a function to search an undirected weighted graph and find the highest weighted edge between two specific values.
This should include a class declaration and the definition for all required members that are needed to support the search. NO NEED to code those members. You can assume any other data structures such as stack, heap, or linked list is defined (so you can use their standard functions without declaring or defining them).
In: Computer Science
Based on the estimated future incremental cash flows, what is the highest price (total amount, not per share) JHC should offer Mobile for a cash acquisition? Assume a cost of capital of 13%. how would I find the answer to this? what would the excel formulas be?
if the incremental values are
19200000 for year 1
18900000 for year 2
19900000 for year 3
22350000 for year 4
26900000 for year 5
28000000 for years 6-30
In: Finance
The highest resolution for a video supported by Youtube is 2160p (i.e 3840 x 2160). Assuming 3 bytes/pixel and 30 frames per second, what should be the bandwidth bw (bit rate) to watch such a high quality video if no compression encoding is used? Is bw the bandwidth available to most Internet users? If not, how come Youtube offers such a high resolution?
In: Computer Science
How do you rate the acidity from highest to lowest for acids ( carboxylic acids and alcohol) ?
How do you rate nucleophilic strength ?
How do you rate the reactivity of a carbonyl receiving a backside attack?
how do you rate the boiling points of carboxylic acids, amides, esters, alcohols
rank solubility of carbaldehyde , carboxyilic acid ester in water
In: Chemistry