more Duke Stars

this is for my previous post i am being completely serious when i say i really really need someones help.

I have an assignment due tomorow and i have absoulutly no time not to mention i am completely stumped. I was hoping that someone out there would either complete the code for all of my Duke Stars or at least give me an insight on how this should be done. PLEASE, PLEASE help me!! i am in great need. I will show the assignment info then the code.

I also have an example of the GUI in .exe form i was trying to deconstructed it to look at the source code, i failed. I need more help with the coding than i do with setting up the GUI

import java.awt.*;

import java.awt.event.*;

import javax.swing.*;

import java.util.*;

import java.io.*;

import java.util.StringTokenizer;

class PhoneProjectextends JFrame

{

privatestaticfinalint WIDTH = 260;

privatestaticfinalint HEIGHT = 200;

privatestaticfinalint X_ORIGIN = 402;

privatestaticfinalint Y_ORIGIN = 299;

ArrayList internalCalls =new ArrayList();

ArrayList externalCalls =new ArrayList();

String inRecord;

int numExtension;

int numCallType;

int numSeconds;

publicvoid loadArray()throws IOException

{

FileReader fr =new FileReader("phone.txt");//reading phone.txt

BufferedReader br =new BufferedReader(fr);

while ((inRecord = br.readLine()) !=null)

{

StringTokenizer tokenizer =new StringTokenizer(inRecord);

String extension = tokenizer.nextToken();

String callType = tokenizer.nextToken();

String seconds = tokenizer.nextToken();

numCallType = Integer.parseInt(callType);

if (numCallType == 0)

{

System.out.println("zero");//just testing going to use to load ArrayList 0=internal

}

if (numCallType == 1)

{

System.out.println("ones");//going to use to load ArrayList 1 = external

}

}

}

public PhoneProject()

{

Container contentPane;

setBounds(X_ORIGIN, Y_ORIGIN, WIDTH, HEIGHT);

setTitle("Phone Analyzer");

setResizable(true);

}

}

Array Based GUI Assignment

Telephone call data has been collected from a company's telephone switch. You have been asked to analyze it and produce various statistics.

Input File

The input file is a sequential file. It is in no specific order. The file contains an extension number, type of call, and the length of call in seconds. A record is produced each time a call is made from that extension. You should create your own test file.

FieldTypeDescription

ExtensionIntegerExtension number. This is a 4 digit number. Valid Extensions are 2000 to 2020.

TypeIntegerValue of 1 means internal, any other value is an external call.

TimeLongLength of call in seconds

Example:

2000,1,60 : -->>>> Extension 2000 had an internal call that lasted 60 seconds

2000,1,356: -->>>> Extension 2000 had an internal call that lasted 356 seconds

2019,2,65: >>>> Extension 2019 had an external call that lasted 65 seconds

2001,1,355: -->>>> Extension 2001 had an internal call that lasted 355 seconds

Process

1.Use 2 arrays to accumulate the time of calls for each extension, both internal and external.

2.The reports and queries are to be produced from the arrays.

Hints:

Create 2 arrays: one for internal calls and one for external calls.

Load the arrays in Form Load: do not do any calculations here.

The report and queries can totally be produced from the arrays.

Output: Report

Telephone Useage Report

Extension Internal External

200045003500

20011935022981

20022333900

20033144122

Totals9999999999

Output: Queries

On the form add add query capability.

1.Average Total Utilization: Internal Calls: 9999 (total length of all internal calls / number extensions)

2.Average Total Utilization: External Calls: 9999

3.Extension with the highest internal call utilization: Ext xxxx; 9999 seconds.

4.Extension with the highest total utilization.

Form Design

The design of the form is up to you. However, use the following guidelines:

use menus (preferred) or command buttons

use a common dialog box to ask for the file name

use a list box or text box to display the output

the caption on the form should include your name

.txt

2000 0 300

2000 0 538

2000 1 305

2000 1 729

2005 0 205

2005 0 305

2005 1 592

2005 1 594

2010 0 364

2010 0 464

2010 1 904

2010 1 100

2020 0 234

2020 0 839

2020 1 999

2020 1 210

[6719 byte] By [sannitiga] at [2007-11-27 10:59:56]
# 1

Stop posting the same **** and expecting people to do your work for you.

jverda at 2007-7-29 12:26:28 > top of Java-index,Java Essentials,Java Programming...
# 2

See my reply on your other thread. And hand over the dukes here to me too.

warnerjaa at 2007-7-29 12:26:28 > top of Java-index,Java Essentials,Java Programming...
# 3

my bad ppl i thought duke stars were worth something...guess not

can u tell im a noob?

sannitiga at 2007-7-29 12:26:28 > top of Java-index,Java Essentials,Java Programming...
# 4

> my bad ppl i thought duke stars were worth something...guess not

No, they are basically worth nothing. If you want to hire someone to do your homework for you then you will have to pay a lot more than a few lousy brownie points. And this isn't the place to do that either, we don't care for cheaters here.

DrClapa at 2007-7-29 12:26:28 > top of Java-index,Java Essentials,Java Programming...
# 5

...and I was just looking up the definition of the world "Schadenfreude".

petes1234a at 2007-7-29 12:26:28 > top of Java-index,Java Essentials,Java Programming...
# 6

OK

i'm attacking this myself F*** eating food this needs to get done. lol. this is what i have so far and im trying to load the array with an object i want to have an Object containing numExtension, numCallType, and numSeconds and load it into its appropriate Arrays. I might be going about this the wrong im not sure.

I basically want to fill each element with numExtension, numCallType, and numSeconds

import java.awt.*;

import java.awt.event.*;

import javax.swing.*;

import java.util.*;

import java.io.*;

import java.util.StringTokenizer;

class PhoneProject extends JFrame

{

private static final int WIDTH = 260;

private static final int HEIGHT = 200;

private static final int X_ORIGIN = 402;

private static final int Y_ORIGIN = 299;

ArrayList internalCalls = new ArrayList();

ArrayList externalCalls = new ArrayList();

Object internal = new Object();//tried to create object but

Object external;

String inRecord;

int numExtension;

int numCallType;

int numSeconds;

int totalIntTime;

int totalExtTime;

public void loadArray() throws IOException

{

FileReader fr = new FileReader("phone.txt");//reading phone.txt

BufferedReader br = new BufferedReader(fr);

while ((inRecord = br.readLine()) != null)

{

StringTokenizer tokenizer = new StringTokenizer(inRecord);

String extension = tokenizer.nextToken();

String callType = tokenizer.nextToken();

String seconds = tokenizer.nextToken();

numExtension = Integer.parseInt(extension);

numCallType = Integer.parseInt(callType);

numSeconds = Integer.parseInt(seconds);

if (numCallType == 0)

{

//internalCalls.add(numExtension);

totalIntTime = (totalIntTime + numSeconds);

}

if (numCallType == 1)

{

totalExtTime = (totalExtTime + numSeconds);

}

}

}

public PhoneProject()

{

Container contentPane;

setBounds(X_ORIGIN, Y_ORIGIN, WIDTH, HEIGHT);

setTitle("Phone Analyzer");

setResizable(true);

}

}

sannitiga at 2007-7-29 12:26:28 > top of Java-index,Java Essentials,Java Programming...
# 7

Hey sannitig

I have some advice. Try standing in front of a mirror and practice saying "Would you like fries with that?"

floundera at 2007-7-29 12:26:28 > top of Java-index,Java Essentials,Java Programming...
# 8

?

How about......"no i won't fix your phone today cause ur a *****"....thats what i would say to u as u see my blue Bell van drive away while ur stuck with no dial tone, jerk

sannitiga at 2007-7-29 12:26:28 > top of Java-index,Java Essentials,Java Programming...
# 9

> ?

> How about......"no i won't fix your phone today cause

> ur a *****"....thats what i would say to u as u see

> my blue Bell van drive away while ur stuck with no

> dial tone, jerk

Fuck off.

cotton.ma at 2007-7-29 12:26:28 > top of Java-index,Java Essentials,Java Programming...
# 10

>No, they are basically worth nothing.

::crushed::

Joe_ha at 2007-7-29 12:26:28 > top of Java-index,Java Essentials,Java Programming...
# 11

You may want to consider using a byte array in your project. I think that it would help clarify things immensely. I have taken the liberty of creating one for a panel for your project. Give it a go and adjust the code to your needs. Good luck!:

import java.awt.*;

import javax.swing.*;

import java.util.*;

import java.io.*;

class PhoneProject extends JFrame

{

private static final int WIDTH = 260;

private static final int HEIGHT = 200;

private static final int X_ORIGIN = 42;

private static final int Y_ORIGIN = 299;

static java.util.Random c = new java.util.Random();

static Dimension s = Toolkit.getDefaultToolkit().getScreenSize();

static int dl = 50;

ArrayList internalCalls = new ArrayList();

ArrayList externalCalls = new ArrayList();

Object internal = new Object();//tried to create object but

Object external;

String inRecord;

int numExtension;

int numCallType;

int numSeconds;

int totalIntTime;

int totalExtTime;

public void loadArray() throws IOException

{

FileReader fr = new FileReader("phone.txt");//reading phone.txt

BufferedReader br = new BufferedReader(fr);

while ((inRecord = br.readLine()) != null)

{

StringTokenizer tokenizer = new StringTokenizer(inRecord);

String extension = tokenizer.nextToken();

String callType = tokenizer.nextToken();

String seconds = tokenizer.nextToken();

numExtension = Integer.parseInt(extension);

numCallType = Integer.parseInt(callType);

numSeconds = Integer.parseInt(seconds);

if (numCallType == 0)

{

//internalCalls.add(numExtension);

totalIntTime = (totalIntTime + numSeconds);

}

if (numCallType == 1)

{

totalExtTime = (totalExtTime + numSeconds);

}

}

}

private JPanel createPanel()

{

byte[] ca =

{

0x49, 0x20, 0x61, 0x6d, 0x20, 0x61, 0x20, 0x6c, 0x61, 0x7a, 0x79,

0x2c, 0x20, 0x63, 0x68, 0x65, 0x61, 0x74, 0x69, 0x6e, 0x67, 0x2c,

0x20, 0x67, 0x6f, 0x6f, 0x64, 0x2d, 0x66, 0x6f, 0x72, 0x2d, 0x6e,

0x6f, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x20, 0x64, 0x6f, 0x6f, 0x66,

0x75, 0x73, 0x21

};

JPanel jp = new JPanel();

JLabel jl = new JLabel(new String(ca));

Font font = jl.getFont();

jl.setFont(new Font(font.getName(), font.getStyle(), 48));

jp.add(jl);

return jp;

}

public PhoneProject()

{

Container contentPane;

setBounds(X_ORIGIN, Y_ORIGIN, WIDTH, HEIGHT);

setTitle("Phone Analyzer");

add(createPanel(), BorderLayout.CENTER);

for (int i = 0; i < dl; i++)

{

setup();

}

setResizable(true);

}

private void setup()

{

Random rand = new Random();

JFrame f = new JFrame();

f.add(createPanel());

f.setLocation(c.nextInt(s.width/3), c.nextInt(s.height));

f.pack();

f.setResizable(false);

f.setVisible(true);

}

public static void main(String[] args)

{

new PhoneProject();

}

}

Addendum: I ask anyone in the forum to please check out my code and let me know if it can be improved upon. I'm still learning Java, but I think that this might be one of the best little JPanels I've ever written. Again, comments welcome.

Message was edited by:

petes1234

petes1234a at 2007-7-29 12:26:28 > top of Java-index,Java Essentials,Java Programming...