Question: Here is original code to use: import java.io.*; public class PP1 { public static void main(String[] args)throws FileNotFoundException{ //check for arguments if(args.length == 0) {

 Here is original code to use: import java.io.*; public class PP1

Here is original code to use:

import java.io.*;

public class PP1 { public static void main(String[] args)throws FileNotFoundException{ //check for arguments if(args.length == 0) { System.out.println("No input or command line arguments"); System.exit(0); } int n = Integer.parseInt(args[0]); //take in number of runs int m = Integer.parseInt(args[1]); //take in number of guests int everyone = 1; int howMany = 0; if (n

PrintStream o = new PrintStream(new File("readme.txt")); PrintStream console = System.out; System.setOut(o); System.out.println("Probability of everybody at the party to know the rumor is:" + 1.0 * everyone); System.out.println("How many people know when the rumor dies:" + 1.0 * howMany); System.setOut(console); System.out.println("probability of everybody at the party to know the rumor is:" + 1.0 * everyone); System.out.println("How many people know when the rumor dies:" + 1.0 * howMany); } }

Create a second program called PP1ec.java that uses a third that specifies the number of times a person is willing to repeat a rumor if they hear it. If this value is one then the program behaves like the original assignment (repeats rumor only on the first time they hear it). If the value is two then a person will repeat the rumor the first and second time they hear it. It the value is r then a person will repeat the rumor the first r times they hear it, but not the r+1 time. Estimate and output the same probabilities as the original assignment, command line parameter Create a second program called PP1ec.java that uses a third that specifies the number of times a person is willing to repeat a rumor if they hear it. If this value is one then the program behaves like the original assignment (repeats rumor only on the first time they hear it). If the value is two then a person will repeat the rumor the first and second time they hear it. It the value is r then a person will repeat the rumor the first r times they hear it, but not the r+1 time. Estimate and output the same probabilities as the original assignment, command line parameter

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!