computer science

profilew.2.a
assingment_computer_sceicne_.docx

This question will need to be done in ECLIPSE or a compiler of your choice and that file will need to be submitted to me.

 

Line at the Department of Motor Vehicles :

 

Write a complete program that stores and prints a line at a DMV. As part of your program, write a DMV class that implements these members:

· An instance constant that holds the maximum number of a line.

· Three instance variables that hold, respectively, the actual number of people in line, an array of the names of the people in line, and the DMV workers name.

· A constructor that stores the maximum number of the line and the workers name.

· An addCustomer method that  adds a customer to the line list or prints an error message if the customer is already on the list or there’s no more room in the line.

· A helper method, isInLine, that receives a parameter named customer. The method returns true if customer is in the line and returns false otherwise.

· A printDMVLINE method that prints the DMV representative and customer.(see sample output below)

 

Provide a driver class that tests your DMV class. Your driver class should contain this main method:

 

public static void main(String[] args)

{

  DMV dmv = new DMV(7, "Naggy Netty");

  dmv.addCustomer("Johnny Lately");

  dmv.addCustomer("Richard Joke");

  dmv.addCustomer("Seymore Butes");

  dmv.addCustomer("Johnny Lately");

  dmv.addCustomer("Alek Holick");

  dmv.addCustomer("Sara Smith");

  dmv.addCustomer("Kyle Scott");

  dmv.addCustomer("NAME OF YOUR CHOICE");

  dmv.addCustomer("Elizabeth Huff");

  dmv.printDMV();

} // end main

 

When compiled and run, your driver class and DMV class together should produce this output:

 

Johnny Lately  is already in line.

Elizabeth Huff cannot get in line yet she has to wait in a chair.  The line is full.

People in line for Naggy Netty:

Johnny Lately

 Richard Joke

 Seymore Butes

 Johnny Lately

 Alek Holick

 Sara Smith

 Kyle Scott

 NAME OF YOUR CHOICE

NOTE:

Try to use Eclipse my teacher prefers it.