Question

Write a java program Portillo's Hptdogs. You need to get two carry out lunches from portillo's....

Write a java program

Portillo's Hptdogs. You need to get two carry out lunches from portillo's. Each order has a sandwich but different kinds; each should have fries but different sizes; no drinks in the bag please! Use any condiments for the sandwiches .

Use different bags for each lunch.

Then print each bag. Please keep the cost below twenty dollars

0 0
Add a comment Improve this question Transcribed image text
Answer #1

I have made 5 classes and all under the same package to solve this question

----------------------------------------------------------------------------------------------------------------------------------------------------------------------

package com.HomeworkLib.lunch;

public class Main {

   public static void main(String[] args) {

       Sandwich sandwich1 = new Sandwich("Egg Sandwich", 8);
       Fries fries1 = new Fries("Large", 6);
       Condiments condiments1 = new Condiments("Barbeque Sauce", 4);
       Lunch lunch1 = new Lunch(sandwich1, fries1, condiments1); // ordering food
       int cost1 = lunch1.calculateCost(sandwich1, fries1, condiments1);
       if (cost1 < 20) // check price less than 20
           System.out.println("1st Lunch ordered : " + sandwich1.getType() + " with " + fries1.getSize()
                   + " fries and " + condiments1.getType() + " ,Cost:" + cost1);

       Sandwich sandwich2 = new Sandwich("Chicken Sandwich", 10);
       Fries fries2 = new Fries("Medium", 4);
       Condiments condiments2 = new Condiments("Ketchup", 3);
       Lunch lunch2 = new Lunch(sandwich2, fries2, condiments2); // ordering food
       int cost2 = lunch2.calculateCost(sandwich2, fries2, condiments2);
       if (cost2 < 20) // check price less than 20
           System.out.println("2nd Lunch ordered : " + sandwich2.getType() + " with " + fries2.getSize()
                   + " fries and " + condiments2.getType() + " ,Cost:" + cost2);

   }

}

--------------------------------------------------------------------------------------------------------------------------------------------------------------------

package com.HomeworkLib.lunch;

public class Lunch {

   private Sandwich sandwich;
   private Fries fries;
   private Condiments condiments;

   public Lunch(Sandwich sandwich, Fries fries, Condiments condiments) {
       this.sandwich = sandwich;
       this.fries = fries;
       this.condiments = condiments;
   }

   public int calculateCost(Sandwich sandwich, Fries fries, Condiments condiments) {
       return sandwich.getPrice() + fries.getPrice() + condiments.getPrice();
   }

}

---------------------------------------------------------------------------------------------------------------------------------------------------------------

package com.HomeworkLib.lunch;

public class Sandwich {

   private String type;
   private int price;

   public Sandwich(String type, int price) {
       this.type = type;
       this.price = price;
   }

   public int getPrice() {
       return price;
   }

   public String getType() {
       return type;
   }

}

---------------------------------------------------------------------------------------------------------------------------------------------------------------

package com.HomeworkLib.lunch;

public class Fries {

   private String size;
   private int price;

   public Fries(String size, int price) {
       this.size = size;
       this.price = price;
   }

   public int getPrice() {
       return price;
   }

   public String getSize() {
       return size;
   }

}

--------------------------------------------------------------------------------------------------------------------------------------------------------

package com.HomeworkLib.lunch;

public class Condiments {

   private String type;
   private int price;

   public Condiments(String type, int price) {
       this.type = type;
       this.price = price;
   }

   public int getPrice() {
       return price;
   }

   public String getType() {
       return type;
   }

}

--------------------------------------------------------------------------------------------------------------------------------------------------------------

Hope i have answered your question

Regards

Add a comment
Know the answer?
Add Answer to:
Write a java program Portillo's Hptdogs. You need to get two carry out lunches from portillo's....
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • .Need code for my java class !! Write a simple java program that uses loops. You...

    .Need code for my java class !! Write a simple java program that uses loops. You may use ‘WHILE’ or ‘FOR’ or ‘DO-WHILE’ – you decide. The program should use a loop to compute the semester average for up to 5 students. In the loop the user will ask for a student name and their 3 test scores and add them up and divide the total by 3 giving the semester average. You will print out the student name and...

  • Overview JAVA LANGUAGE PROBLEM: The owner of a restaurant wants a program to manage online orders...

    Overview JAVA LANGUAGE PROBLEM: The owner of a restaurant wants a program to manage online orders that come in. This program will require multiple classes. Summary class, customer class, order class and the driver class. Summary class This class will keep track of the cost of the order and output a summary, which includes the total for the order. The methods in this class are static. There are no instance variables, and instead uses an Order object that is passed...

  • Order up:: Write a program that will be used to keep track of orders placed at...

    Order up:: Write a program that will be used to keep track of orders placed at a donut shop. There are two types of items that can be ordered: coffee or donuts. Your program will have a class for each order type, and an abstract superclass. Coffee orders are constructed with the following information: quantity (int) - how many coffees are being ordered size (String) - the size of the coffees (all coffees in the order have the same size)...

  • IN C# Write a program to help a local restaurant automate its lunch billing system. The...

    IN C# Write a program to help a local restaurant automate its lunch billing system. The program should do the following: Show the customer the different lunch items offered by the restaurant. Allow the customer to select more than one item from the menu. Calculate and print the bill. Assume that the restaurant offers the following lunch items (the price of each item is shown to the right of the item): Ham and Cheese Sandwich $5.00 Tuna Sandwich $6.00 Soup...

  • need java code. (d) is cartesian product rule. Design a program to let user enter two...

    need java code. (d) is cartesian product rule. Design a program to let user enter two lists of numbers within the range [0, 9] from keyboard, you could either use flag to denote end of the list or ask user to enter the list size first and then enter the list numbers. Each of these two lists represents a set (keep in mind that duplicate elements are not allowed in a set), so we have two sets A and B....

  • ** Use Java programming language Program the following algorithms in JAVA: A. Classical matrix multiplication B....

    ** Use Java programming language Program the following algorithms in JAVA: A. Classical matrix multiplication B. Divide-and-conquer matrix multiplication In order to obtain more accurate results, the algorithms should be tested with the same matrices of different sizes many times. The total time spent is then divided by the number of times the algorithm is performed to obtain the time taken to solve the given instance. For example, you randomly generate 1000 sets of input data for size_of_n=16. For each...

  • Write a Python program to read lines of text from a file. For each word (i.e,...

    Write a Python program to read lines of text from a file. For each word (i.e, a group of characters separated by one or more whitespace characters), keep track of how many times that word appears in the file. In the end, print out the top twenty counts and the corresponding words for each count. Print each value and the corresponding words, in alphabetical order, on one line. Print this in reverse sorted order by word count. You can assume...

  • Write a JAVA program to monitor the flow of an item into an out of a...

    Write a JAVA program to monitor the flow of an item into an out of a warehouse. The warehouse has numerous deliveries and shipments for this item (a widget) during the time period covered. A shipment out (an order) is billed at a profit of 50% over the cost of the widget. Unfortunately each incoming shipment may have a different cost associated with it. The accountants of the firm have instituted a last-in, first out system for filling orders. This...

  • Please write this code in JAVA lang., thank you! Your spouse's cousin's nephew's dog's trainer's ...

    Please write this code in JAVA lang., thank you! Your spouse's cousin's nephew's dog's trainer's best friend owns a restaurant. That person is very bad at math and recently discovered that most customers have been significantly undercharged for meals. You have been approached to create a computer program that will accurately calculate bills for each customer. Kids, under 5, eat free. Teens and seniors get a 25% discount. Also, Food and beverage is taxed at 5%. No tax for anything...

  • Please write this code in JAVA lang., thank you! Your spouse's cousin's nephew's dog's trainer's best...

    Please write this code in JAVA lang., thank you! Your spouse's cousin's nephew's dog's trainer's best friend owns a restaurant. That person is very bad at math and recently discovered that most customers have been significantly undercharged for meals. You have been approached to create a computer program that will accurately calculate bills for each customer. Kids, under 5, eat free. Teens and seniors get a 25% discount. Also, Food and beverage is taxed at 5%. No tax for anything...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT