Question: Hello, I need help creating this java class with this information. Imported Classes java.util.ArrayList java.util.Arrays java.util.Random (optional) cst8132.restaurant.Menu cst8132.restaurant.Restaurant Instance Variables ArrayList guests String[] movies
Hello, I need help creating this java class with this information.
Imported Classes
java.util.ArrayList
java.util.Arrays
java.util.Random (optional)
cst8132.restaurant.Menu
cst8132.restaurant.Restaurant
Instance Variables
ArrayList
String[] movies
String movieTitle
int movieTime
Restaurant restaurant
Menu menu
Bill bill
Class Variables
Random random
Methodspublic DoubleDate(String yourName, String guests)
Initialize the guests instance variable by creating a new ArrayList
Using the ArrayList add method, add your name to the ArrayList. This will insert your name in position 0 of the ArrayList.
If there are any additional guests to add, use the ArrayList addAll and Arrays.
Initialize the restaurant by calling the static Restaurant.getInstance(String name) method.
Initialize the menu by calling the restaurant.getMenu() method, and then invoking the addMenuItems() method.
Initialize the bill by calling the default constructor of the Bill class.
Initialize the movies array by adding at least 3 movie titles to the array.
public String pickAMovie(String[] movies)
Using either the Math.random or Random.nextInt method, select a movie to attend, and return this value.
public int getShowing()
Using either the Math.random or Random.nextInt method, randomly return the value 6 or 10, to represent the time you will be attending the movie.
public void addMenuItems()
There is a method in the Menu class with the following signature:
public boolean addMenuItem(String itemType, String name, double price)
Using this method and the itemType values listed below, add at least 3 items of each type to your menu. Drink prices should be at least $5.00. Dessert and Appetizer prices must be evenly divisible by 2.
Drinks
Desserts
Appetizers
Entrees
Menu item names should be a maximum of 30 characters in length for optimal formatting of outpout.
public boolean placeOrder(String guest, String itemType)
Get a random MenuItem to order by calling the getRandomMenuItem(String itemType) method of the Menu class.
Add this MenuItem to this persons order by calling the addOrderItem(String guest, MenuItem menuItem) method of the Bill class.
The addOrderItem method returns a boolean value, which should be returned by this placeOrder method.
public static void main(String[] args)
Initialize a new DoubleDate by passing name(s) to the constructor. The first name passed should be your own. The second name would be your date. The third name would be your dates friend and the fourth name passed would be their date. Note that only the first name is mandatory.
Pass a String array of at least 3 movie titles (enter your own set of titles) to the pickAMovie method and assign the return value to the movieTitle instance variable.
Call the getShowing method and assign the return value to the movieTime variable.
Based on the movieTime, set the isHappyHour variable of your Bill by calling the setHappyHour(boolean isHappyHour) method.
For each guest at the restaurant, call the placeOrder(String guest, String itemType) method as needed, based on the requirements in the program description. This will add random menu items to your bill.
Print the DoubleDate object by implicitly calling its toString() method, like this:
public String toString()
Output the list of movie options, the selected movie, and show time.
Output the name of the restaurant, and based on the show time, whether you will be meeting there before or after the movie.
Output one of the following statements:
It's happy hour! $2 off drinks, and 1/2 price appetizers!!
We'll be missing happy hour, but we'll still be happy!
Output the menu, by calling its toString() method.
Output the bill, by calling its toString() method.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
