1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
PIT_PIT [208]
4 years ago
4

Create a class named Pizza with data fields for description (such as sausage and onion) and price. Include a constructor that re

quires arguments for both fields and a method to display the data. Create a subclass named DeliveryPizzathat inherits from Pizza but adds a delivery fee and a delivery address. The description, price, and delivery address are required as arguments to the constructor. The delivery fee is $3 if the pizza ordered costs more than $15; otherwise it is $5. Write an application that instantiates at least two objects of each type, and display the values. Save the files as Pizza.java, DeliveryPizza.java, and DemoPizzas.java.
Engineering
1 answer:
Anestetic [448]4 years ago
8 0

Answer:

The three parts are as follows

Pizza.java

public class Pizza {

  public String description;

  public int price;

  public Pizza() {}

  public Pizza(String desc,int pri)

  {

      this. description=desc;

      this.price=pri;

  }

  //Output

  public String toString()

  {

      return this. description+" , "+this.price;

  }

}

DeliveryPizza.java

public class DeliveryPizza extends Pizza{

  public int fee;

  public String address;

  public DeliveryPizza(String desc,int pri,String add)

  {

      super(desc, pri);//invoke base class constructor

      this.address=add;

      if(super.price>15)

      {

          this.fee=3;//set delivery fee

      }

      else

      {

          this.fee=5;//set delivery fee

      }

  }

  public String printDetails()

  {

      return super.toString()+", Fee : "+this.fee+" , "+"Address : "+this.address;

  }

}

DemoPizzas.java

public class DemoPizzas {

      public static void main(String[] args) {

          Pizza pizza=new Pizza("Crudo",200);

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

          Pizza pizza1=new Pizza("Marinara sauce",430);

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

          DeliveryPizza deliveryPizza=new DeliveryPizza("Pizza Margherita",15,"New Jercy");

          System.out.println(deliveryPizza.printDetails());

          DeliveryPizza deliveryPizza1=new DeliveryPizza("onion Pizza",20,"Maxico");

          System.out.println(deliveryPizza1.printDetails());

      }

}

You might be interested in
Why some types of aggregate are susceptible to damage from repeated freezing and thawing? Explain.
koban [17]

Answer:

Some types of aggregate are susceptible to damage from repeated freezing and thawing due to their porosity. An aggregate being porous allows water molecules to enter in between the rocks.

When freezing occurs, water is known to expand. The expansion of this in the rocks creates a type of pressure which results in the fracture of the rocks. Subsequent freezing and thawing will allow for more fracture between the rock particles which will lead to its disintegration.

8 0
4 years ago
Can someone make me a chair on onshape DONT be rude I’m sick of wasting my points and getting them back now the points are going
Marizza181 [45]

Answer:

Honestly if you mostly need help are you allowed to ask your peers??? if I struggle there were plenty of kids I would ask and they would help

7 0
3 years ago
What do you think about changing the formula for happiness and success?
Mnenie [13.5K]

Answer:

Each one should decide we is its formula is. Depending on what options one has in live. There is not a general formula for happiness and success.  So there is not a general formula to change. Everyone must find its rigth formula.  

6 0
4 years ago
5 Systems Modeling
Nesterboy [21]

Answer: None of the above

Explanation:

Business process modeling refers to the graphical representation of the business processes of a company, which is vital in the identification of potential improvements.

Business pticess modelling can be done through graphing methods, like data-flow diagram, flowchart etc. It is vital as business managers can effectively and quickly communicate their ideas.

It also enhances the customization of business processes, enhances the competitive advantage and enhances the process communication as well.

Therefore, the answer to the question will be "None of the above".

5 0
3 years ago
An alloy fin with a thermal conductivity of 200 W/ሺm ∙ Kሻ has a length of 2.5 cm and a thickness of 3.5 mm. The base of the fin
Svetllana [295]

Answer: heat flux into the fun is 21.714 mW/m^2

Explanation:

Heat flux Q = q/A

q = heat transfer rate W

A = area m^2

q = area * conductivity * temperature gradient

Temperature gradient = difference in temperature of the metal faces divided by the thickness.

Therefore Q = k * ( temp. gradient)

Q = 200 * ((400-20)/3.5*10^-2)

Q = 21714285.71 = 21.714 mW/m^2

Answer 2: convective heat transfer flux between fin and air

is 3800W/m^2

Explanation :

q = hA*(Ts-Ta)

h = convective heat transfer coefficient

Ts = temperature of fin

Ta = temperature of air

Q = q/A

Q = h(Ts-Ta)

Q = 10(400 - 20)

Q = 3800 W/m^2

5 0
4 years ago
Other questions:
  • A stream of vinyl chloride monomer (VCM, H2C=CHCl, molecular weight = 62.5lb/lb-mol) in air is being produced from a process to
    7·1 answer
  • Consider incompressible flow in a circular channel. Derive general expressions for Reynolds number in terms of (a) volume flow r
    5·1 answer
  • What is specific gravity? How is it related to density?
    5·1 answer
  • I'm really bad at measurements so I don't understand this.
    12·1 answer
  • How is the caliber of a rifle or handgun determined
    9·1 answer
  • A standard 20° pressure angle, 20 tooth pinion with a diametral pitch of 12 rotates at 1776 rpm driving a mating gear at 740 rpm
    14·1 answer
  • A saturated 1.5 ft3 clay sample has a natural water content of 25%, shrinkage limit (SL) of 12% and a specific gravity (GS) of 2
    11·1 answer
  • Stack memory is implemented as a stack data structure. Provide the sequence of push and pop operations on stack memory when the
    6·1 answer
  • Resistance to impact is an example of a(n)
    12·1 answer
  • What function or functions in the body might be affected if a person fell and injured the back of their head?
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!