wids101 0 Newbie Poster

I wanted to know how i can print the purhcase that the user got. Thank you.

import java.util.Scanner;

public class VendingMachine
{
    private double chips;
    private double cookies;
    private double soda;
    private double gum;
    private double candy;
    private double energyDrink;
    private Scanner kb;
    private int dollar;
    private int quarters;
    private int dimes;
    private int nickles;
    private int pennies;    
    private int change;
    private int choice;

    public VendingMachine()
    {
        kb = new Scanner(System.in);
    }

    public void menu()
    {       

        System.out.println("How much money do you have?");
        double money = kb.nextDouble();

        System.out.println("What would you like to purchase?");
        System.out.println("1- Chips");
        System.out.println("2- Cookies");
        System.out.println("3- Soda");
        System.out.println("4- Gum");
        System.out.println("5- Candy");
        System.out.println("6-Energy Drink");
        choice = kb.nextInt();       

    }

    public void changeDue()
    {

        dollar = pennies/100;
        pennies %=100;
        quarters = pennies/25;
        pennies %=25;
        dimes = pennies/10;
        pennies %=10;
        nickles = pennies%5;
        pennies %=5;
        pennies = pennies%1; 
        pennies %=1;

        System.out.println("How much money do you have?");
        change = kb.nextInt();
        System.out.println(quarters + "quarters" + dimes + "dimes" + "nickles" + nickles + "pennies" + pennies);
    }

    public void prices()
    {
       chips = .75;
       cookies = 1.00;
       soda = 1.50;
       gum = .5;
       candy = 1.00;
       energyDrink = 2.00;
    }

    public void purchase()
    {

        System.out.println("You have purchased a" + " " + choice);
        System.out.println("Thank you for purchase. Have a nice day");

    }
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.