Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Semantics Of A Networked World Semantics For Grid Databases First International Ifip Conference Icsnw 2004 Paris France June 2004 Revised Selected Papers Lncs 3226

Authors: Mokrane Bouzeghoub ,Carole Goble ,Vipul Kashyap ,Stefano Spaccapietra

2004 Edition

3540236090, 978-3540236092

More Books

Students also viewed these Databases questions

Question

What is Aufbau's rule explain with example?

Answered: 1 week ago

Question

Write Hund's rule?

Answered: 1 week ago