Subject Computer Science Java Programming


Phone Records
As part of its work ‘logging’ all telephone calls, the NSA requires a way to save and ultimately correlate phone logs.
As a first step, it has been suggested that a hash table be used to keep a list of all calls to/from a specific number. Hash tables are known to provide O(1) access. The original design specification is to use a telephone number (a String) as the table key and a list of call records for the table entry.
A call record contains the ‘other’ phone number, the date/time, and duration of the call. Call records are obtained from the Telco’s billing records, as such, for each call placed there will be (in most cases) another matching received call.
- As a first cut, create a program to perform the following:
1. Read a data file of billing records
2. Create a call record and enter each record into the hash table, and,
3. Print a list of each call record for each entry in the table.
- Because multiple calls can be made/received from the same number, each hash table entry needs to be a list – an ordered list according to call time.
- Aside from containing the relevant call data, a CallRecord class will contain the appropriate accessor and mutator methods plus any additional methods required to support the functionality described above.
The file will contain multiple lines of billing records, one per line. The format, in whitespace separated form, is as follows:
- n-digit telephone number – (String)
- n-digit telephone number called/received – (String)
- To/From indicator (1,0) – (Integer)
- Number of minutes used – (Integer)
- Day of year (1-366) – (Integer)
- Call time (24 hour format) hours – (Integer)
- Call time minutes – Integer)
- Call time seconds – (Integer)
*US telephone numbers are 10 digits long, however, international numbers can be of varying lengths.
Sample Input – TelcoIn.txt
9997751000 8005551212 1 65 10 11 01 00
9997751000 9991551212 0 45 15 12 01 00
9997751000 8005551212 1 120 10 11 01 00
9995551234 8005551212 1 645 311 10 01 00
9997751000 8005551212 1 65 312 22 59 59
9997751000 8005551212 1 13 313 22 10 31
9997751000 8005551212 1 35 355 11 00 10
9991551212 9997751000 1 45 15 12 01 00
**You may use java collections**

Solution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

import java.util.Scanner;
import java.util.logging.Level;
import java.util.logging.Logger;

* @author
public class Project5 {
    public static void main(String[] args) {
       HashTable ht = new HashTable();
       Scanner keyboard = new Scanner(;
       System.out.print("Enter name of input file: ");
       String file =;
       readFile(ht, file);
       System.out.println("" + ht.toString());

This is only a preview of the solution. Please use the purchase button to see the entire solution


or free if you
register a new account!

Assisting Tutor

Related Homework Solutions

Get help from a qualified tutor
Live Chats