Advertisement
Guest User

Main (testing) Class

a guest
Oct 4th, 2013
14
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4.  
  5. public static void main(String[] args) {
  6.  
  7. ShoppingCart sc = new ShoppingCart(); // Create the shopping cart
  8. Scanner scanner = new Scanner(System.in); // Create the scanner
  9. sc.setTaxRate(0.08); // Set the TaxRate
  10. for (int i = 0; i < 3; i++) { // Ask the user for input 3 times
  11. sc.getInput(scanner); // Actually asking for input using the getInput method
  12. }
  13. System.out.print("Pre-tax total price: "); // Printing:
  14. System.out.print(sc.getPreTaxTotalPrice()); // Using getters to to get the variables we want
  15. System.out.print("\nTax Rate: ");
  16. System.out.print(sc.getTaxRate());
  17. System.out.print("\nTotal Price: ");
  18. System.out.print(sc.getTotalPrice());
  19. }
  20.  
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement