Question
in Java Objective: you can only use java.util.linkedlist, java.util.queue,java.util.stack The goal of this assignment is to practice stacks and queues. Assignment: The first part of
in Java Objective: you can only use java.util.linkedlist, java.util.queue,java.util.stack
The goal of this assignment is to practice stacks and queues. Assignment: The first part of your assignment is to implement both a stack and a queue data structure. You may use either an array-based implementation or a reference-based list implementation (the one that is in the book). Your Stack class should implement the standard push(), pop(), and peek() methods, in addition to a constructor. Your Queue class should implement the standard enqueue(), dequeue(), and peek() methods, in addition to a constructor. Next, you will write two programs to test your Stack and Queue classes.
Queue Program: To-do List Write a program that uses a queue to implement a simple "todo" list. Each item in the list will have a name and an estimated time to complete. Your program will prompt the user for input. The user can either choose to complete the top task on the list, add a new task (with additional prompts for the name and estimated time to complete), or print the current list of tasks in an easy-to-read format. You may want to add a print method to your queue implementation to support this final task. Make sure to print an error message if the user tries to complete a non-existent task.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started