Create a class called Pizza (Pizza.java). It should have the following private data members: String size: size of the pizza could be small, medium, or large int numofToppings: number of toppings could...


Create a class called Pizza (Pizza.java). It should have the<br>following private data members: String size: size of the pizza<br>could be small, medium, or large int numofToppings: number<br>of toppings could be 1, 2 or 3. double price and should provide<br>the following methods: default constructor (set size to an empty<br>string, numOfTopping and price to 0) non-default constructor<br>Pizza(String s, int n, double p) getters and setters for the three<br>data members method toString() returns a string representing<br>the Pizza object, formatted as: Size: large Toppings: 2 Price:<br>9.95 method equals(Object obj) to indicate some other object is<br>

Extracted text: Create a class called Pizza (Pizza.java). It should have the following private data members: String size: size of the pizza could be small, medium, or large int numofToppings: number of toppings could be 1, 2 or 3. double price and should provide the following methods: default constructor (set size to an empty string, numOfTopping and price to 0) non-default constructor Pizza(String s, int n, double p) getters and setters for the three data members method toString() returns a string representing the Pizza object, formatted as: Size: large Toppings: 2 Price: 9.95 method equals(Object obj) to indicate some other object is "equal to" this one public class Pizza { Complete the following unit test for the class Pizza described above. Make sure to test each public constructor and each public method, print the expected and actual results. // Start of the unit test of class Pizza public class PizzaTester { public static void main() { // Your source codes are placed here

Jun 08, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here