Question
Question 2 In this question you are asked to calculate probabilties for the discrete uniform and exponential distribution. Make changes to H3_Q2.java to accomplish the
Question 2 In this question you are asked to calculate probabilties for the discrete uniform and exponential distribution. Make changes to H3_Q2.java to accomplish the following tasks.
package studentWork; import java.util.Scanner; public class H3_Q2 { public static void main(String args[]) { Scanner scnr = new Scanner(System.in); int menuChoice; //stores the option entered by user } }
a. Print a menu to the screen asking the user to either type the number 1 to choose discrete uniform or the number 2 to choose exponential. The tool should print out an error message and exit if the user types in anything other than one of those two numbers. b. If the user selects discrete uniform, the program should request a lower bound a, an upper bound b and value of x from the user. Your code should check that all values are integers and that the upper bound is greater than the lower bound. The code should also check that a x b. c. If the user selects exponential then the program should request a value of and x. Your should check that both values are doubles and that x > 0. d. Using the distribution chosen by the user, calculate P(X = x) and P(X x) and display the results to the screen with appropriate labels.
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