karolek0901's Profile User Rating: -----

Reputation: 0 Apprentice
Group:
New Members
Active Posts:
12 (0.02 per day)
Joined:
26-November 12
Profile Views:
134
Last Active:
User is offline Dec 06 2012 10:31 AM
Currently:
Offline

Previous Fields

Dream Kudos:
0
Icon   karolek0901 has not set their status

Posts I've Made

  1. In Topic: ATM Machine program

    Posted 5 Dec 2012

    ok is reading the line but not is not displaying the menu

    Posted Image
  2. In Topic: ATM Machine program

    Posted 5 Dec 2012

    okay i dont have any idea how to read user data so how it will looks like base on my code above. I dont now how to fix this problem because is not reading my txt file and i dont have any ide cand someone explain me or show me what i should do
  3. In Topic: ATM Machine program

    Posted 5 Dec 2012

    ok when i delete this line

    Scanner line = new Scanner("P4ATMdata.txt");

    it giving me errors cannot find symbol line.nextLine();
  4. In Topic: ATM Machine program

    Posted 5 Dec 2012

    ok i fix errors and now im getting errors like this:
     Excettion in thrread "main" java.util.No SuchElementException: No line found at java.util.Scanner.nextLine(Scanner.java:1585)
    at Program4.main(Program4.java:39)
    


    /*ATM machine #3
     *
     *@author Karol Regulski
     *@version 1.0
     */ 
    
    import java.util.Scanner;
    import java.text.DecimalFormat;
    import java.io.*;
    import java.util.*;
    import javax.swing.JFileChooser;
    import java.io.IOException;
    
    public class Program4
    {
    	private static Scanner input = new Scanner(System.in);
    	private static String [] name = new String [20];
    	private static int [] account = new int[20];
    	private static double [] currentBal = new double[20];
    	
    	private static DecimalFormat money = new DecimalFormat ("$#,##0.00");
    	
    	public static void main(String args[]) throws IOException
    	{
    		
    		int lines = 0;
    		
    	
    		//creating a new file
    		File inputFile = new File ("P4ATMdata.txt");
    		Scanner fileInput = new Scanner(inputFile);
    		Scanner line = new Scanner("P4ATMdata.txt");
    		
    		DecimalFormat money = new DecimalFormat ("$#,##0.00");
    		
    		while(fileInput.hasNextLine()) 
            {
                lines++;
                line.nextLine();
    			System.out.println(lines);
            }
    			
    		// if there is something written inside the file
    		if (lines > 0)
    		{
    			// importing previous data
    			for(int i = 0; i < lines; i++)
    			{
    			
    				name[i]=fileInput.nextLine();
    				account[i]=fileInput.nextInt();
    				fileInput.nextLine();
    				currentBal[i]=fileInput.nextDouble();
    				if (i < lines)
    				{
    					fileInput.nextLine();
    				}
    				System.out.println(name[i] + " " + account[i] + " " + currentBal[i]);
    			}
    		}
    		
    			
    		
    		
    		
    		int exit = 2;
    			
    		while (exit == 2)
    		{
    			int selection;
    			System.out.print("Welcome to the ATM 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();
    
    			if (selection == 1)
    			{
    				viewBalance();	
    				
    			}
    			else if (selection == 2)
    			{
    				withdrawFunds();
    			}
    
    			else if (selection == 3)
    			{
    				depositFounds();	
    			}
    			else if (selection == 4)
    			{	
    				exitProgram();
    				exit = 1;
    			}
    		}
    	}	
    			
    	public static void viewBalance()
    	{
    		
    		DecimalFormat money = new DecimalFormat ("$#,##0.00");
    		System.out.println("You have selected Balance.\n");
    		System.out.println("\t-- Your Current Balance is:$ " + currentBal);
    			
    	}
    			
    	public static double withdrawFunds()
    	{
    		Scanner input = new Scanner(System.in);
    		int withdraw;
    		final double FEE = 1.50;
    		System.out.println("Insert Amount of money you wanted withdraw: ");
    		withdraw =input.nextInt();
    		currentBal[0] = currentBal[0] - withdraw - FEE;
    		System.out.println("Please take your funds.");
    		return currentBal[0];
    	
    					
    	}
    	public static double depositFounds()
    	{	
    		Scanner input = new Scanner(System.in);
    		int addmoney;
    		final double FEE = 1.50;
    		System.out.println("Insert Amount of money you wanted add to your Account: ");
    		addmoney =input.nextInt();	
    		currentBal [0] = currentBal[0] + addmoney - FEE;
    		System.out.println("Thank you.");
    		return currentBal[0];
    	
    	}
    
    	public static void exitProgram()
    	{
    		DecimalFormat money = new DecimalFormat ("$#,##0.00");
    		System.out.println("Name:" + name);
    		System.out.println("Account Number: " + account);
    		System.out.println("Current Balance: $" + currentBal);
    		System.out.println("Thank you for using ATM! \n Goodbye! \n");	
    	}					
    }
    
  5. In Topic: ATM Machine program

    Posted 5 Dec 2012

    please help if someone know how to fix this problem

My Information

Member Title:
New D.I.C Head
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:

Contact Information

E-mail:
Private

Friends

karolek0901 hasn't added any friends yet.

Comments

karolek0901 has no profile comments yet. Why not say hello?