Urgent help with assignment due tomorow
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
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
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");
}
if (numCallType == 1)
{
System.out.println("ones");
}
}
}
public PhoneProject()
{
Container contentPane;
setBounds(X_ORIGIN, Y_ORIGIN, WIDTH, HEIGHT);
setTitle("Phone Analyzer");
setResizable(true);
}
}
This is my .txt file first numbers=extension, 2nd is 0=internal 1=external, 3rd is time in seconds
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
thanx so much for your help
Dan

