Share on Google+Share on Google+

bob
pizza
1 Answer(s)      5 years and 7 months ago
Posted in : Java Beginners

create a class names pizza data fields include a String for toppings such as pepperoni and inteager for diameter in inches 12" abd a diuble ofor price such as 13.99 include methods to get and set values for each for these fields

Ads

View Answers

August 29, 2011 at 2:51 PM


public class Pizza{
   private int size;
   private String toppings;
   private  double price;

   public Pizza(){
       setSize(12);
       setToppings("pepperoni");
       setPrice(13.99);
       }

    public void setSize(int size)
    {
        this.size = size;
    }
    public void setToppings(String toppings)
    {
        this.toppings = toppings;
    }
     public void setPrice(double price)
    {
        this.price = price;
    }

    public int getSize()
    {
        return this.size;
    }

    public String getToppings()
    {
        return this.toppings;
    }

    public  double getPrice()
    {
        return price;
    }

   public static void main(String []args){ 
       Pizza p=new Pizza();

        System.out.println("Size: " + p.getSize()+" inches");
        System.out.println("Toppings: " + p.getToppings());
        System.out.println("Price: " + p.getPrice());
       }
    }









Related Tutorials/Questions & Answers:
pizza
pizza  create a class names pizza data fields include a String for toppings such as pepperoni and inteager for diameter in inches 12" abd a diuble ofor price such as 13.99 include methods to get and set values for each
Pizza
Pizza  How do I make an array that prompts a user for the size of a pizza they'd like to order (s, m, l, xl) and then displays the price in a System.out.print statement (6.99, 8.99, 12.50, or 15.00) that corresponds with the size
Advertisements
Pizza Order..?? - Java Beginners
Pizza Order..??  Define a class PizzaOrder class that contains a list of several types of pizza that ordered by the customer. This class also contains number of pizza been ordered. There is a method to add new pizza to the list
Pizza Order Application
Pizza Order Application Here we have created an application using graphical user interface that will allow the user to order the Pizza. For the pizza... If no size and no toppings were selected, a standard pizza would be ordered
Please help me to create this coding for pizza order application using a handheld computer.....
Please help me to create this coding for pizza order application using.... They have recently won a contract from restaurant chain ?PIZZA WORLD? to supply... ? Vegetarian RM5.20 ? Meat feast RM5.80 ? Seafood RM5.60 Each pizza can be ordered
JAVA
JAVA  i have to order a pizza online and once after submitting my order i have to get a order number. after i receive a order number, i should be able to track the same online
java exercise - Java Beginners
java exercise  Pizza ordering program on Java! #write a program... of Pizza Normal cost Super cost 1. Margaritha... and large size pizza. The current price policy of the pizzeria is that prices
Using netbeans 6.9.1 create a mobile app. J2ME.
Using netbeans 6.9.1 create a mobile app. J2ME.   Can anybody help me with my school's project? I need to create a mobile pizza ordering app. Using just checkboxes to select sizes, crusts, topping, shape
Builder Pattern
the classes for each of the item, as pizza, ice cream and cold drink. All these classes will implement the Item interface. Lets start with Pizza. Here we are making... the type of the pizza.  A pizza is wrapped in the paper and is served
cougaar - Framework
cougaar  can any oone help in couggar framework i having following problems 1.how to add a plugin to dynamic created agent if more of agents created with out xml. 2.as in pizza application all information is before
The implement keyword
implements Pizza { / write your code here } Note: Here are the some
Java Code - Java Beginners
) that will allow the user to order a Pizza. For the pizza, it could be selected... of the ordered pizza, with 7.75% tax added, and receive the change back... then be printed out later. If no size and no toppings were selected, a standard pizza
onClick not working - Java Beginners
onClick not working  The project is to create a pizza ordering form... pizza order button is clicked. I have it linked to a function... of the page for clarity //Function to have popup confirm pizza order function
Struts-jdbc
/Master.css" rel="stylesheet" type="text/css"> <TITLE>Pizza Order Page</TITLE> </HEAD> <BODY> Pizza Order Page
The Restaurants of Jaipur India
. The visitors can find here delicacies like Mughali Cusines, Dosa, Pizza to its very own
Cuisines of Delhi
, Nirulas Wimpys, Pizza Hut and others has branches in Delhi. So give  your taste
Greater Kailash M-Block Market Delhi
are also present in ample numbers. McDonalds, Pizza Hut, Dominos, KFC
Ansal Plaza Shopping Complex Delhi
, Pizza Express and Subway. The foods that are sold here are incredibly varied
About Metro Walk Rohini Delhi
include Punjabi By Nature, KFC, Pizza Hut, Costa Coffe, Flaming Wok, Gola Sizzler
6 SaaS Software Solutions Every Business Owner Should Consider
a pizza or purchasing a shirt with the push of a catch. AppNexus makes
Tourist Places in Delhi India
houses can also be find here like McDonalds, KFC, Pizza Hut, Barista Café, and Café
Struts Tutorials
site that takes pizza orders. If the customer has a good credit history
Tutorials   
Java Spring Hibernate Struts Training What does core Java include? java What are some way to learn Java quickly? Is it required to learn Java before learning Java Script? Is it necessary to learn java script before learning PHP? Are HTML5 and Java Script boosts Java career? Is Java object oriented? Fingerprint application with Java Uninstall Oracle Virtual Box JSON to HashMap Free Java online Training I want example of Control Statement in Java ANSI Color Codes with Python Create a Program that Calculates Input What is difference between JDK,JRE and JVM? How to see ubuntu version on server? How to get Page Source in Selenium (WebDriver) using Java? The path to the driver executable must be set by the webdriver.gecko.driver system property parse data from a link in java Java Program Qns using BlueJ How to fix HAX Kernel Module Is Not Installed error? Installing Audacity Looking for code Logic to check track changes & Coments in MSWord, MSWordx, MSExcel, MSExcelx is ON/OFF Installing JDK on Mac SAX Parser exception ERROR 601 (42P00): Syntax error. Encountered Thread java.lang.NoClassDefFoundError: org/apache/commons/fileupload/FileItemFactory How to install Ubuntu 16.04 LTS? HttpServletRequest cannot be resolved to a type in eclipse - Solved Unhandled event loop exception GC overhead limit exceeded Spring Data jpa with apache phoenix Caused by: java.lang.IllegalArgumentException: Not a host:port pair: PBUF o.a.h.h.z.RecoverableZooKeeper - Possibly transient ZooKeeper, quorum= com.thinkaurelius.titan.diskstorage.hbase.HBaseStoreManager class not found com.thinkaurelius.titan.diskstorage.hbase.HBaseStoreManager not found How to download and install Java 8 on Windows? How to uninstall JDK 7? How to install gtk-doc-tools package in Ubuntu? How to install Oracle JDK 8 on Ubuntu? ejabberd_ctl.beam not found - Solved How to convert date to UTC format in Java? How to install autoconf, automake and libtool in Ubuntu 15.10? How to convert current date to mm dd yyyy format in Java? How to convert current date to dd mm yyyy format in Java? How to stop window closing in "internalFrameClosing" event. How to find list of all index in Neo4j? neo4j-server.properties file location SASLError using PLAIN: not-authorized how to convert war file into .exe file using java code

Ads

 
Advertisement null

Ads