Question: Help!!! Please help me the code of following: Language : Java, In this question you are asked to calculate probabilties for the discrete uniform and
Help!!! Please help me the code of following:
Language : Java,
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.
-
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.
-
If the user selects discrete uniform, the program should request a lower bound a, an upper bound band 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.
-
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.
-
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.

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 menuChoice = scnr.nextInt()
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
