Sebastian Foster Software Development 1 CRN: 15339
- Map Program Description: This program uses the Java ArrayList class to emulate an address book. Addresses can be stored, retrieved, and deleted by the user. The first name, last name, and street address make up each address.
Programming Concepts: Classes and Objects: The program defines an Address class to represent individual addresses and an AddressBook class to manage a list of addresses. Collections: Uses ArrayList to store the addresses. Encapsulation: The fields of the Address class are private and are accessed via getter methods. Basic I/O Operations: Handles console input and output using the Scanner class.
Inputs: User provides a first name, last name, and street address to add to the address book. User inputs a last name to search for or delete an address.
Outputs: Displays a list of all stored addresses. Outputs the details of an address when searched by last name. Confirms the deletion of an address.
- Queue and ArrayList Program Description: Using a queue, this program emulates a basic ticket assignment system. Every participant in the queue receives a random ticket number from the program, which then removes them from the queue when the tickets are assigned.
Programming Concepts: Queues: Utilizes a Queue to manage the people waiting for ticket assignment. ArrayList: Uses ArrayList to manage the pool of ticket numbers available for assignment. Randomization: Employs the Random class to assign random ticket numbers.
Inputs: The program is preconfigured to handle a list of people.
Outputs: Outputs the assigned ticket number for each person in the queue.
- Stack Program Description: The program uses a stack to simulate a straightforward card game. Five cards are chosen at random from a deck of cards, placed onto a stack, and then the cards are exposed by being popped off the stack.
Programming Concepts: Stacks: Utilizes a Stack to manage the order of the cards. Randomization: Uses the Random class to pick cards from the deck. Arrays: An array is used to store the deck of cards
Inputs: The program does not require input from the user; it randomly selects and pushes cards onto the stack.
Outputs: Outputs the details of each card as it is popped from the stack.
Conclusion: These programs show how to use ArrayLists, Queues, and Stacks—basic Java data structures—as well as standard actions like adding, deleting, and accessing elements.