aspose file tools
The moose likes Java in General and the fly likes In need of help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Reply locked New topic

In need of help

john daniels

Joined: Dec 11, 2006
Posts: 13
Well nobody was able to help me in the intermediate section, so I thought I would give the advanced section a shot, I am stuck, and really dont know what to do past this point.

Ok I am having trouble with an assignment I am doing for my class.
The Assignment is as follows:

Compare the performance of a 4-computer network in the following situations:

- First Come First Serve (the first computer to have a message available gets complete control of the network until transmission is done).

- The network uses Time Division Multiplexing with computers taking turns with one packet (10 Kb) being sent every time.

- The same as the situation before except that computers with nothing to send forfeit their turns.

Turn in a report (with a cover page) comparing the performance of the network in all 3 situations. Also turn in any code used to generate the report or create the simulation. Calculate the average wait time for all messages.


- In each of the three situations 100 random-sized messages need to be sent. The size will vary between 10 K and 15 MB (in increments of 10 K).

- The transfer rate is 96 K/ sec.

The part I am have trouble with is step two: - The network uses Time Division Multiplexing with computers taking turns with one packet (10 Kb) being sent every time.

I can not figure out how to divide it up sending 10Kb at a time, and then giving the total time to send all four messages. Anyone able to help me out?

This is the code I have so far:

import java.util.Random;

public class Trial
public Random RNG;
public float time;
public float transfer;

public Trial()
RNG = new Random();
transfer = 96000;

public void GenerateData()
for(int i = 1; i < 101; i++){
int GenerateComputer = RNG.nextInt(4);
long DataSize = RNG.nextInt(1536001);
System.out.println("-Computer " + (GenerateComputer + 1) + " sends " + (DataSize * 10) + " bits of data.");
time = ((DataSize * 10) / (transfer));
System.out.println("The total time to transfer the file took " + time + " seconds at 96k/sec.");

Joe Ess

Joined: Oct 29, 2001
Posts: 9126

It looks like Campbell took a step up and tried to help and you never replied.
In any case, please don't post the same question more than once. It leads to confusion and duplication of effort as the community tries to help everyone.
Have a gander at our FAQ, How To Ask Questions On JavaRanch. It will not only help you to ask better questions, but also let you know what to do when you aren't getting the replies you want.

[How To Ask Questions On JavaRanch]
I agree. Here's the link:
subject: In need of help
It's not a secret anymore!