A deluxe meal, represented by a DeluxeMeal object, includes a side dish and a drink for an additional cost of $3. The DeluxeMeal class is a subclass of Meal. The DeluxeMeal class contains two additional attributes not found in Meal: A String variable representing the name of the side dish included in the meal A String variable representing the name of the drink included in the meal

Respuesta :

Answer:

DeluxeMeal burritoCombo = new DeluxeMeal ("burrito", "chips", "Lemonade", 7.49);

Explanation:

The above statement will be inserted in the software and the result will show the Deluxe meal details such as burrito which is an entrée, chips are side dish and lemonade is a drink. The cost of single burrito is 7.49 so with the meal the cost will be $3 higher which means the total cost will be $10.49

Java code for the problem:

Java is a high-level, general-purpose, object-oriented, and secure programming language developed by James Gosling at Sun Microsystems, Inc. in 1991. It is formally known as OAK.

The codes are attached below.

//Complete implementation of Meal class

class Meal{

       //Declaring variables

       String name;

       double cost;

       //Constructor to initialize objects

       public Meal(String name,double cost){

               this.name=name;

               this.cost=cost;

       }

       //Overriding toString() method

       public String toString(){

               return name+" meal, $"+cost;

       }

}

class DeluxeMeal extends Meal{

       String sidedish;

       String drink;

public DeluxeMeal(String name,String sidedish,String drink,double cost){

               super(name,cost);

               this.sidedish=sidedish;

               this.drink=drink;

       }

       public String toString(){

               return "deluxe "+name+" meal, $"+(cost+3);

       }

       

}

class MealEx{

       public static void main(String[] args){

               /*Creating the object of Meal class

               Meal burger=new Meal("hamburger",7.99);

               System.out.println(burger.toString());*/

               DeluxeMeal burritoCombo = new DeluxeMeal("burrito", "chips", "lemonade", 7.49);

               System.out.println(burritoCombo.toString());

       }

}

The output is attached below.

Learn more about the topic Java code:

https://brainly.com/question/2266606

Ver imagen Omm2