Question
Question 2 For the upcoming Arkansas Presidential primary, favorability results for 4 candidates are given in ??. The second column in the table provides the
Question 2 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 Candidate 1 500 700 Candidate 2 250 300 Candidate 3 333 800 Candidate 4 400 1000 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 condence_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% condence 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 condence 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 condence intervals calculated for the candidate (in the same order given in part d.). For example: Candidate1: (.,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.
package studentWork; import java.util.Arrays; public class H4_Q2 { public static void main(String[] args) { //Part a //Part b //Part c //Part d } }
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