Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class LAB13 {
- /**
- * @param args the command line arguments
- */
- public static void main(String[] args) {
- Pizza p1 = new Pizza();
- p1.type = 'P';
- p1.size = 'L';
- p1.toppings = 5;
- p1.price=0;
- double price1 = p1.calculatePrice();
- System.out.println("the price of p1: "+price1+" kd ");
- Pizza p2 = new Pizza();
- p2.type = 'T';
- p2.size = 'M';
- p2.toppings = 7;
- p2.price=0;
- double price2 = p2.calculatePrice();
- System.out.println("the price of p2: "+price2+" kd");
- System.out.println(p1.toString());
- System.out.println(p2.toString());
- if(p1.hasResonablePrice()){
- System.out.println("price of p1 is reasonable");
- }
- else{
- System.out.println("price of p1 is not reasonable");
- }
- if(p2.isMoreExpensiveThan(3)){
- System.out.println("price of p2 is more than 3 kd");
- }
- else{
- System.out.println("the price of p2 is less than 3 kd");
- }
- if(p1.isMoreExpensiveThan(p2.price)){
- System.out.println("p1 pizza is more expensive than p2");
- }
- else{
- System.out.println("p2 pizza is more expensive than p1");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement