0

I'm confused the instructions say create a class called pizza with two fields PizzaType and Pieces. The Pizza constructor should call two data-entry methods GetType() and GetPieces() Is this the proper code for the constructor:
public pizza (string Types, int Pieces)

3
Contributors
3
Replies
4
Views
11 Years
Discussion Span
Last Post by augie0216
0

yes and no. that is a valid constructor but what I think your instructions want is

public pizza(){
getType();
getPieces();
}

private void GetType(){
//code to prompt user for type goes here
}


private void GetPieces(){
//code to prompt user for number of pieces
}

0

Hi,

I agree w/ previous post and want to say that instructions of your question are lame. I can't see a real world case where you call a user interactive method on a constructor.

Lore Soth

0

I'm a newbie at this programming stuff so there is alot of concepts I can't grasp right away. The instructions I supplied were a part of a project which included creating a exception class, creating a class with two methods that throw exceptions, and a class that establishes several objects and handles any throws. I going to assume that the book has me doing it this way for a reason. Perhaps because I didn't spell out the whole project, the instructions appear lame or it doesn't seem to apply to a real word case. You have to learn somehow. Thanks for the code sample that was supplied.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.