Académique Documents
Professionnel Documents
Culture Documents
a) reads a set of numbers from the command line, converts them to doubles, stores them in an array of
doubles and displays them;(3 Marks)
b) calculates the mean value (5 marks) and standard deviation (7 marks) of the array in separate methods
(which accept an array as a parameter) and displays the result.
c) You get 5 marks if you use try{} and catch{} blocks to catch different types of Exceptions.
where N- is the number of trunks (system capacity), A- is a traffic intensity (measured in Erlangs) calculated
with the formula:
A = number_calls_per_hour x average_call_length / 60
1. You will need to write a class TeletrafficFrame that creates a Frame like this:
F:/Teaching/java/…/ass2_2010.html 1/2
15/11/2010 Assignment 2
After entering initial values for the number of trunks, number of calls, the average call length and pressing the
"OK" button, your program should calculate the probability of conjection and display the result ( use a
JLabel). (8 Marks)
2. You should provide another class ProbConj for calculating the probability, using the numbers entered.
(You will pass them as parameters for a constructor of the class ProbConj). (12 Marks)
3. You get 10 marks if your program contains try{} and catch{} blocks to catch Exceptions, when a wrong
format number is entered, and as the result of this, a Dialog frame appears reporting an error. Like this:
Now if you press the Dialog button "OK", the Dialog Frame disappears, all the fields in the main frame are
cleaned up, and it is ready to accept new numbers.
Check how the probality changes if you have only 4 trunks, an increased number of calls up to 1800 and an
increased length of a single call up to 10 min. Make sure that all the numbers entered into the frame fileds are
positive! Note, that 0!=1 . You will need this for your calculations.
Method of submission
You have to submit all source (Java) files electronically via Blackboard.
Try to write well designed programs with lots of comments to make them user-friendly.
F:/Teaching/java/…/ass2_2010.html 2/2