Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can somebody have me the code of following: Language: Java You have been asked to consider a random variable X that has 4 possible outcomes.

Can somebody have me the code of following:image text in transcribed

Language: Java

You have been asked to consider a random variable X that has 4 possible outcomes. Those outcomes areX = {1, 2, 3, 4}. Modify H3_Q1.java to accomplish the following tasks.

  1. Add code that prompts the user for the probability associated with each of the 4 outcomes (e.g. P (X =x)) and reads the values into the variables provided.

  2. Determine whether each individual probability given by the user in (a) is valid. For each invalid P (x), print P(x) must be between 0 and 1 on a newline.

  3. Determine if the 4 values entered collectively satisfy the requirements of a probability distribution. If they do not, print The sum of the individual outcome probabilities must sum to 1 on a newline.

Package SluuenlLWOT, import java.util.Scanner; public class H3_Q1 { public static void main(String[] args) { Scanner schr = new Scanner(System.in); //variables storing 4 outcomes entered by user double outcomel ; double outcome2 ; double outcome3 ; double outcome4

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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