jQuery in Action, 2nd edition*
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 Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Reply locked New topic
Author

In need of help

john daniels
Greenhorn

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.


Rules:

- 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.");
System.out.println("===================================================================");
}
}

}
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8836
    
    7

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.


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: In need of help
 
Similar Threads
Pinger time!
Link problem
Java Memory Puzzle
Having trouble
Random numbers