Need help with the instructions of creating this program.

I am new to programming in general. This Lab was assigned and I'm not sure where to start... (want do i need to do? please do not give code)


Assume the following:
a. Disk spooling is NOT being used.
b. The printer does NOT have a hardware buffer to hold the output while the printer is printing
(The theme music from Mission Impossible is playing faintly in the background).
SIMULATE the following scenario
A hypothetical program computes for three seconds then outputs a variable length record to be printed. The printer takes from 0.75 to 4.75 seconds (average time is 2.75 seconds) to print each output record. (Use a random number generator)
The hypothetical program loops 500 times for each case of software buffers (0, 1, 2, 3, 4, 5, 10, 25, and 100 software output buffers). Calculate the AVERAGE time for the program to “virtually compute and print” a record from the 500 records, for EACH of the 9 choices of buffer. Plot the results (by hand is OK). The Y axis is from zero to 8 seconds, and the X axis is nonlinear and displays all nine cases of buffers.



What I understand is I need:
1. Create a Random Number generator in range (.75-.475)
2. Have the RNG loop 500 times.
3. Time the computer while it runs the loop.
4.Average the time it takes to run each loop.
Last edited on
I can see where your confusion might come from. It isn't obvious at first glance where the concept of software output buffers come into play.

It looks like your intended to model the situation where you have to print 500 records of variable length, where it takes 3 seconds for the program to generate a record, and a variable amount of time for the computer to print a record. Obviously when software buffers are available you can be computing and storing records in a buffer, while the printer is printing from another, and the exercise seems to be designed to showcase the effect that has.
[SOLVED] - Instead I programed in Python.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#Lab 1 using python.
Import random  #Importing random number generator.
def main():
	buffers= [0,1,2,3,4,5,10,25,100]; #Defining the buffers using list.
	for buffer in buffers:
		sum=0;

		for i in range (1, 500): # Create a loop which will create random number and increment 500 times.
			time= (random.uniform (0.75,4.75))+3
			sum = sum + time

		average= sum/500; #Finding the average of each buffers random numbers.

		print("For Buffer",buffer,",the average time is",average,"."); #Print the output. 

Last edited on
Looks like you still haven't grasped the what the assignment is about. Your solution doesn't do what is required.

Thanks for sharing your python code in the C++ forum, though!
Topic archived. No new replies allowed.