User Profile

Collapse

Profile Sidebar

Collapse
otorojava
otorojava
Last Activity: Jan 30 '08, 02:06 AM
Joined: Jan 24 '08
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • otorojava
    replied to Text file to array
    in Java
    ok, i got it... thanks for looking
    See more | Go to post

    Leave a comment:


  • otorojava
    started a topic Text file to array
    in Java

    Text file to array

    Hi,
    I'm trying to store values from a text file into my array list

    Code:
    public static ArrayList getAccts(String file)
        { 
        	//Attributes
        	String aRecord;
    	StringTokenizer strings;
        	
            Account anAcct = new Account(); //Intialize obj
    
    	ArrayList<Account> anAL= new ArrayList<Account>();
    		
    	    try
    		{
    			FileReader inStream
    ...
    See more | Go to post

  • Ok this is what I did to fix the double variable

    //Double customerBalance ;

    Code:
    customerBalance = strings.nextToken(); //ERROR
    I changed it to

    Code:
    customerBalance  = Double.parseDouble(strings.nextToken());
    Now, how can I resolve string to boolean? I get an error with

    Code:
    boolean(strings.nextToken()); //ERROR
    See more | Go to post

    Leave a comment:


  • otorojava
    started a topic Reading text file with strings, double and boolean
    in Java

    Reading text file with strings, double and boolean

    The script works but I'm having a problem reading double and boolean

    Code:
    import java.io.*;
    import java.util.StringTokenizer;
    import javax.swing.JOptionPane;
    
    public class FileAddress
    {
      public static void main(String [] args)
      { 
        String aRecord; //for record
        String accountNumber;
        String customerName;
        String customerPhone;
    ...
    See more | Go to post

  • otorojava
    replied to New to HashMap with objects
    in Java
    Program is to do simple arithmetic, and write/read from file later on.

    So far this is what I have:

    Code:
    //Account class
    
    public class Account{
    	
    		String customerAccount;
    		String customerName;
    		double customerBalance;
    
    	public Account(String customerAccount, String customerName,double customerBalance){ //Constructor
    		this.customerAccount = customerAccount;
    ...
    See more | Go to post

    Leave a comment:


  • otorojava
    replied to New to HashMap with objects
    in Java
    something like this?

    Account class:
    Code:
    AccountClass:
    	public double doDeposit(){
    
    		Double output = customerBalance + newDeposit;
    		
    		return output;
    	}
    But, how do I get the existing balance from the HashMapDemo class?

    Code:
    HashMapDemo class:
    
    HashMap hm = new HashMap();
    Account anAcct1 = new Account("12-12-12",
    ...
    See more | Go to post

    Leave a comment:


  • otorojava
    replied to New to HashMap with objects
    in Java
    Thank you BigDaddyLH.

    How can I work with these arrays? Say I want to add 100 to Jane's account

    Account class
    Code:
            //customerBalance is double
    	public String toString() {
           // return ("Customer :" + customerAccount);
    		 String output = customerAccount + " " +  customerName + " " + customerBalance;
    		 
    		 return output;
    	}
    ...
    See more | Go to post

    Leave a comment:


  • otorojava
    started a topic New to HashMap with objects
    in Java

    New to HashMap with objects

    Hi,

    I'm trying to learn HashMaps using objects. The string currently returns null or shows an @923e30 error.

    Please advise. Account class and HashMapDemo class

    Code:
    public class Account{
    	
    		String customerAccount;
    		
    	public Account(String customerAccount){ //Constructor
    		this.customerAccount = customerAccount;
    		
    	}
    	
    	public String toString(String
    ...
    See more | Go to post
No activity results to display
Show More
Working...