Hi DW

I'm creating an ATM program and now I want to call the Dispensor to dispense the selected amount from the options provided. The main problem here is importing this import atm.input.CashDispenser;
the rest of the code is fine. here is the full code:

import atm.input.CashDispenser;
import java.util.Scanner;
public class Main {
private double currentBal =1899562589;
Scanner input = new Scanner(System.in);
public void mainMenu(){
    int selection;
        System.out.print("Welcome to the Automated Teller Machine!\n");
        System.out.println("Select from the following menu options below:\n");
        System.out.println("========================");
        System.out.println("| [1]  Check Balance   |");
        System.out.println("| [2]  Withdrawal      |");
        System.out.println("| [3]  Deposit         |");
        System.out.println("| [4]  Exit            |");
        System.out.println("========================");
        System.out.print("Please select your option now: ");
        selection =input.nextInt();
switch (selection){
    case 1:
        viewBalance();
        break;
    case 2:
        withdrawFunds();
        break;
    case 3:
        depositFunds();
        break;
    case 4:
        System.out.println("  Goodbye! ");

}
}
public void viewBalance() {
    int selection1;
    System.out.println("You have selected Balance.\n");
    System.out.println("\t-- Your Current Balance is:R " + currentBal);
    System.out.println("Return to main menu? \n [1] for YES \n");
    selection1 =input.nextInt();
switch (selection1){
    case 1:
        mainMenu();
        break;
}
}
public void withdrawFunds() {
    int withdrawSelection;
    System.out.println("Amount to withdraw: ");
    System.out.println("[1] - R1500");
    System.out.println("[2] - R3500");
    System.out.println("[3] - R5000");
    System.out.println("[4] - R10000");
    System.out.println("[5] - R20000");
    System.out.println("[6] - MAIN MENU");
    System.out.print("Please select your option now: ");
    withdrawSelection =input.nextInt();
switch (withdrawSelection){
    case 1:
        accountWithdraw(1500);
        mainMenu();
        break;
    case 2:
        accountWithdraw(3500);
        mainMenu();
        break;
    case 3:
        accountWithdraw(5000);
        mainMenu();
        break;
    case 4:
        accountWithdraw(10000);
        mainMenu();
        break;
    case 5:
        accountWithdraw(20000);
        mainMenu();
        break;
    case 6:
        mainMenu();
        break;
}
}
public void accountWithdraw(int withdrawFunds){
    currentBal = currentBal -withdrawFunds;
    System.out.println("Please take your funds.");
}
public void depositFunds(){
    int addSelection;
    System.out.println("Amount to deposit: ");
    System.out.println("[1] - R1500");
    System.out.println("[2] - R3500");
    System.out.println("[3] - R5000");
    System.out.println("[4] - R20000");
    System.out.println("[5] - MAIN MENU");
    System.out.print("Please select your option now: ");
    addSelection =input.nextInt();
    switch (addSelection){
    case 1:
        accountAdd(1500);
        mainMenu();
        break;
    case 2:
        accountAdd(3500);
        mainMenu();
        break;
    case 3:
        accountAdd(5000);
        mainMenu();
        break;
    case 4:
        accountAdd(20000);
        mainMenu();
        break;
    case 5:
        mainMenu();
        break;
}
}
public void accountAdd (int depositFunds){
    currentBal = currentBal +depositFunds;
    System.out.println("Thank you.");
}
public static void main(String[] args) {
    new Main().mainMenu();  //creating the instance and calling the method
}
}

You shouild know by now that we are going to ask for the exact complete text of all your error messages. "My main problem is with blah" is not in any way helpful.

Comments
Yeppers

Could you please add the class file in the build path or add the jar file containing that class in the java build path

is your dispenser file is in atm and input folder.if create atm folder,inside it create input folder then put dispenser file in it.

it's likely that libary is not in your path.

can you instruct me from starting it because what I did is that I just called it without doing any other thing so that I can show you or give you an idea of what I want to do, infact I don't even know how I will declear or call this, is there a simple way to control the dispense device and also count the money to be sure that the machine withdrawals the exacly amount choosen not more than that. just a way in wich I can do this instruction or control on a device. Thank you.

Ok thanks I've managed to solve this problem now my problem occured when I debug this program at first I tried using the jpos and I called the BillDispenser but it gave me about 22 warnings that the com.sun is a sun properitery and it maybe removed in the future release so I decided to remove it and I added a Withdrawal file and I called the dispensing method like this cashDispenser.dispenseCash(amount);
cashDispensed = true;
Now the problem is this method which gives me the problem and also it I use the SSystem.out.Println("the message here") for more info please refer on my first post. The problem says something like the cashDispenser cannot be refered to a static something it just that I'm not near my computer but it something like that.

This question has already been answered. Start a new discussion instead.