This site requires JavaScript, please enable it in your browser!
Greenfoot back
divinity
divinity wrote ...

2021/5/29

Problem with an transaction arraylist

1
2
3
4
5
divinity divinity

2021/6/3

#
ok I got that one to work how do I get the s1.setRate(rate and Savings.add(acctamt) to coe up. am trying to bring tha up like how the nextDouble does come up
s1.seRate(rate)


Savings.add(acctamt) how do i get this to bring up
divinity divinity

2021/6/3

#
System.out.println("Please enter your current interest rate");
                interestRate = keyin.nextFloat();
                s1.set(interestRate); s1 is the error am getting 
                Saving_Account.add(acctnum);add is the error am getting tell me to how fix it
                
                
                    
                }
danpost danpost

2021/6/4

#
If you are trying to set up a new savings account, you would collect all the information first. Then, afterwards, instantiate a new Saving_Account object.
divinity divinity

2021/6/6

#
hi danpost, gbasire this is my main and i have getting some errors that i need to fix
 public static void main(String[]args){
        Scanner keyin = new Scanner(System.in);
        char type, choice;
        boolean quit;
        String first_name;
        String acctnum;
        double bal=0;
        float interestRate;
        
          
          
        System.out.println("\n "+ "Please select one of the following opeitons");
        System.out.println("| o-To Open Account  |");
        System.out.println("| d-To Make a deposit");
        System.out.println("| w-To Make a Withdrawal");
        System.out.println("| i-To Pay Interest");
        System.out.println("| t - To View the Transation");
        System.out.println("| q - To quit");
        type = keyin.next().trim().toUpperCase().toLowerCase().charAt(0);
        
        while (type !='q'){
           if(type == 'o'){
             System.out.println("please select the type of account you will like to open s-Saving or c-Chequin");
              choice = keyin.next().trim().toUpperCase().toLowerCase().charAt(0);
                
               if(choice == 's'){
                System.out.println("Enter the account holder first name");
                first_name = keyin.next();
                
                System.out.println("Please enter a saving account number");
                acctnum = keyin.next();
                
                
                System.out.println("Enter the saving acct number");
                acctnum = keyin.next();
                
                System.out.println("Please enter a starting balance");
                bal = keyin.nextDouble();
                
                
                System.out.println("Please enter your current interest rate");
                interestRate = keyin.nextFloat();
                s1.set(interestRate);here the s1.setinterestRate. this is where i am trying to set the interestRate but there is an error with the s1
                Saving_Account.add(acctnum);here am also trying to add the acctnum but the error here is the add
                
                }
                else if(choice =='c'){
                 System.out.println("Please enter a Chequing account number:");
                 acctnum=keyin.next();
                 Chequing_Account.add(acctnum);
                 System.out.println("Enter a starting balance: $"+bal);
                 bal=keyin.nextDouble();
                 c1.setbal(bal); the error here is the same, trying to set the balance but the c1. is the error is cannot find symbol, and telling me to create a class for c1 and s1
             }
            }
        }
        
    } 
          
what can I do to fix these errors. any help will do can u gave an example in your answer to see if it would work
danpost danpost

2021/6/6

#
You still need a home address, telephone and e-mail before you can create a savings account.
divinity divinity

2021/6/6

#
hi danpost what do you mean by that. becuse i add it in and I am still getting the same errrors
danpost danpost

2021/6/6

#
divinity wrote...
what do you mean by that. becuse i add it in and I am still getting the same errrors
Your Saving_Account constructor starts with:
 public Saving_Account(String first_name, String last_name, String home_add, String email_add, double bal, String telephone, double acctnum, float interestRate)
To create an instance of that class, you need all parts:
Saving_Account sa = new Saving_Account(First_name, Last_name, Home_address, Email_address, bal, Telephone, acctnum, interestRate);
divinity divinity

2021/6/6

#
hi danpost will i put that in my main or in the saving-account class
divinity divinity

2021/6/7

#
hey danpost I put it in my main but am getting a set of errors. for one the errors, it must be initialize, do i have to initialize to null becuse that is what I did but I dont think null is going to work
danpost danpost

2021/6/7

#
divinity wrote...
hey danpost I put it in my main but am getting a set of errors. for one the errors, it must be initialize, do i have to initialize to null becuse that is what I did but I dont think null is going to work
A value for each of the listed parameters needs to be passed to the constructor to create a Saving_Account instance.
divinity divinity

2021/6/7

#
so you are saying that I have to put a construction for the both the saving account and the chequing account into my main
danpost danpost

2021/6/7

#
divinity wrote...
so you are saying that I have to put a construction for the both the saving account and the chequing account into my main
Both will need to be instantiated somewhere -- and it will not be in Account, Saving_Account or Chequing_Account.
divinity divinity

2021/6/7

#
if not in the account, saving_account, and chequing_account will the transaction_acctount will do. and another thing, i would like to call up a method call the contains method, how do i call it
danpost danpost

2021/6/7

#
divinity wrote...
if not in the account, saving_account, and chequing_account will the transaction_acctount will do.
It will be where you gather the information to start an account.
i would like to call up a method call the contains method, how do i call it
No clear on what you want.
Gbasire Gbasire

2021/6/8

#
and when you create an instance of Saving_Account, do not create it litterrally like this :
Saving_Account sa = new Saving_Account(First_name, Last_name, Home_address, Email_address, bal, Telephone, acctnum, interestRate);
remember that you MUST put actual values, so for example you can create it like this :
Saving_Account sa = new Saving_Account("John", "Dollan", "Washington Street", "johndoe@gmail.com", 100, "+31 79 999 99 99", 200, 200.5);
There are more replies on the next page.
1
2
3
4
5