Advertisement
Guest User

Untitled

a guest
Oct 15th, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 6.87 KB | None | 0 0
  1. public class PurchaseClass
  2. {
  3.     public static void main(String[] args)
  4.     {
  5.         Purchase oranges = new Purchase();
  6.         orange.setPrice(10, 2.99);
  7.         Purchase eggs = new Purchase();
  8.         eggs.setPrice(12, 2.69);
  9.         Purchase apples = new Purchase();
  10.         apples.setPrice(3, 1.00);
  11.         Purchase watermelons = new Purchase();
  12.         watermelons.setPrice(1, 4.39);
  13.         Purchase bagels = new Purchase();
  14.         ls.setPrice(6, 3.50);
  15.        
  16.         oranges.setNumberBought(24);
  17.         eggs.setNumberBought(36);
  18.         apples.setNumberBought(20);
  19.         watermelons.setNumberBought(2);
  20.         bagels.setNumberBought(12);
  21.        
  22.         double total = 0.0;
  23.         total += oranges.getTotalCost();
  24.         total += eggs.getTotalCost();
  25.         total += apples.getTotalCost();
  26.         total += watermelons.getTotalCost();
  27.         total += bagels.getTotalCost();
  28.        
  29.         System.out.println("Total price: $"+total);
  30.     }
  31. }
  32.  
  33. errors
  34. C:\COMP170\Java Programs>javac PurchaseClass.java
  35. PurchaseClass.java:6: error: cannot find symbol
  36.                 orange.setPrice(10, 2.99);
  37.                 ^
  38.   symbol:   variable orange
  39.   location: class PurchaseClass
  40. PurchaseClass.java:8: error: cannot find symbol
  41.                 eggs.setPrice(12, 2.69);
  42.                     ^
  43.   symbol:   method setPrice(int,double)
  44.   location: variable eggs of type Purchase
  45. PurchaseClass.java:10: error: cannot find symbol
  46.                 apples.setPrice(3, 1.00);
  47.                       ^
  48.   symbol:   method setPrice(int,double)
  49.   location: variable apples of type Purchase
  50. PurchaseClass.java:12: error: cannot find symbol
  51.                 watermelons.setPrice(1, 4.39);
  52.                            ^
  53.   symbol:   method setPrice(int,double)
  54.   location: variable watermelons of type Purchase
  55. PurchaseClass.java:14: error: cannot find symbol
  56.                 ls.setPrice(6, 3.50);
  57.                 ^
  58.   symbol:   variable ls
  59.   location: class PurchaseClass
  60. PurchaseClass.java:16: error: cannot find symbol
  61.                 oranges.setNumberBought(24);
  62.                        ^
  63.   symbol:   method setNumberBought(int)
  64.   location: variable oranges of type Purchase
  65. PurchaseClass.java:17: error: cannot find symbol
  66.                 eggs.setNumberBought(36);
  67.                     ^
  68.   symbol:   method setNumberBought(int)
  69.   location: variable eggs of type Purchase
  70. PurchaseClass.java:18: error: cannot find symbol
  71.                 apples.setNumberBought(20);
  72.                       ^
  73.   symbol:   method setNumberBought(int)
  74.   location: variable apples of type Purchase
  75. PurchaseClass.java:19: error: cannot find symbol
  76.                 watermelons.setNumberBought(2);
  77.                            ^
  78.   symbol:   method setNumberBought(int)
  79.   location: variable watermelons of type Purchase
  80. PurchaseClass.java:20: error: cannot find symbol
  81.                 bagels.setNumberBought(12);
  82.                       ^
  83.   symbol:   method setNumberBought(int)
  84.   location: variable bagels of type Purchase
  85. PurchaseClass.java:23: error: cannot find symbol
  86.                 total += oranges.getTotalCost();
  87.                                 ^
  88.   symbol:   method getTotalCost()
  89.   location: variable oranges of type Purchase
  90. PurchaseClass.java:24: error: cannot find symbol
  91.                 total += eggs.getTotalCost();
  92.                              ^
  93.   symbol:   method getTotalCost()
  94.   location: variable eggs of type Purchase
  95. PurchaseClass.java:25: error: cannot find symbol
  96.                 total += apples.getTotalCost();
  97.                                ^
  98.   symbol:   method getTotalCost()
  99.   location: variable apples of type Purchase
  100. PurchaseClass.java:26: error: cannot find symbol
  101.                 total += watermelons.getTotalCost();
  102.                                     ^
  103.   symbol:   method getTotalCost()
  104.   location: variable watermelons of type Purchase
  105. PurchaseClass.java:27: error: cannot find symbol
  106.                 total += bagels.getTotalCost();
  107.                                ^
  108.   symbol:   method getTotalCost()
  109.   location: variable bagels of type Purchase
  110. .\Purchase.java:6: error: cannot find symbol
  111.                 orange.setPrice(10, 2.99);
  112.                 ^
  113.   symbol:   variable orange
  114.   location: class Purchase
  115. .\Purchase.java:8: error: cannot find symbol
  116.                 eggs.setPrice(12, 2.69);
  117.                     ^
  118.   symbol:   method setPrice(int,double)
  119.   location: variable eggs of type Purchase
  120. .\Purchase.java:10: error: cannot find symbol
  121.                 apples.setPrice(3, 1.00);
  122.                       ^
  123.   symbol:   method setPrice(int,double)
  124.   location: variable apples of type Purchase
  125. .\Purchase.java:12: error: cannot find symbol
  126.                 watermelons.setPrice(1, 4.39);
  127.                            ^
  128.   symbol:   method setPrice(int,double)
  129.   location: variable watermelons of type Purchase
  130. .\Purchase.java:14: error: cannot find symbol
  131.                 ls.setPrice(6, 3.50);
  132.                 ^
  133.   symbol:   variable ls
  134.   location: class Purchase
  135. .\Purchase.java:16: error: cannot find symbol
  136.                 oranges.setNumberBought(24);
  137.                        ^
  138.   symbol:   method setNumberBought(int)
  139.   location: variable oranges of type Purchase
  140. .\Purchase.java:17: error: cannot find symbol
  141.                 eggs.setNumberBought(36);
  142.                     ^
  143.   symbol:   method setNumberBought(int)
  144.   location: variable eggs of type Purchase
  145. .\Purchase.java:18: error: cannot find symbol
  146.                 apples.setNumberBought(20);
  147.                       ^
  148.   symbol:   method setNumberBought(int)
  149.   location: variable apples of type Purchase
  150. .\Purchase.java:19: error: cannot find symbol
  151.                 watermelons.setNumberBought(2);
  152.                            ^
  153.   symbol:   method setNumberBought(int)
  154.   location: variable watermelons of type Purchase
  155. .\Purchase.java:20: error: cannot find symbol
  156.                 bagels.setNumberBought(12);
  157.                       ^
  158.   symbol:   method setNumberBought(int)
  159.   location: variable bagels of type Purchase
  160. .\Purchase.java:23: error: cannot find symbol
  161.                 total += oranges.getTotalCost();
  162.                                 ^
  163.   symbol:   method getTotalCost()
  164.   location: variable oranges of type Purchase
  165. .\Purchase.java:24: error: cannot find symbol
  166.                 total += eggs.getTotalCost();
  167.                              ^
  168.   symbol:   method getTotalCost()
  169.   location: variable eggs of type Purchase
  170. .\Purchase.java:25: error: cannot find symbol
  171.                 total += apples.getTotalCost();
  172.                                ^
  173.   symbol:   method getTotalCost()
  174.   location: variable apples of type Purchase
  175. .\Purchase.java:26: error: cannot find symbol
  176.                 total += watermelons.getTotalCost();
  177.                                     ^
  178.   symbol:   method getTotalCost()
  179.   location: variable watermelons of type Purchase
  180. .\Purchase.java:27: error: cannot find symbol
  181.                 total += bagels.getTotalCost();
  182.                                ^
  183.   symbol:   method getTotalCost()
  184.   location: variable bagels of type Purchase
  185. 30 errors
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement