a. Create a class named Pizza. Data fields include a String for toppings (such as “pepperoni”), an integer for diameter in inches (such as 18), and a double for the price (such as P699.00). Include methods to get and set values for each of these fields. Save the class as Pizza.java. b. Create an application named TestPizza that instantiates one Pizza object and demonstrates the use of the Pizza set and get methods. Save this application as TestPizza.java.
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:
a. Create a class named Pizza. Data fields include a String for toppings (such as “pepperoni”), an integer for diameter in inches (such as 18), and a double for the price (such as P699.00). Include methods to get and set values for each of these fields. Save the class as Pizza.java.
b. Create an application named TestPizza that instantiates one Pizza object and demonstrates the use of the Pizza set and get methods. Save this application as TestPizza.java.
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 3 images