GTSandwich.java 1. Create a class called GTSandwich 2. GTSandwich has 7 private instance variables: • • • A String variable called bread that stores the type of bread the customer wants. A String variable called meat that stores the meat the customer wants. A String array variable called extras that stores the various vegetables, sauces, or extras the customer wants. • An int variable called numMeat that stores the number of meats the customer wants. A double variable called price that stores the cost of the sandwich. A boolean variable called has Sauce that stores whether the sandwich has the special GT house sauce. • A boolean variable called makeCombo that stores whether the customer wants to make the sandwich a combo. 3. GTSandwich has these constructors: • A constructor that takes in bread, meat, extras, numMeat, price, hasSauce, and makeCombo in this exact order. The constructor should correctly initialize the variables to the values passed in. • A constructor that takes in bread, meat, and makeCombo in this order. This constructor sets the following defaults: o number of meats should be 4, o cost should be 8.75, o should have the special house sauce, o and there should be no extras (a sandwich that has no extras should have an empty array). • A zero-argument constructor which sets the following defaults: o bread is Rye, o choice of meat is Turkey, o no extras (A sandwich that has no extras should have an empty array for extras), o 4 slices of meat, o costs 8.75, o has the special house sauce, o and the sandwich is a combo in this order. Must use constructor chaining when possible.
Hi, I need help on this question.
GTSandwich has these constructors:
• A constructor that takes in bread, meat, extras, numMeat, price, hasSauce, and
makeCombo in this exact order. The constructor should correctly initialize the variables to the
values passed in.
• A constructor that takes in bread, meat, and makeCombo in this order. This constructor sets
the following defaults:
o number of meats should be 4,
o cost should be 8.75,
o should have the special house sauce,
o and there should be no extras (a sandwich that has no extras should have an empty
array).
• A zero-argument constructor which sets the following defaults:
o bread is Rye,
o choice of meat is Turkey,
o no extras (A sandwich that has no extras should have an empty array for extras),
o 4 slices of meat,
o costs 8.75,
o has the special house sauce,
o and the sandwich is a combo in this order.
• Must use constructor chaining when possible.
Step by step
Solved in 4 steps with 4 images