Please demo the programs to the instructor during
open lab or upload the .java files to Ecampus.
1.
Create a program named parentheses.java that reads in a string of various
parentheses, brackets, and braces from standard input. Write a method that
checks whether or not the parentheses, brackets, and braces are balanced.
Example output
This program checks if
the parentheses, brackets, and braces are balanced.
Please enter a string:
(({}[()]{[]}))
This string is balanced.
This program
checks if the parentheses, brackets, and braces are balanced.
Please enter a string:
{[])[()]}
This string is not balanced.
Complete one of the two programs:
Option 2a. Create a program named equation.java that uses two stacks
(Value and Operator) to evaluate a simple equation. It should let the user
enter an equation that can include addition, subtraction, multiplication,
division, and parentheses.
Example equation:
(2+3)*(8-4)*(5-3)
Option 2b. Create a program named restaurant.java that
implements a queue of food orders. The class is below:
class Order
{
String Item;
double Price;
Date OrderTime = new Date();
// add a constructor with parameters for the attributes
}
Main program methods should include Enqueue, Dequeue.
The main program should have the
following menu options:
=====================================
1 = Enqueue an order for a taco
2 = Enqueue an order for a burrito
3 = Enqueue an order for a quesadilla
4 = List all items in queue
5 = Dequeue an order
6 = Exit
=====================================
Your Choice:
Extra Credit: Instead of a dequeue
option, have an order dequeued every 10 seconds. Dequeued items should be listed
whenever you do any menu option.