This week's book giveaway is in the Java in General forum.
We're giving away four copies of Event Streams in Action and have Alexander Dean & Valentin Crettaz on-line!
See this thread for details.
Win a copy of Event Streams in Action this week in the Java in General forum!
    Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

In need of help

Posts: 13
  • Mark post as helpful
  • send pies
  • Report post to moderator
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.");

Posts: 9559
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
  • Report post to moderator
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.
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!