Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

To increase the efficiency of your code, youre going to use the Taco.javaclass for every taco. Youre going to write the process of creating a

To increase the efficiency of your code, youre going to use the Taco.javaclass for every taco. Youre going to write the process of creating a taco object from an order in PoD.java.

Once youve created a Taco object, print out the toString() method by printing out the object. Remember that you dont need to do System.out.println(taco.toString()). Calling toString() is unnecessary.

image text in transcribed

image text in transcribed

public class Taco

{

//attributes

private boolean shell;

private boolean togo;

private String ingredients;

//constructor

public Taco()

{

shell = true;

ingredients = "none";

togo = true;

}

//Getters

public boolean getShell(){return shell;}

public boolean getTogo(){return togo;}

public String getIngredients(){return ingredients;}

//Setters

public void setShell(boolean shell){this.shell = shell;}

public void setTogo(boolean togo){this.togo = togo;}

public void setIngredients(String ingredients){this.ingredients = ingredients;}

public String toString()

{

String order = "";

if(shell)

order += "Shell: hard ";

else

order += "Shell: soft ";

if(togo)

order+= "Order: togo ";

else

order+= "Order: not togo ";

order += "Ingredients: " + ingredients;

return order;

}

}

import java.util.Scanner;

public class PoD {

public static void main( String [] args ) {

// PLEASE START YOUR CODE HERE

// *********************************************************

// *********************************************************

//PLEASE END YOUR CODE HERE

System.out.print("END OF OUTPUT");

}

}

Input You will be given the following parameters in this order: a boolean (shell): the shell type (hard or soft) a boolean (togo): if the order is to eat in or out a list of ingredients (ingredients): a list of Strings describing which ingredients are in the taco. The Taco.java class accepts a single String. Processing Create a Taco object Assign input to Taco object Note: nextBoolean( for getting the next boolean. Print out Taco object Output The format of the input is given to you by the toString method in the Taco.java object class. All you need to do is print it out

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advanced MySQL 8 Discover The Full Potential Of MySQL And Ensure High Performance Of Your Database

Authors: Eric Vanier ,Birju Shah ,Tejaswi Malepati

1st Edition

1788834445, 978-1788834445

More Books

Students also viewed these Databases questions

Question

How are members held accountable for serving in the assigned roles?

Answered: 1 week ago

Question

Have roles been defined and assigned?

Answered: 1 week ago