Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class PurchaseClass
- {
- public static void main(String[] args)
- {
- Purchase oranges = new Purchase();
- orange.setPrice(10, 2.99);
- Purchase eggs = new Purchase();
- eggs.setPrice(12, 2.69);
- Purchase apples = new Purchase();
- apples.setPrice(3, 1.00);
- Purchase watermelons = new Purchase();
- watermelons.setPrice(1, 4.39);
- Purchase bagels = new Purchase();
- ls.setPrice(6, 3.50);
- oranges.setNumberBought(24);
- eggs.setNumberBought(36);
- apples.setNumberBought(20);
- watermelons.setNumberBought(2);
- bagels.setNumberBought(12);
- double total = 0.0;
- total += oranges.getTotalCost();
- total += eggs.getTotalCost();
- total += apples.getTotalCost();
- total += watermelons.getTotalCost();
- total += bagels.getTotalCost();
- System.out.println("Total price: $"+total);
- }
- }
- errors
- C:\COMP170\Java Programs>javac PurchaseClass.java
- PurchaseClass.java:6: error: cannot find symbol
- orange.setPrice(10, 2.99);
- ^
- symbol: variable orange
- location: class PurchaseClass
- PurchaseClass.java:8: error: cannot find symbol
- eggs.setPrice(12, 2.69);
- ^
- symbol: method setPrice(int,double)
- location: variable eggs of type Purchase
- PurchaseClass.java:10: error: cannot find symbol
- apples.setPrice(3, 1.00);
- ^
- symbol: method setPrice(int,double)
- location: variable apples of type Purchase
- PurchaseClass.java:12: error: cannot find symbol
- watermelons.setPrice(1, 4.39);
- ^
- symbol: method setPrice(int,double)
- location: variable watermelons of type Purchase
- PurchaseClass.java:14: error: cannot find symbol
- ls.setPrice(6, 3.50);
- ^
- symbol: variable ls
- location: class PurchaseClass
- PurchaseClass.java:16: error: cannot find symbol
- oranges.setNumberBought(24);
- ^
- symbol: method setNumberBought(int)
- location: variable oranges of type Purchase
- PurchaseClass.java:17: error: cannot find symbol
- eggs.setNumberBought(36);
- ^
- symbol: method setNumberBought(int)
- location: variable eggs of type Purchase
- PurchaseClass.java:18: error: cannot find symbol
- apples.setNumberBought(20);
- ^
- symbol: method setNumberBought(int)
- location: variable apples of type Purchase
- PurchaseClass.java:19: error: cannot find symbol
- watermelons.setNumberBought(2);
- ^
- symbol: method setNumberBought(int)
- location: variable watermelons of type Purchase
- PurchaseClass.java:20: error: cannot find symbol
- bagels.setNumberBought(12);
- ^
- symbol: method setNumberBought(int)
- location: variable bagels of type Purchase
- PurchaseClass.java:23: error: cannot find symbol
- total += oranges.getTotalCost();
- ^
- symbol: method getTotalCost()
- location: variable oranges of type Purchase
- PurchaseClass.java:24: error: cannot find symbol
- total += eggs.getTotalCost();
- ^
- symbol: method getTotalCost()
- location: variable eggs of type Purchase
- PurchaseClass.java:25: error: cannot find symbol
- total += apples.getTotalCost();
- ^
- symbol: method getTotalCost()
- location: variable apples of type Purchase
- PurchaseClass.java:26: error: cannot find symbol
- total += watermelons.getTotalCost();
- ^
- symbol: method getTotalCost()
- location: variable watermelons of type Purchase
- PurchaseClass.java:27: error: cannot find symbol
- total += bagels.getTotalCost();
- ^
- symbol: method getTotalCost()
- location: variable bagels of type Purchase
- .\Purchase.java:6: error: cannot find symbol
- orange.setPrice(10, 2.99);
- ^
- symbol: variable orange
- location: class Purchase
- .\Purchase.java:8: error: cannot find symbol
- eggs.setPrice(12, 2.69);
- ^
- symbol: method setPrice(int,double)
- location: variable eggs of type Purchase
- .\Purchase.java:10: error: cannot find symbol
- apples.setPrice(3, 1.00);
- ^
- symbol: method setPrice(int,double)
- location: variable apples of type Purchase
- .\Purchase.java:12: error: cannot find symbol
- watermelons.setPrice(1, 4.39);
- ^
- symbol: method setPrice(int,double)
- location: variable watermelons of type Purchase
- .\Purchase.java:14: error: cannot find symbol
- ls.setPrice(6, 3.50);
- ^
- symbol: variable ls
- location: class Purchase
- .\Purchase.java:16: error: cannot find symbol
- oranges.setNumberBought(24);
- ^
- symbol: method setNumberBought(int)
- location: variable oranges of type Purchase
- .\Purchase.java:17: error: cannot find symbol
- eggs.setNumberBought(36);
- ^
- symbol: method setNumberBought(int)
- location: variable eggs of type Purchase
- .\Purchase.java:18: error: cannot find symbol
- apples.setNumberBought(20);
- ^
- symbol: method setNumberBought(int)
- location: variable apples of type Purchase
- .\Purchase.java:19: error: cannot find symbol
- watermelons.setNumberBought(2);
- ^
- symbol: method setNumberBought(int)
- location: variable watermelons of type Purchase
- .\Purchase.java:20: error: cannot find symbol
- bagels.setNumberBought(12);
- ^
- symbol: method setNumberBought(int)
- location: variable bagels of type Purchase
- .\Purchase.java:23: error: cannot find symbol
- total += oranges.getTotalCost();
- ^
- symbol: method getTotalCost()
- location: variable oranges of type Purchase
- .\Purchase.java:24: error: cannot find symbol
- total += eggs.getTotalCost();
- ^
- symbol: method getTotalCost()
- location: variable eggs of type Purchase
- .\Purchase.java:25: error: cannot find symbol
- total += apples.getTotalCost();
- ^
- symbol: method getTotalCost()
- location: variable apples of type Purchase
- .\Purchase.java:26: error: cannot find symbol
- total += watermelons.getTotalCost();
- ^
- symbol: method getTotalCost()
- location: variable watermelons of type Purchase
- .\Purchase.java:27: error: cannot find symbol
- total += bagels.getTotalCost();
- ^
- symbol: method getTotalCost()
- location: variable bagels of type Purchase
- 30 errors
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement