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 return; } }
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
return;
}
}
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images