Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a script that works in vim: We are given a Java program RandomTest.java that generates specified number of random integers in the range [0...99].

Write a script that works in vim:

We are given a Java program RandomTest.java that generates specified number of random integers in the range [0...99]. The program prints FAIL if either 0 or 99 is generated (along with a count of how many times). Otherwise it prints PASS. The program takes the number of random integers to generate as a command line argument as shown below. Note that the given results each time is is run.

[an@localhost ~] java Random Test

Usage: java RandomTest

[an@localhost ~] java RandomTest 10

PASS

[an@localhost ~] java RandomTest 10

Fail 2

[an@localhost ~] java RandomTest 10

FAIL 1

Write a shell script named tester.sh that compiles RandomTest.java and then runs RandomTest a hundred times, with numRandoms=10 each time, and keeps track of the number of times it passes. (Hint: use a for loop) The output looks like as follows (where the pass rate varies because of random numbers):

[an@localhost ~] ./tester.sh

For numRandoms = 10 pass rate = 79

Modify your shell script such that it runs the tests for numRandoms= 10, 20, 30, and 40. For each number of randoms, it prints out he pass rate (Hint: use a nested for loop). For example, the output may now look like as shown below:

[an@localhost ~] ./tester.sh

For num Randoms = 10 pass rate = 82

For num Randoms = 20 pass rate = 56

For num Randoms = 30 pass rate = 60

For num Randoms = 40 pass rate = 42

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

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

Recommended Textbook for

Intranet And Web Databases For Dummies

Authors: Paul Litwin

1st Edition

0764502212, 9780764502217

More Books

Students also viewed these Databases questions

Question

Discuss the key people management challenges that Dorian faced.

Answered: 1 week ago

Question

How fast should bidder managers move into the target?

Answered: 1 week ago