Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Pizza Class

  1. #1
    Junior Member
    Join Date
    Mar 2019
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Pizza Class

    The program must include the following:

    Class named Pizza that will be used to create Pizza objects.
    The Pizza class will have the following instance variables: an int variable to store the diameter size of the pizza and three String variables to store the toppings of the pizza.
    Three Pizza() class constructors.
    Constructor #1 will be a no-argument constructor that initializes the instance variables to a default size and single topping. The Pizza object created for the Classic Cheese Pizza, in the example above, used the no-arugment constructor. Consider how the remaining two toppings should be initialized.
    Constructor #2 will accept three parameters; the diameter size, topping 1, and topping 2. The Pizza object created for the Classic Pepperoni Pizza, in the example above, used the three-parameter constructor. Consider how the remaining topping should be initialized.
    Constructor #3 will accept four parameters, the diameter size and all three toppings. The Pizza object created for the Classic Hawaiian Pizza, in the example above, used the four-parameter constructor.
    A class method (void type) that accepts a Pizza object as a parameter. The method prints the value of each object's instance variables along with clarifying information. The higlighted text in the image below is the output from a call to such a class method.
    In the main() method, declare three Pizza objects. One that invokes the no-object constructor; one that invokes the three-parameter constructorl and one that invokes the four-parameter constructor.
    Add an informational header to the top of the program. The program example below has an informational header that says "Vinny's Pizza Shop."
    Add clarifying text that provides a name for each pizza created by the Pizza object; "** The Classic Hawaiian Pizza **" is an example of this.
    Add calls to the class method created to print each Pizza object. You should have three calls to the class method - one for each Pizza object created.
    Add comments to explain the elements of your program..
    Compile your program and debug as necessary.
    Test your code to ensure your program works as expected.
    Copy and paste your program code.
    DO NOT submit a screenshot of your code as I will compile and execute your program to verify it works as expected.upload.jpg

  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    22,337
    Thanks
    53
    Thanked 2,394 Times in 2,348 Posts

    Default Re: Pizza Class

    Do you have any specific java programming questions about your assignment?
    What have you tried?

    Be sure to wrap all posted code in code tags.
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. Writing a pizza program
    By superlostdoe in forum What's Wrong With My Code?
    Replies: 1
    Last Post: October 9th, 2014, 07:59 AM
  2. Pizza Pickup and delivery ordering java program
    By pointblank12 in forum What's Wrong With My Code?
    Replies: 4
    Last Post: July 31st, 2014, 07:53 PM
  3. Single-thread Pizza Parlor Simulation
    By GregBrannon in forum Java Programming Tutorials
    Replies: 0
    Last Post: April 19th, 2014, 08:14 AM
  4. pizza parlor orde
    By Mark Paynaganan in forum What's Wrong With My Code?
    Replies: 1
    Last Post: October 20th, 2013, 04:44 AM
  5. java pizza program beginerr
    By nikki101 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: June 17th, 2013, 03:22 AM