Question
Hello, I need help creating these java methods. public DoubleDate(String yourName, String guests) Initialize the guests instance variable by creating a new ArrayList . Give
Hello, I need help creating these java methods.
public 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.
and this method
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.
I already having existing class Bill.java here
package dateNight;
import java.util.ArrayList; import java.util.HashMap;
import cst8132.restaurant.Appetizer; import cst8132.restaurant.Drink; import cst8132.restaurant.MenuItem;
public class Bill {
private HashMap
return true; } public double getHappyHourDiscount() { double happyHourDiscount = 0; if (!isHappyHour) return 0; for (ArrayList
s += String.format(format, "Subtotal", getSubtotal()); s += String.format(format, "Happy Hour Discount", getHappyHourDiscount()); s += String.format(format, "HST " + (int) (hstRate * 100) + "%", getHst()); s += String.format(format, "Total", getTotal()); return s; } }
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