The following class Pizza has incomplete codes. Write setter and getter methods for all instance variables of this class. In addition, complete the missing lines of codes for the given default constructor method and isLargePizza () method. [21:47, 2020年12月8日] Antoni: class Pizza { private string name; private double diameter; public Pizza () { //Missing lines of codes to be completed by the student } public boolean isLargePizza() { //Missing lines of codes to be completed by the student } //Missing lines of codes to be completed by the student }//end class definition Hint: When the diameter of a pizza is more than 20cm, then it is considered to be a Large Pizza. The method isLargePizza () has to return a boolean value indicating whether the Pizza object is a large pizza or not. Note: You must add required member functions or data members/variables in your program to complete its execution.
OOPs
In today's technology-driven world, computer programming skills are in high demand. The object-oriented programming (OOP) approach is very much useful while designing and maintaining software programs. Object-oriented programming (OOP) is a basic programming paradigm that almost every developer has used at some stage in their career.
Constructor
The easiest way to think of a constructor in object-oriented programming (OOP) languages is:
[21:46, 2020年12月8日] Antoni: The following class Pizza has incomplete codes. Write setter and getter methods for all instance variables of this class. In addition, complete the missing lines of codes for the given default constructor method and isLargePizza () method.
[21:47, 2020年12月8日] Antoni: class Pizza
{
private string name;
private double diameter;
public Pizza ()
{
//Missing lines of codes to be completed by the student
}
public boolean isLargePizza()
{
//Missing lines of codes to be completed by the student
}
//Missing lines of codes to be completed by the student
}//end class definition
Hint: When the diameter of a pizza is more than 20cm, then it is considered to be a Large Pizza. The method isLargePizza () has to return a boolean value indicating whether the Pizza object is a large pizza or not.
Note: You must add required member functions or data members/variables in your program to complete its execution.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps