Answer :
Answer:
import java.util.Scanner;
/*
* Class Taco
* @shell
* @togo
* @ingredients
*/
class Taco{
//Attributes
private boolean shell;
private boolean togo;
private String ingredients;
//Default constructor
public Taco() {
shell=false;
togo=false;
ingredients="";
}
//Parameterized constructor
public Taco(boolean shell,boolean togo,String ingredients) {
this.shell=shell;
this.togo=togo;
this.ingredients=ingredients;
}
//Getters and setters
public boolean isShell() {
return shell;
}
public void setShell(boolean shell) {
this.shell = shell;
}
public boolean isTogo() {
return togo;
}
public void setTogo(boolean togo) {
this.togo = togo;
}
public String getIngredients() {
return ingredients;
}
public void setIngredients(String ingredients) {
this.ingredients = ingredients;
}
//override to string
public String toString() {
String str="Shell: ";
if(shell==false) {
str+="soft\n";
}
else {
str+="hard\n";
}
str+="Order: ";
if(togo==false) {
str+="out\n";
}
else {
str+="togo\n";
}
str+="Ingredients: "+ingredients;
return str;
}
}
public class PoD {
public static void main(String[] args) {
//Scanner object for input read
Scanner sc=new Scanner(System.in);
//user inputs
System.out.print("Do you want taco shell hard or soft(true/false): ");
boolean shell=sc.nextBoolean();
System.out.print("Do you want taco in and out(true/false): ");
boolean togo=sc.nextBoolean();
sc.nextLine();
System.out.print("Enter all ingredients: ");
String ingredients=sc.nextLine();
//Create Taco object
Taco taco=new Taco(shell,togo,ingredients);
System.out.println("\n"+taco+"\n");
System.out.println("END OF OUTPUT");
}
}