User Profile
Collapse
-
ok, i got it... thanks for looking -
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 -
Ok this is what I did to fix the double variable
//Double customerBalance ;
I changed it toCode:customerBalance = strings.nextToken(); //ERROR
Now, how can I resolve string to boolean? I get an error withCode:customerBalance = Double.parseDouble(strings.nextToken());
Code:boolean(strings.nextToken()); //ERROR
Leave a comment:
-
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; -
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;Leave a comment:
-
something like this?
Account class:
But, how do I get the existing balance from the HashMapDemo class?Code:AccountClass: public double doDeposit(){ Double output = customerBalance + newDeposit; return output; }
...Code:HashMapDemo class: HashMap hm = new HashMap(); Account anAcct1 = new Account("12-12-12",Leave a comment:
-
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; }Leave a comment:
-
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
No activity results to display
Show More
Leave a comment: