Pizza.java - Pizza.java Here is my Pizza class with instance variables and [email protected] Vivian [email protected]_modified November 29 class Pizza cfw\/first

Pizza.java - Pizza.java Here is my Pizza class with...

This preview shows page 1 - 2 out of 2 pages.

/****************** * Pizza.java * * Here is my Pizza class with instance * variables and methods. * * @author Vivian Cheng * @last_modified November 29 ******************/ class Pizza { //first define instance variables (STATE) private String topping; private double diameter; private double cost; private int slices; //second define instance methods (BEHAVIOR) public double radius() { return diameter/2.0; } public double area() { return Math.PI * (radius() * radius()); } public double areaPerSlice() { return (area()/slices); } public double costPerSlice() { return (cost/slices);
Image of page 1
Image of page 2

You've reached the end of your free preview.

Want to read both pages?

  • Fall '17
  • HenryH.Leitner

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes