/*
   Author:
   Description:  Homework Assignment 3

   Design an online store myTablets.com that allows users to order products.
*/


import java.io.*;
import java.util.*;
import java.math.*;


public class HW3
{
    static Scanner keyboard = new Scanner(System.in);  // keyboard object for input

    // price of the different tablets
    static final double firePrice=159, 
	                ipadPrice=329, 
                        nexusPrice=199, 
                        galaxyPrice=199;

    // Shopping Cart: keep track of the quantity of different tablets in the cart
    static int fireQuantity=0, ipadQuantity=0, nexusQuantity=0, galaxyQuantity=0;


    
    // repeatedly display the menu, ask for product, 
    //    and display the shopping cart
    //    until the customer wants to exit
    // Before exiting, display the invoice if the customer has bought something
    // assume user input is valid

    public static void main(String[] argv)
    {
        int product=0, quantity=0;
        // modify instructions below

        displayMenu();
        product = getProduct();
        quantity = getQuantity();
        displayShoppingCart();
        displayInvoice();

    }


    // display product name and quantity if shopping cart is not empty
    // display empty if shopping cart is empty
    public static void displayShoppingCart()
    {
        System.out.println("\nShopping cart:");
        // start instructions here
         


    }



    // calculate subtotal, tax, shipping, and total
    // tax is 6% on subtotal
    // shipping is free if subtotal is at least $300
    // otherwise shipping is $10 per tablet

    public static void displayInvoice()
    {
        double subtotal=0, tax=0, shipping=0, total=0;
        // start instructions here









        System.out.println("\n=====Invoice======");
        System.out.printf("Subtotal: %8.2f\n", subtotal);
        System.out.printf("     Tax: %8.2f\n", tax);
        System.out.printf("Shipping: %8.2f\n", shipping);
        System.out.println("------------------");
        System.out.printf("   Total: %8.2f\n\n", total);
        System.out.println("Thank you for shopping at myTablets.com!");
    }

    // display the product menu
    public static void displayMenu()
    {
	System.out.println("------------------------\n");
	System.out.println("Welcome to myTablets.com\n");
	System.out.printf("1. Amazon Kindle Fire 8GB ($%6.2f)\n", firePrice);
	System.out.printf("2. Apple iPad mini 16GB ($%6.2f)\n", ipadPrice);
	System.out.printf("3. Google Nexus 7 16GB ($%6.2f)\n", nexusPrice);
	System.out.printf("4. Samsung Galaxy 7-inch 8GB ($%6.2f)\n", galaxyPrice);
    }

    // ask the customer to enter a product
    public static int getProduct()
    {
	System.out.print("\nPlease add a product (1-4, 0 to exit): ");
	return keyboard.nextInt();
    }

    // ask the customer to enter a quantity
    public static int getQuantity()
    {
	System.out.print("Please add quantity (0 to cancel): ");
	return keyboard.nextInt();
    }
}
