Write a program that uses one of the Map classes to implement a contact list

Question # 00254772 Posted By: kimwood Updated on: 04/18/2016 08:49 AM Due on: 05/18/2016
Subject Computer Science Topic General Computer Science Tutorials:
Question
Dot Image

1. Write a program that uses one of the Map classes to implement a contact list. Contact information should include first name, last name, a phone number and an email
address. The list should be stored on your computer’s file system and entries sorted alphabetically according to a person’s last name. The program should prompt the user
for the name of the file where the information is stored, and allow the user to add a contact from the list, delete a contact from the list, and display the entire contact list.


2. A print queue is a list of documents, called jobs, waiting to be printed. Each job is assigned an integer job number and an estimated print time, in seconds. If a job arrives
and the printer is currently printing another job, the job waits in the print queue. This type of waiting line is called a first-in-first-out (FIFO) or first-come-first-serve (FCFS)
waiting line model or queue. The Java LinkedList class is a pretty good class for implementing a waiting line model like this in code.


Write a program that uses a LinkedList object to store a list of print jobs in a FIFO queue. We will assume that each job has a unique job number that is assigned
sequentially, and that the print time is randomly distributed between 10 seconds and 1000 seconds. These two data elements should be defined as part of a Job class. The
program should prompt the user to either add a job to the queue or to quit. When a user adds a job, the program assigns a job number and randomly generates a print time
for the job. When the user quits, the program will display the jobs (i.e., the job id and print time) in the queue, in the order in which they were added.
For this exercise, you can use the java.util.Random class to generate random
numbers, as follows:
Random rnGenerator = new Random( rnSeed );
printTime = rnGenerator.nextInt( 1000 ) + 10;

// creates a Random object
// next int in range 10-1000

The first statement above instantiates a Random object called rnGenerator. The constructor argument rnSeed is called a random number seed. It is of type long, and
is used to help ensure that the same sequence of random numbers is generated each time the program is run…which is helpful for test purposes. The nextInt() method
returns a random integer in the range 0 to 999.


Dot Image
Tutorials for this Question
  1. Tutorial # 00250020 Posted By: kimwood Posted on: 04/18/2016 08:49 AM
    Puchased By: 3
    Tutorial Preview
    Theprogram should prompt the user to either add a job ...
    Attachments
    Selection_254_and_253.zip (462.5 KB)
    Recent Feedback
    Rated By Feedback Comments Rated On
    sc...nte Rating Very quick and supportive tutor response 12/12/2016

Great! We have found the solution of this question!

Whatsapp Lisa