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 { 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 parameterStep 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