Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can someone help me the code of following: Language: Java;(please using the first picture as the starting java class | ackage studentwork; vouW NP import

Can someone help me the code of following:

Language: Java;(please using the first picture as the starting java class

image text in transcribed

image text in transcribed

| ackage studentwork; vouW NP import java.util.Arrays; public class H4_Q2 { public static void main(String[] args) { 9 10 11 //Part a 12 14 //Part b 15 16 17 //Part C 18 19 //Part d 21 22 24. 25 } } 26 For the upcoming Arkansas Presidential primary, favorability results for 4 candidates are given in ??. The second column in the table provides the number of people that view that candidate favorably. The third column in the table provides the number of people asked about each candidate. Number Favorable Number Questioned 500 700 250 333 800 400 1000 Candidate 1 Candidate 2 Candidate 3 Candidate 4 300 Table 1: Favorability Results a. Add code to H4_Q2 that declares and initializes a two-dimensional array named results with the integer values in columns 2 and 3 of Table 1. b. In H4_Q2 add a constant array of doubles named confidence_levels initialized with the values of 0.05, 0.025 and 0.01. c. In H4_Q2 add code that calculates a 95% and 99% confidence interval on the proportion of responses that were favorable for each candidate. Hint: use the NormalDistribution class to determine the z-value needed for in determining each confidence interval. d. (In H4_Q2) Print your results to the screen. Each row of your results should have the number of the candidate (e.g. Candidate 1), followed by the two confidence intervals calculated for the candidate in the same order given in part d.). For example: Candidatel : (., 25,.75); (.3,.5) is an example of what one row of output should look like. Note that the numeric results are not correct in this example. | ackage studentwork; vouW NP import java.util.Arrays; public class H4_Q2 { public static void main(String[] args) { 9 10 11 //Part a 12 14 //Part b 15 16 17 //Part C 18 19 //Part d 21 22 24. 25 } } 26 For the upcoming Arkansas Presidential primary, favorability results for 4 candidates are given in ??. The second column in the table provides the number of people that view that candidate favorably. The third column in the table provides the number of people asked about each candidate. Number Favorable Number Questioned 500 700 250 333 800 400 1000 Candidate 1 Candidate 2 Candidate 3 Candidate 4 300 Table 1: Favorability Results a. Add code to H4_Q2 that declares and initializes a two-dimensional array named results with the integer values in columns 2 and 3 of Table 1. b. In H4_Q2 add a constant array of doubles named confidence_levels initialized with the values of 0.05, 0.025 and 0.01. c. In H4_Q2 add code that calculates a 95% and 99% confidence interval on the proportion of responses that were favorable for each candidate. Hint: use the NormalDistribution class to determine the z-value needed for in determining each confidence interval. d. (In H4_Q2) Print your results to the screen. Each row of your results should have the number of the candidate (e.g. Candidate 1), followed by the two confidence intervals calculated for the candidate in the same order given in part d.). For example: Candidatel : (., 25,.75); (.3,.5) is an example of what one row of output should look like. Note that the numeric results are not correct in this example

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

Step: 3

blur-text-image

Ace Your Homework with AI

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

Get Started

Students also viewed these Databases questions