SlideShare a Scribd company logo
BasicPizza.java
public class BasicPizza {
String type;
String crust;
String ingredients;
double cost;
public BasicPizza(String type) {
super();
this.type = type;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getCrust() {
return crust;
}
public void setCrust(String crust) {
this.crust = crust;
}
public BasicPizza() {
super();
}
public String getIngredients() {
return ingredients;
}
public void setIngredients(String ingredients) {
this.ingredients = ingredients;
}
public double getCost() {
return cost;
}
public void setCost() {
this.cost = 5;
}
@Override
public String toString() {
return "BasicPizza [type=" + type + ", crust=" + crust + ", ingredients="
+ ingredients + ", cost=" + cost + "]";
}
}
________________________________________________________________________
LiFiCheese.java
public class LiFiCheese extends BasicPizza{
private String crust;
private double cost;
private String ingredients;
public LiFiCheese() {
super("Cheese");
this.cost=5;
}
public void setCrust()
{
this.crust="thin";
}
public String getCrust()
{
return crust;
}
public double getCost() {
return cost;
}
public void setCost(double cost) {
}
public String getIngredients() {
return ingredients;
}
public void setIngredients(String ingredients) {
this.ingredients = ingredients;
}
@Override
public String toString() {
System.out.println("You Ordered :");
System.out.println(getType());
setCrust();
System.out.println(getCrust());
System.out.println("Total Cost of :"+getCost());
return "";
}
}
_______________________________________________________________________
LiFiPizza.java
import java.util.Scanner;
public class LiFiPizza extends BasicPizza {
private String type;
private double cost;
private String crust;
private String ingredients;
public LiFiPizza()
{
super();
this.type = "Meat";
this.cost=5;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public double getCost() {
return cost;
}
public void setCost() {
this.cost = this.cost+2;
}
public String getCrust() {
return crust;
}
public void setCrust(String crust) {
if(crust.equals("Thin"))
{
this.crust="Thin";
}
else if(crust.equals("Thick"))
{
this.crust="Thick";
}
}
public String getIngredients() {
return ingredients;
}
public void setIngredients(String ingredients) {
this.ingredients = ingredients;
}
@Override
public String toString() {
System.out.println("You Ordered :");
System.out.println(getType());
System.out.println(getIngredients()+"<+$2.00>");
System.out.println(getCrust());
System.out.println("Total Cost of :"+getCost());
return "";
}
}
_____________________________________________________________________
LiFiUnit5Ch14.java
import java.util.Scanner;
public class LiFiUnit5Ch14 {
public static void main(String[] args) {
BasicPizza bp=null;
String typeOfPizza;
Scanner sc=new Scanner(System.in);
System.out.print("What type of pizza would you like :");
typeOfPizza=sc.next();
if(typeOfPizza.equalsIgnoreCase("Meat"))
{
bp=new LiFiPizza();
System.out.print("Thin or Thick Crust:");
String crust=sc.next();
bp.setCrust(crust);
System.out.print("What ingredient, sorry, only 1 :");
String ingredient=sc.next();
bp.setIngredients(ingredient);
bp.setCost();
bp.toString();
}
else if(typeOfPizza.equalsIgnoreCase("Cheese"))
{
bp=new LiFiCheese();
bp.toString();
}
}
}
_________________________________________________________________
Output:
What type of pizza would you like :Meat
Thin or Thick Crust:Thin
What ingredient, sorry, only 1 :Sausage
You Ordered :
Meat
Sausage<+$2.00>
Thin
Total Cost of :7.0
__________________________________________
Output:
What type of pizza would you like :Cheese
You Ordered :
Cheese
thin
Total Cost of :5.0
_______________________________________________________
Solution
BasicPizza.java
public class BasicPizza {
String type;
String crust;
String ingredients;
double cost;
public BasicPizza(String type) {
super();
this.type = type;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getCrust() {
return crust;
}
public void setCrust(String crust) {
this.crust = crust;
}
public BasicPizza() {
super();
}
public String getIngredients() {
return ingredients;
}
public void setIngredients(String ingredients) {
this.ingredients = ingredients;
}
public double getCost() {
return cost;
}
public void setCost() {
this.cost = 5;
}
@Override
public String toString() {
return "BasicPizza [type=" + type + ", crust=" + crust + ", ingredients="
+ ingredients + ", cost=" + cost + "]";
}
}
________________________________________________________________________
LiFiCheese.java
public class LiFiCheese extends BasicPizza{
private String crust;
private double cost;
private String ingredients;
public LiFiCheese() {
super("Cheese");
this.cost=5;
}
public void setCrust()
{
this.crust="thin";
}
public String getCrust()
{
return crust;
}
public double getCost() {
return cost;
}
public void setCost(double cost) {
}
public String getIngredients() {
return ingredients;
}
public void setIngredients(String ingredients) {
this.ingredients = ingredients;
}
@Override
public String toString() {
System.out.println("You Ordered :");
System.out.println(getType());
setCrust();
System.out.println(getCrust());
System.out.println("Total Cost of :"+getCost());
return "";
}
}
_______________________________________________________________________
LiFiPizza.java
import java.util.Scanner;
public class LiFiPizza extends BasicPizza {
private String type;
private double cost;
private String crust;
private String ingredients;
public LiFiPizza()
{
super();
this.type = "Meat";
this.cost=5;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public double getCost() {
return cost;
}
public void setCost() {
this.cost = this.cost+2;
}
public String getCrust() {
return crust;
}
public void setCrust(String crust) {
if(crust.equals("Thin"))
{
this.crust="Thin";
}
else if(crust.equals("Thick"))
{
this.crust="Thick";
}
}
public String getIngredients() {
return ingredients;
}
public void setIngredients(String ingredients) {
this.ingredients = ingredients;
}
@Override
public String toString() {
System.out.println("You Ordered :");
System.out.println(getType());
System.out.println(getIngredients()+"<+$2.00>");
System.out.println(getCrust());
System.out.println("Total Cost of :"+getCost());
return "";
}
}
_____________________________________________________________________
LiFiUnit5Ch14.java
import java.util.Scanner;
public class LiFiUnit5Ch14 {
public static void main(String[] args) {
BasicPizza bp=null;
String typeOfPizza;
Scanner sc=new Scanner(System.in);
System.out.print("What type of pizza would you like :");
typeOfPizza=sc.next();
if(typeOfPizza.equalsIgnoreCase("Meat"))
{
bp=new LiFiPizza();
System.out.print("Thin or Thick Crust:");
String crust=sc.next();
bp.setCrust(crust);
System.out.print("What ingredient, sorry, only 1 :");
String ingredient=sc.next();
bp.setIngredients(ingredient);
bp.setCost();
bp.toString();
}
else if(typeOfPizza.equalsIgnoreCase("Cheese"))
{
bp=new LiFiCheese();
bp.toString();
}
}
}
_________________________________________________________________
Output:
What type of pizza would you like :Meat
Thin or Thick Crust:Thin
What ingredient, sorry, only 1 :Sausage
You Ordered :
Meat
Sausage<+$2.00>
Thin
Total Cost of :7.0
__________________________________________
Output:
What type of pizza would you like :Cheese
You Ordered :
Cheese
thin
Total Cost of :5.0
_______________________________________________________

More Related Content

Similar to BasicPizza.javapublic class BasicPizza { String type; String c.pdf

はじめてのGroovy
はじめてのGroovyはじめてのGroovy
はじめてのGroovy
Tsuyoshi Yamamoto
 
Solid
SolidSolid
Better Software: introduction to good code
Better Software: introduction to good codeBetter Software: introduction to good code
Better Software: introduction to good code
Giordano Scalzo
 
Getting the following errorsError 1 error C2436 {ctor} mem.pdf
Getting the following errorsError 1 error C2436 {ctor}  mem.pdfGetting the following errorsError 1 error C2436 {ctor}  mem.pdf
Getting the following errorsError 1 error C2436 {ctor} mem.pdf
herminaherman
 
Oop php 5
Oop php 5Oop php 5
Oop php 5
phpubl
 
PHPUnit でよりよくテストを書くために
PHPUnit でよりよくテストを書くためにPHPUnit でよりよくテストを書くために
PHPUnit でよりよくテストを書くために
Yuya Takeyama
 
Production.javapublic class Production {    Declaring instance.pdf
Production.javapublic class Production {    Declaring instance.pdfProduction.javapublic class Production {    Declaring instance.pdf
Production.javapublic class Production {    Declaring instance.pdf
sooryasalini
 
Adding Dependency Injection to Legacy Applications
Adding Dependency Injection to Legacy ApplicationsAdding Dependency Injection to Legacy Applications
Adding Dependency Injection to Legacy Applications
Sam Hennessy
 
Here is the codeimport java.util.; class GroceryItem { Stri.pdf
Here is the codeimport java.util.; class GroceryItem { Stri.pdfHere is the codeimport java.util.; class GroceryItem { Stri.pdf
Here is the codeimport java.util.; class GroceryItem { Stri.pdf
anand1213
 
Scala in practice
Scala in practiceScala in practice
Scala in practice
andyrobinson8
 
Java: Nie popełniaj tych błędów!
Java: Nie popełniaj tych błędów!Java: Nie popełniaj tych błędów!
Java: Nie popełniaj tych błędów!
Daniel Pokusa
 
MenuItemvpublic class MenuItem .pdf
MenuItemvpublic class MenuItem .pdfMenuItemvpublic class MenuItem .pdf
MenuItemvpublic class MenuItem .pdf
aparnaagenciestvm
 
多治見IT勉強会 Groovy Grails
多治見IT勉強会 Groovy Grails多治見IT勉強会 Groovy Grails
多治見IT勉強会 Groovy Grails
Tsuyoshi Yamamoto
 
@author public class Person{   String sname, .pdf
  @author   public class Person{   String sname, .pdf  @author   public class Person{   String sname, .pdf
@author public class Person{   String sname, .pdf
aplolomedicalstoremr
 
PHP for Adults: Clean Code and Object Calisthenics
PHP for Adults: Clean Code and Object CalisthenicsPHP for Adults: Clean Code and Object Calisthenics
PHP for Adults: Clean Code and Object Calisthenics
Guilherme Blanco
 
29. Code an application program that keeps track of student informat.pdf
29. Code an application program that keeps track of student informat.pdf29. Code an application program that keeps track of student informat.pdf
29. Code an application program that keeps track of student informat.pdf
arishaenterprises12
 
Modul Praktek Java OOP
Modul Praktek Java OOP Modul Praktek Java OOP
Modul Praktek Java OOP
Zaenal Arifin
 
Oops in php
Oops in phpOops in php
import java.util.Arrays;import java.util.List;public class Bursa.pdf
import java.util.Arrays;import java.util.List;public class Bursa.pdfimport java.util.Arrays;import java.util.List;public class Bursa.pdf
import java.util.Arrays;import java.util.List;public class Bursa.pdf
arpowersarps
 
I have the following code and I need to know why I am receiving the .pdf
I have the following code and I need to know why I am receiving the .pdfI have the following code and I need to know why I am receiving the .pdf
I have the following code and I need to know why I am receiving the .pdf
ezzi552
 

Similar to BasicPizza.javapublic class BasicPizza { String type; String c.pdf (20)

はじめてのGroovy
はじめてのGroovyはじめてのGroovy
はじめてのGroovy
 
Solid
SolidSolid
Solid
 
Better Software: introduction to good code
Better Software: introduction to good codeBetter Software: introduction to good code
Better Software: introduction to good code
 
Getting the following errorsError 1 error C2436 {ctor} mem.pdf
Getting the following errorsError 1 error C2436 {ctor}  mem.pdfGetting the following errorsError 1 error C2436 {ctor}  mem.pdf
Getting the following errorsError 1 error C2436 {ctor} mem.pdf
 
Oop php 5
Oop php 5Oop php 5
Oop php 5
 
PHPUnit でよりよくテストを書くために
PHPUnit でよりよくテストを書くためにPHPUnit でよりよくテストを書くために
PHPUnit でよりよくテストを書くために
 
Production.javapublic class Production {    Declaring instance.pdf
Production.javapublic class Production {    Declaring instance.pdfProduction.javapublic class Production {    Declaring instance.pdf
Production.javapublic class Production {    Declaring instance.pdf
 
Adding Dependency Injection to Legacy Applications
Adding Dependency Injection to Legacy ApplicationsAdding Dependency Injection to Legacy Applications
Adding Dependency Injection to Legacy Applications
 
Here is the codeimport java.util.; class GroceryItem { Stri.pdf
Here is the codeimport java.util.; class GroceryItem { Stri.pdfHere is the codeimport java.util.; class GroceryItem { Stri.pdf
Here is the codeimport java.util.; class GroceryItem { Stri.pdf
 
Scala in practice
Scala in practiceScala in practice
Scala in practice
 
Java: Nie popełniaj tych błędów!
Java: Nie popełniaj tych błędów!Java: Nie popełniaj tych błędów!
Java: Nie popełniaj tych błędów!
 
MenuItemvpublic class MenuItem .pdf
MenuItemvpublic class MenuItem .pdfMenuItemvpublic class MenuItem .pdf
MenuItemvpublic class MenuItem .pdf
 
多治見IT勉強会 Groovy Grails
多治見IT勉強会 Groovy Grails多治見IT勉強会 Groovy Grails
多治見IT勉強会 Groovy Grails
 
@author public class Person{   String sname, .pdf
  @author   public class Person{   String sname, .pdf  @author   public class Person{   String sname, .pdf
@author public class Person{   String sname, .pdf
 
PHP for Adults: Clean Code and Object Calisthenics
PHP for Adults: Clean Code and Object CalisthenicsPHP for Adults: Clean Code and Object Calisthenics
PHP for Adults: Clean Code and Object Calisthenics
 
29. Code an application program that keeps track of student informat.pdf
29. Code an application program that keeps track of student informat.pdf29. Code an application program that keeps track of student informat.pdf
29. Code an application program that keeps track of student informat.pdf
 
Modul Praktek Java OOP
Modul Praktek Java OOP Modul Praktek Java OOP
Modul Praktek Java OOP
 
Oops in php
Oops in phpOops in php
Oops in php
 
import java.util.Arrays;import java.util.List;public class Bursa.pdf
import java.util.Arrays;import java.util.List;public class Bursa.pdfimport java.util.Arrays;import java.util.List;public class Bursa.pdf
import java.util.Arrays;import java.util.List;public class Bursa.pdf
 
I have the following code and I need to know why I am receiving the .pdf
I have the following code and I need to know why I am receiving the .pdfI have the following code and I need to know why I am receiving the .pdf
I have the following code and I need to know why I am receiving the .pdf
 

More from rdtraders2007

(7x14x)^12=(277x^2)^12=7x(2)^12Solution(7x14x)^12=(2.pdf
(7x14x)^12=(277x^2)^12=7x(2)^12Solution(7x14x)^12=(2.pdf(7x14x)^12=(277x^2)^12=7x(2)^12Solution(7x14x)^12=(2.pdf
(7x14x)^12=(277x^2)^12=7x(2)^12Solution(7x14x)^12=(2.pdf
rdtraders2007
 
You can think of H as being heat energy added ( + ), or heat removed.pdf
You can think of H as being heat energy added ( + ), or heat removed.pdfYou can think of H as being heat energy added ( + ), or heat removed.pdf
You can think of H as being heat energy added ( + ), or heat removed.pdf
rdtraders2007
 
wait, i am posting the solution.Solutionwait, i am posting the.pdf
wait, i am posting the solution.Solutionwait, i am posting the.pdfwait, i am posting the solution.Solutionwait, i am posting the.pdf
wait, i am posting the solution.Solutionwait, i am posting the.pdf
rdtraders2007
 
There are many other contributing factors to the norms of culture th.pdf
There are many other contributing factors to the norms of culture th.pdfThere are many other contributing factors to the norms of culture th.pdf
There are many other contributing factors to the norms of culture th.pdf
rdtraders2007
 
Thermal dimorphism is the capacity to form different structures at d.pdf
Thermal dimorphism is the capacity to form different structures at d.pdfThermal dimorphism is the capacity to form different structures at d.pdf
Thermal dimorphism is the capacity to form different structures at d.pdf
rdtraders2007
 
The prime factor of 210=2357 Anyways, numbers can only be divid.pdf
The prime factor of 210=2357 Anyways, numbers can only be divid.pdfThe prime factor of 210=2357 Anyways, numbers can only be divid.pdf
The prime factor of 210=2357 Anyways, numbers can only be divid.pdf
rdtraders2007
 
The OSI Reference Model layers, in order from top to bottomD. Appl.pdf
The OSI Reference Model layers, in order from top to bottomD. Appl.pdfThe OSI Reference Model layers, in order from top to bottomD. Appl.pdf
The OSI Reference Model layers, in order from top to bottomD. Appl.pdf
rdtraders2007
 
Synchronous IO CPU waits till the IO proceeds.Asynchronous IO.pdf
Synchronous IO  CPU waits till the IO proceeds.Asynchronous IO.pdfSynchronous IO  CPU waits till the IO proceeds.Asynchronous IO.pdf
Synchronous IO CPU waits till the IO proceeds.Asynchronous IO.pdf
rdtraders2007
 
SolutionSolutionSolution.pdf
SolutionSolutionSolution.pdfSolutionSolutionSolution.pdf
SolutionSolutionSolution.pdf
rdtraders2007
 
slope = f(x) x= 12012= 10Solutionslope = f(x) x= 120.pdf
slope = f(x) x= 12012= 10Solutionslope = f(x) x= 120.pdfslope = f(x) x= 12012= 10Solutionslope = f(x) x= 120.pdf
slope = f(x) x= 12012= 10Solutionslope = f(x) x= 120.pdf
rdtraders2007
 
s(s^2-b^2)Solutions(s^2-b^2).pdf
s(s^2-b^2)Solutions(s^2-b^2).pdfs(s^2-b^2)Solutions(s^2-b^2).pdf
s(s^2-b^2)Solutions(s^2-b^2).pdf
rdtraders2007
 
Question not visible. Please update the question and then i can answ.pdf
Question not visible. Please update the question and then i can answ.pdfQuestion not visible. Please update the question and then i can answ.pdf
Question not visible. Please update the question and then i can answ.pdf
rdtraders2007
 
Please find the required program along with the comments against eac.pdf
Please find the required program along with the comments against eac.pdfPlease find the required program along with the comments against eac.pdf
Please find the required program along with the comments against eac.pdf
rdtraders2007
 
Order the steps of the viral life cycle.1. viral entry into host.pdf
Order the steps of the viral life cycle.1. viral entry into host.pdfOrder the steps of the viral life cycle.1. viral entry into host.pdf
Order the steps of the viral life cycle.1. viral entry into host.pdf
rdtraders2007
 
Listing of the type of alleles present in an organisms cellGenotyp.pdf
Listing of the type of alleles present in an organisms cellGenotyp.pdfListing of the type of alleles present in an organisms cellGenotyp.pdf
Listing of the type of alleles present in an organisms cellGenotyp.pdf
rdtraders2007
 
An Operating System (OS) is an interface between a computer user and.pdf
An Operating System (OS) is an interface between a computer user and.pdfAn Operating System (OS) is an interface between a computer user and.pdf
An Operating System (OS) is an interface between a computer user and.pdf
rdtraders2007
 
Internal Evidence General.pdf
                    Internal Evidence                          General.pdf                    Internal Evidence                          General.pdf
Internal Evidence General.pdf
rdtraders2007
 
In reaction # 3 either the cis or trans diol may .pdf
                     In reaction # 3 either the cis or trans diol may .pdf                     In reaction # 3 either the cis or trans diol may .pdf
In reaction # 3 either the cis or trans diol may .pdf
rdtraders2007
 
Intermolecular forces exist between molecules and.pdf
                     Intermolecular forces exist between molecules and.pdf                     Intermolecular forces exist between molecules and.pdf
Intermolecular forces exist between molecules and.pdf
rdtraders2007
 
H2 concentration will decrease and H2O concentrat.pdf
                     H2 concentration will decrease and H2O concentrat.pdf                     H2 concentration will decrease and H2O concentrat.pdf
H2 concentration will decrease and H2O concentrat.pdf
rdtraders2007
 

More from rdtraders2007 (20)

(7x14x)^12=(277x^2)^12=7x(2)^12Solution(7x14x)^12=(2.pdf
(7x14x)^12=(277x^2)^12=7x(2)^12Solution(7x14x)^12=(2.pdf(7x14x)^12=(277x^2)^12=7x(2)^12Solution(7x14x)^12=(2.pdf
(7x14x)^12=(277x^2)^12=7x(2)^12Solution(7x14x)^12=(2.pdf
 
You can think of H as being heat energy added ( + ), or heat removed.pdf
You can think of H as being heat energy added ( + ), or heat removed.pdfYou can think of H as being heat energy added ( + ), or heat removed.pdf
You can think of H as being heat energy added ( + ), or heat removed.pdf
 
wait, i am posting the solution.Solutionwait, i am posting the.pdf
wait, i am posting the solution.Solutionwait, i am posting the.pdfwait, i am posting the solution.Solutionwait, i am posting the.pdf
wait, i am posting the solution.Solutionwait, i am posting the.pdf
 
There are many other contributing factors to the norms of culture th.pdf
There are many other contributing factors to the norms of culture th.pdfThere are many other contributing factors to the norms of culture th.pdf
There are many other contributing factors to the norms of culture th.pdf
 
Thermal dimorphism is the capacity to form different structures at d.pdf
Thermal dimorphism is the capacity to form different structures at d.pdfThermal dimorphism is the capacity to form different structures at d.pdf
Thermal dimorphism is the capacity to form different structures at d.pdf
 
The prime factor of 210=2357 Anyways, numbers can only be divid.pdf
The prime factor of 210=2357 Anyways, numbers can only be divid.pdfThe prime factor of 210=2357 Anyways, numbers can only be divid.pdf
The prime factor of 210=2357 Anyways, numbers can only be divid.pdf
 
The OSI Reference Model layers, in order from top to bottomD. Appl.pdf
The OSI Reference Model layers, in order from top to bottomD. Appl.pdfThe OSI Reference Model layers, in order from top to bottomD. Appl.pdf
The OSI Reference Model layers, in order from top to bottomD. Appl.pdf
 
Synchronous IO CPU waits till the IO proceeds.Asynchronous IO.pdf
Synchronous IO  CPU waits till the IO proceeds.Asynchronous IO.pdfSynchronous IO  CPU waits till the IO proceeds.Asynchronous IO.pdf
Synchronous IO CPU waits till the IO proceeds.Asynchronous IO.pdf
 
SolutionSolutionSolution.pdf
SolutionSolutionSolution.pdfSolutionSolutionSolution.pdf
SolutionSolutionSolution.pdf
 
slope = f(x) x= 12012= 10Solutionslope = f(x) x= 120.pdf
slope = f(x) x= 12012= 10Solutionslope = f(x) x= 120.pdfslope = f(x) x= 12012= 10Solutionslope = f(x) x= 120.pdf
slope = f(x) x= 12012= 10Solutionslope = f(x) x= 120.pdf
 
s(s^2-b^2)Solutions(s^2-b^2).pdf
s(s^2-b^2)Solutions(s^2-b^2).pdfs(s^2-b^2)Solutions(s^2-b^2).pdf
s(s^2-b^2)Solutions(s^2-b^2).pdf
 
Question not visible. Please update the question and then i can answ.pdf
Question not visible. Please update the question and then i can answ.pdfQuestion not visible. Please update the question and then i can answ.pdf
Question not visible. Please update the question and then i can answ.pdf
 
Please find the required program along with the comments against eac.pdf
Please find the required program along with the comments against eac.pdfPlease find the required program along with the comments against eac.pdf
Please find the required program along with the comments against eac.pdf
 
Order the steps of the viral life cycle.1. viral entry into host.pdf
Order the steps of the viral life cycle.1. viral entry into host.pdfOrder the steps of the viral life cycle.1. viral entry into host.pdf
Order the steps of the viral life cycle.1. viral entry into host.pdf
 
Listing of the type of alleles present in an organisms cellGenotyp.pdf
Listing of the type of alleles present in an organisms cellGenotyp.pdfListing of the type of alleles present in an organisms cellGenotyp.pdf
Listing of the type of alleles present in an organisms cellGenotyp.pdf
 
An Operating System (OS) is an interface between a computer user and.pdf
An Operating System (OS) is an interface between a computer user and.pdfAn Operating System (OS) is an interface between a computer user and.pdf
An Operating System (OS) is an interface between a computer user and.pdf
 
Internal Evidence General.pdf
                    Internal Evidence                          General.pdf                    Internal Evidence                          General.pdf
Internal Evidence General.pdf
 
In reaction # 3 either the cis or trans diol may .pdf
                     In reaction # 3 either the cis or trans diol may .pdf                     In reaction # 3 either the cis or trans diol may .pdf
In reaction # 3 either the cis or trans diol may .pdf
 
Intermolecular forces exist between molecules and.pdf
                     Intermolecular forces exist between molecules and.pdf                     Intermolecular forces exist between molecules and.pdf
Intermolecular forces exist between molecules and.pdf
 
H2 concentration will decrease and H2O concentrat.pdf
                     H2 concentration will decrease and H2O concentrat.pdf                     H2 concentration will decrease and H2O concentrat.pdf
H2 concentration will decrease and H2O concentrat.pdf
 

Recently uploaded

Smart-Money for SMC traders good time and ICT
Smart-Money for SMC traders good time and ICTSmart-Money for SMC traders good time and ICT
Smart-Money for SMC traders good time and ICT
simonomuemu
 
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
RitikBhardwaj56
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
camakaiclarkmusic
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
WaniBasim
 
World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024
ak6969907
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
Nicholas Montgomery
 
Assessment and Planning in Educational technology.pptx
Assessment and Planning in Educational technology.pptxAssessment and Planning in Educational technology.pptx
Assessment and Planning in Educational technology.pptx
Kavitha Krishnan
 
How to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRMHow to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRM
Celine George
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
Nguyen Thanh Tu Collection
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
Priyankaranawat4
 
Digital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental DesignDigital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental Design
amberjdewit93
 
The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
heathfieldcps1
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
thanhdowork
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
Academy of Science of South Africa
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
mulvey2
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
adhitya5119
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
History of Stoke Newington
 
PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
Dr. Shivangi Singh Parihar
 
Life upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for studentLife upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for student
NgcHiNguyn25
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Akanksha trivedi rama nursing college kanpur.
 

Recently uploaded (20)

Smart-Money for SMC traders good time and ICT
Smart-Money for SMC traders good time and ICTSmart-Money for SMC traders good time and ICT
Smart-Money for SMC traders good time and ICT
 
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
 
World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
 
Assessment and Planning in Educational technology.pptx
Assessment and Planning in Educational technology.pptxAssessment and Planning in Educational technology.pptx
Assessment and Planning in Educational technology.pptx
 
How to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRMHow to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRM
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
 
Digital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental DesignDigital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental Design
 
The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
 
PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
 
Life upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for studentLife upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for student
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
 

BasicPizza.javapublic class BasicPizza { String type; String c.pdf

  • 1. BasicPizza.java public class BasicPizza { String type; String crust; String ingredients; double cost; public BasicPizza(String type) { super(); this.type = type; } public String getType() { return type; } public void setType(String type) { this.type = type; } public String getCrust() { return crust; } public void setCrust(String crust) { this.crust = crust; } public BasicPizza() { super(); } public String getIngredients() { return ingredients; } public void setIngredients(String ingredients) { this.ingredients = ingredients; } public double getCost() { return cost; } public void setCost() {
  • 2. this.cost = 5; } @Override public String toString() { return "BasicPizza [type=" + type + ", crust=" + crust + ", ingredients=" + ingredients + ", cost=" + cost + "]"; } } ________________________________________________________________________ LiFiCheese.java public class LiFiCheese extends BasicPizza{ private String crust; private double cost; private String ingredients; public LiFiCheese() { super("Cheese"); this.cost=5; } public void setCrust() { this.crust="thin"; } public String getCrust() { return crust; } public double getCost() { return cost; } public void setCost(double cost) { }
  • 3. public String getIngredients() { return ingredients; } public void setIngredients(String ingredients) { this.ingredients = ingredients; } @Override public String toString() { System.out.println("You Ordered :"); System.out.println(getType()); setCrust(); System.out.println(getCrust()); System.out.println("Total Cost of :"+getCost()); return ""; } } _______________________________________________________________________ LiFiPizza.java import java.util.Scanner; public class LiFiPizza extends BasicPizza { private String type; private double cost; private String crust; private String ingredients; public LiFiPizza() { super(); this.type = "Meat"; this.cost=5; } public String getType() { return type;
  • 4. } public void setType(String type) { this.type = type; } public double getCost() { return cost; } public void setCost() { this.cost = this.cost+2; } public String getCrust() { return crust; } public void setCrust(String crust) { if(crust.equals("Thin")) { this.crust="Thin"; } else if(crust.equals("Thick")) { this.crust="Thick"; } } public String getIngredients() { return ingredients; } public void setIngredients(String ingredients) { this.ingredients = ingredients; } @Override public String toString() { System.out.println("You Ordered :"); System.out.println(getType()); System.out.println(getIngredients()+"<+$2.00>"); System.out.println(getCrust());
  • 5. System.out.println("Total Cost of :"+getCost()); return ""; } } _____________________________________________________________________ LiFiUnit5Ch14.java import java.util.Scanner; public class LiFiUnit5Ch14 { public static void main(String[] args) { BasicPizza bp=null; String typeOfPizza; Scanner sc=new Scanner(System.in); System.out.print("What type of pizza would you like :"); typeOfPizza=sc.next(); if(typeOfPizza.equalsIgnoreCase("Meat")) { bp=new LiFiPizza(); System.out.print("Thin or Thick Crust:"); String crust=sc.next(); bp.setCrust(crust); System.out.print("What ingredient, sorry, only 1 :"); String ingredient=sc.next(); bp.setIngredients(ingredient); bp.setCost(); bp.toString(); } else if(typeOfPizza.equalsIgnoreCase("Cheese")) { bp=new LiFiCheese(); bp.toString(); } }
  • 6. } _________________________________________________________________ Output: What type of pizza would you like :Meat Thin or Thick Crust:Thin What ingredient, sorry, only 1 :Sausage You Ordered : Meat Sausage<+$2.00> Thin Total Cost of :7.0 __________________________________________ Output: What type of pizza would you like :Cheese You Ordered : Cheese thin Total Cost of :5.0 _______________________________________________________ Solution BasicPizza.java public class BasicPizza { String type; String crust; String ingredients; double cost; public BasicPizza(String type) { super(); this.type = type; } public String getType() { return type; }
  • 7. public void setType(String type) { this.type = type; } public String getCrust() { return crust; } public void setCrust(String crust) { this.crust = crust; } public BasicPizza() { super(); } public String getIngredients() { return ingredients; } public void setIngredients(String ingredients) { this.ingredients = ingredients; } public double getCost() { return cost; } public void setCost() { this.cost = 5; } @Override public String toString() { return "BasicPizza [type=" + type + ", crust=" + crust + ", ingredients=" + ingredients + ", cost=" + cost + "]"; } } ________________________________________________________________________ LiFiCheese.java public class LiFiCheese extends BasicPizza{ private String crust;
  • 8. private double cost; private String ingredients; public LiFiCheese() { super("Cheese"); this.cost=5; } public void setCrust() { this.crust="thin"; } public String getCrust() { return crust; } public double getCost() { return cost; } public void setCost(double cost) { } public String getIngredients() { return ingredients; } public void setIngredients(String ingredients) { this.ingredients = ingredients; } @Override public String toString() { System.out.println("You Ordered :"); System.out.println(getType()); setCrust(); System.out.println(getCrust());
  • 9. System.out.println("Total Cost of :"+getCost()); return ""; } } _______________________________________________________________________ LiFiPizza.java import java.util.Scanner; public class LiFiPizza extends BasicPizza { private String type; private double cost; private String crust; private String ingredients; public LiFiPizza() { super(); this.type = "Meat"; this.cost=5; } public String getType() { return type; } public void setType(String type) { this.type = type; } public double getCost() { return cost; } public void setCost() { this.cost = this.cost+2; } public String getCrust() { return crust; } public void setCrust(String crust) {
  • 10. if(crust.equals("Thin")) { this.crust="Thin"; } else if(crust.equals("Thick")) { this.crust="Thick"; } } public String getIngredients() { return ingredients; } public void setIngredients(String ingredients) { this.ingredients = ingredients; } @Override public String toString() { System.out.println("You Ordered :"); System.out.println(getType()); System.out.println(getIngredients()+"<+$2.00>"); System.out.println(getCrust()); System.out.println("Total Cost of :"+getCost()); return ""; } } _____________________________________________________________________ LiFiUnit5Ch14.java import java.util.Scanner; public class LiFiUnit5Ch14 { public static void main(String[] args) { BasicPizza bp=null; String typeOfPizza; Scanner sc=new Scanner(System.in); System.out.print("What type of pizza would you like :");
  • 11. typeOfPizza=sc.next(); if(typeOfPizza.equalsIgnoreCase("Meat")) { bp=new LiFiPizza(); System.out.print("Thin or Thick Crust:"); String crust=sc.next(); bp.setCrust(crust); System.out.print("What ingredient, sorry, only 1 :"); String ingredient=sc.next(); bp.setIngredients(ingredient); bp.setCost(); bp.toString(); } else if(typeOfPizza.equalsIgnoreCase("Cheese")) { bp=new LiFiCheese(); bp.toString(); } } } _________________________________________________________________ Output: What type of pizza would you like :Meat Thin or Thick Crust:Thin What ingredient, sorry, only 1 :Sausage You Ordered : Meat Sausage<+$2.00> Thin Total Cost of :7.0 __________________________________________ Output:
  • 12. What type of pizza would you like :Cheese You Ordered : Cheese thin Total Cost of :5.0 _______________________________________________________