Savings Account Class

I'm having trouble figuring out a program for Java.
Heres the problem:
Create class SavingsAccount. Use a static variable annualInterestRate to store the annual interest rate for all account holders. Each object of the class contains a private instance variable savingsBalance indicating the amount the saver currently has on deposit. Provide method calculateMontlyInterest to calculate the monthly interest by multiplying the savingsBalance by annualInterestRate divided by 12---this interest rate should be added to savingsBalance. Provide a static method modifyInterestRate that sets the annualInterestRate to a new value. Write a program to test class SavingsAccount. Instantiate two savingsAccount objects, saver1 and saver2, with balances of $2000.00 and $3000.00, respectively. Set annualInterestRate to 4% then calculate the monthly interest and print the new balances for both savers. Then set the annualInterestRate to 5%, calculate the next month's interest and print the new balances for both savers.
Here is what I have so far:
import java.util.Scanner;
public class SavingsAccount
     private static int annualInterestRate = .04;
     private static int savingsBalance;
     private static int
     double saver1 = 2000.00;
     double saver2 = 3000.00;
     public static void main( String[] args)
          Scanner input = new Scanner ( System.in );
I know this isn't much, but I'm having trouble implementing the methods and private variables it is asking for.
I've been driving myself crazy trying to figure this out with no luck, so any help would be greatly appreciated.
Thanks, James.

Below is the code what i have got for your question.
import java.io.*;
public class SavingsAccount
public static double annualInterestRate;
private double savingsBalance;
private static double actualSavingsBalance1;
private static double actualSavingsBalance2;
public static void main(String[] args) throws IOException
//Get the input values for the needed calculations.
BufferedReader inBuf = new BufferedReader(new InputStreamReader(System.in));
String inData1;
String inData2;
String inData3;
System.out.println(" Please enter the savings account balance for the saver1: ");
inData1 = inBuf.readLine();
actualSavingsBalance1 = Double.parseDouble(inData1);
System.out.println(" Please enter the savings account balance fot the saver2: ");
inData2 = inBuf.readLine();
actualSavingsBalance2 = Double.parseDouble(inData2);
System.out.println(" Please enter the annual interest rate: ");
inData3 = inBuf.readLine();
annualInterestRate = Double.parseDouble(inData3);
//two saver objects.
SavingsAccount saver1 = new SavingsAccount(actualSavingsBalance1);
SavingsAccount saver2 = new SavingsAccount(actualSavingsBalance2);
//set the annually modified interest rate.
SavingsAccount.modifyInterestRate(annualInterestRate);
// Calculate the monthly interest rate and print the relevant
// account details.
saver1.calculateMonthlyInterest();
System.out.println(" Saver1 savings balance is: ");
System.out.println(saver1.getBalance());
saver2.calculateMonthlyInterest();
System.out.println(" Saver2 savings balance is: ");
System.out.println(saver2.getBalance());
public SavingsAccount()
//Overloaded constructor takes the input values for the savings balance.
public SavingsAccount(double value)
savingsBalance = value;
// Evaluating the net savings balance.
public void calculateMonthlyInterest()
savingsBalance += ((savingsBalance * annualInterestRate) / 12);
// Take the changed input values for the annualInterestRate.
public static void modifyInterestRate(double value)
annualInterestRate = value;
// Returns the net savings balance.
public double getBalance()
return savingsBalance;
Remember:
*** Instead of hard coding the values for the annual interest rate and savings
balance I have used variables and I have taken those input values using the
buffered reader and input stream.
*** All those input values have taken as string values an within the code you
can do the conversion as I have done.
Hope this will help you....!!!
regards....

Similar Messages

  • Install Base Accounting Class code

    Hi,
    Iam using api csi_item_instance_pub.update_item_instance for updating Install base instance.
    Iam able to update the partyid, account id but not accounting class code.
    Can anyone please help me how to update accounting class code along with party information.
    Any help is highly appreciated.
    Here is my code which Iam using to update Item instance..
    CREATE OR REPLACE PROCEDURE updateib_load_test
    IS
    g_instance_id_lst csi_datastructures_pub.id_tbl;
    l_instance_rec apps.csi_datastructures_pub.instance_rec;
    p_ext_attrib_values apps.csi_datastructures_pub.extend_attrib_values_tbl;
    p_party_tbl apps.csi_datastructures_pub.party_tbl;
    p_account_tbl apps.csi_datastructures_pub.party_account_tbl;
    l_pricing_attrib_tbl apps.csi_datastructures_pub.pricing_attribs_tbl;
    l_org_assignments_tbl apps.csi_datastructures_pub.organization_units_tbl;
    l_asset_assignment_tbl apps.csi_datastructures_pub.instance_asset_tbl;
    l_txn_rec apps.csi_datastructures_pub.transaction_rec;
    x2_txn_rec apps.csi_datastructures_pub.transaction_rec;
    l_return_status VARCHAR2 (100);
    l_msg_count NUMBER;
    l_msg_data VARCHAR2 (2000);
    l_created_manually_flag VARCHAR2 (100);
    ----l_org_id NUMBER := 204;
    n NUMBER := 1;
    v_instance_id NUMBER;
    p_commit VARCHAR2 (5);
    p2_commit VARCHAR2 (5);
    p_validation_level NUMBER;
    p_init_msg_lst VARCHAR2 (500);
    v_instance_party_id NUMBER;
    v_ip_account_id NUMBER;
    l_relationship_tbl apps.csi_datastructures_pub.ii_relationship_tbl;
    v_relationship_id NUMBER;
    v_success VARCHAR2 (1) := 'T';
    x2_return_status VARCHAR2 (100);
    x2_msg_count NUMBER;
    x2_msg_data VARCHAR2 (2000);
    p2_validation_level NUMBER;
    p2_init_msg_lst VARCHAR2 (500);
    a NUMBER;
    t1_msg_dummy VARCHAR2 (1000);
    t1_output VARCHAR2 (1000);
    l_not_created NUMBER;
    l_buffer VARCHAR2 (32767);
    l_problem EXCEPTION;
    l_message VARCHAR2 (2000);
    CURSOR updateib_cur
    IS
    SELECT *
    FROM ib_conv_stg
    WHERE updateib = 'Y'
    AND status_stg = 'V'
    AND new_instance_number IS NOT NULL
    AND transaction_id_stg = 8077;
    BEGIN
    -- DBMS_OUTPUT.put_line ('AFTER BEGIN');
    apps.fnd_file.put_line (apps.fnd_file.LOG, 'AFTER BEGIN');
    FOR updateib_rec IN updateib_cur
    LOOP
    BEGIN
    l_instance_rec.accounting_class_code := fnd_api.g_miss_char;
    IF p_party_tbl.EXISTS (1) IS NOT NULL
    THEN
    p_party_tbl.DELETE;
    END IF;
    IF p_account_tbl.EXISTS (1) IS NOT NULL
    THEN
    p_account_tbl.DELETE;
    END IF;
    IF p_ext_attrib_values.EXISTS (1) IS NOT NULL
    THEN
    p_ext_attrib_values.DELETE;
    END IF;
    /* SELECT apps.csi_item_instances_s.NEXTVAL
    INTO v_instance_id
    FROM SYS.DUAL;*/
    l_instance_rec.instance_id :=
    TO_NUMBER (updateib_rec.new_instance_number);
    l_instance_rec.instance_number := updateib_rec.new_instance_number;
    apps.fnd_file.put_line (apps.fnd_file.LOG,
    l_instance_rec.instance_id);
    l_instance_rec.object_version_number := updateib_rec.object_version;
    apps.fnd_file.put_line (apps.fnd_file.LOG,
    l_instance_rec.object_version_number
    --l_instance_rec.inventory_item_id := updateib_rec.inventory_item_id;
    l_instance_rec.inv_master_organization_id :=
    updateib_rec.inv_master_organization_id;
    --189;
    l_instance_rec.mfg_serial_number_flag :=
    updateib_rec.mfg_serial_number_flag;
    --'Y';
    --l_instance_rec.serial_number := updateib_rec.ls_serial_number;
    ---'LOG0005';
    l_instance_rec.quantity := updateib_rec.quantity; --1;
    l_instance_rec.unit_of_measure := updateib_rec.unit_of_measure;
    --'EA';
    l_instance_rec.accounting_class_code :=
    updateib_rec.accounting_class_code;
    apps.fnd_file.put_line (apps.fnd_file.LOG,
    updateib_rec.new_instance_number
    || 'instance_rec'
    || l_instance_rec.accounting_class_code
    || 'updateib'
    || updateib_rec.accounting_class_code
    --'CUST_PROD'; --'INV';
    l_instance_rec.instance_status_id := updateib_rec.instance_status_id;
    --510;
    l_instance_rec.customer_view_flag := updateib_rec.customer_view_flag;
    --'N'; --N
    l_instance_rec.merchant_view_flag := updateib_rec.merchant_view_flag;
    --'Y'; --Y
    l_instance_rec.sellable_flag := updateib_rec.sellable_flag;
    --'Y'; --N
    --l_instance_rec.active_start_date := updateib_rec.active_start_date;
    --SYSDATE;
    l_instance_rec.location_type_code := updateib_rec.location_type_code;
    --'HZ_PARTY_SITES';
    l_instance_rec.location_id := updateib_rec.location_id; --375885;
    l_instance_rec.install_date := updateib_rec.install_date;
    --SYSDATE;
    l_instance_rec.install_location_type_code :=
    updateib_rec.install_location_type_code;
    --'HZ_PARTY_SITES';
    l_instance_rec.install_location_id :=
    updateib_rec.install_location_id;
    --375885;
    --l_instance_rec.vld_organization_id :=
    --updateib_rec.last_vld_organization_id;
    --2104;
    l_instance_rec.creation_complete_flag :=
    updateib_rec.creation_complete_flag;
    --'Y';
    --l_instance_rec.object_version_number :=
    --updateib_rec.object_version_number;
    -- 1;
    l_instance_rec.external_reference :=
    updateib_rec.ls_external_reference;
    l_instance_rec.instance_usage_code :=
    updateib_rec.instance_usage_code;
    l_instance_rec.inv_organization_id :=
    updateib_rec.inv_organization_id;
    l_instance_rec.inv_subinventory_name :=
    updateib_rec.inv_subinventory_name;
    l_instance_rec.inv_locator_id := updateib_rec.inv_locator_id;
    l_instance_rec.manually_created_flag :=
    updateib_rec.manually_created_flag;
    l_instance_rec.last_oe_po_number := updateib_rec.last_oe_po_number;
    l_instance_rec.instance_type_code :=
    updateib_rec.ls_instance_type_code;
    l_instance_rec.attribute3 := updateib_rec.ls_warranty_expiration_date;
    --l_instance_rec.UPDATE_ORACLE:= updateib_rec.UPDATE_ORACLE;
    -- ************* FOR PARTIES **********************************************************
    /* SELECT apps.csi_i_parties_s.NEXTVAL
    INTO v_instance_party_id
    FROM SYS.DUAL;*/
    p_party_tbl (1).instance_party_id := updateib_rec.instance_party_id;
    p_party_tbl (1).instance_id :=
    TO_NUMBER (updateib_rec.new_instance_number);
    p_party_tbl (1).party_source_table :=
    updateib_rec.owner_party_source_table;
    --'HZ_PARTIES'; --
    p_party_tbl (1).party_id := updateib_rec.owner_party_id;
    --442143; --13478;
    p_party_tbl (1).relationship_type_code := 'OWNER';
    p_party_tbl (1).contact_flag := 'N';
    -- l_party_tbl (1).active_start_date := updateib_rec.active_start_date;
    --SYSDATE;
    p_party_tbl (1).object_version_number :=
    updateib_rec.object_version_p;
    apps.fnd_file.put_line (apps.fnd_file.LOG,
    p_party_tbl (1).object_version_number
    -- *********** FOR PARTY ACCOUNT *****************************************************
    /* SELECT apps.csi_ip_accounts_s.NEXTVAL
    INTO v_ip_account_id
    FROM SYS.DUAL;*/
    p_account_tbl (1).ip_account_id := updateib_rec.ip_account_id;
    p_account_tbl (1).instance_party_id := updateib_rec.instance_party_id;
    p_account_tbl (1).party_account_id :=
    updateib_rec.owner_party_account_id;
    --755865;
    p_account_tbl (1).relationship_type_code := 'OWNER';
    --l_account_tbl (1).active_start_date := updateib_rec.active_start_date;
    --SYSDATE;
    p_account_tbl (1).object_version_number :=
    updateib_rec.object_version_a;
    apps.fnd_file.put_line (apps.fnd_file.LOG,
    p_account_tbl (1).object_version_number
    -- 1;
    p_account_tbl (1).parent_tbl_index := 1;
    p_account_tbl (1).call_contracts := 'Y';
    -- ************************** TRANSACTION REC *****************************************
    l_txn_rec.transaction_date := SYSDATE;
    l_txn_rec.source_transaction_date := SYSDATE;
    l_txn_rec.transaction_type_id := 1;
    l_txn_rec.object_version_number := 1;
    -- *************** API CALL *******************************************************
    -- DBMS_OUTPUT.put_line ('BEFORE CREATE ITEM INSTANCE');
    apps.fnd_file.put_line (apps.fnd_file.LOG,
    'BEFORE UPDATE ITEM INSTANCE'
    END;
    BEGIN
    fnd_msg_pub.initialize;
    csi_item_instance_pub.update_item_instance
    (p_api_version => 1.0,
    p_commit => apps.fnd_api.g_true
    --Defaults assigned in the package
    p_init_msg_list => apps.fnd_api.g_true
    --Defaults assigned in the package
    p_validation_level => apps.fnd_api.g_valid_level_full
    --Defaults assigned in the package
    p_instance_rec => l_instance_rec,
    p_ext_attrib_values_tbl => p_ext_attrib_values,
    p_party_tbl => p_party_tbl,
    p_account_tbl => p_account_tbl,
    p_pricing_attrib_tbl => l_pricing_attrib_tbl,
    p_org_assignments_tbl => l_org_assignments_tbl,
    p_asset_assignment_tbl => l_asset_assignment_tbl,
    p_txn_rec => l_txn_rec,
    x_instance_id_lst => g_instance_id_lst,
    x_return_status => l_return_status,
    x_msg_count => l_msg_count,
    x_msg_data => l_msg_data
    COMMIT;
    apps.fnd_file.put_line (apps.fnd_file.LOG,
    'AFTER UPDATE ITEM INSTANCE'
    apps.fnd_file.put_line (apps.fnd_file.LOG, 'test' || l_msg_data);
    /* apps.fnd_file.put_line (apps.fnd_file.LOG,
    'test1'
    || apps.fnd_msg_pub.get
    (l_lcv,
    apps.fnd_api.g_false
    IF l_return_status != apps.fnd_api.g_ret_sts_success
    THEN
    l_not_created := l_not_created + 1;
    ROLLBACK;
    RAISE l_problem;
    END IF;
    updating STATUS in stg table
    BEGIN
    IF l_return_status = 'S'
    THEN
    dbms_output.put_line('satus :'||l_return_status);
    COMMIT;
    END IF;
    COMMIT;
    END;
    -------------exception l_problem
    EXCEPTION
    WHEN l_problem
    THEN
    IF (l_msg_count > 0)
    THEN
    l_buffer := '';
    FOR l_lcv IN 1 .. l_msg_count
    LOOP
    l_message :=
    apps.fnd_msg_pub.get (l_lcv, apps.fnd_api.g_false);
    END LOOP;
    END IF;
    COMMIT;
    END;
    END LOOP;
    END updateib_load_test;

    Hi Nagamohan,
    Thanks for your reply.
    Iam using the Location type code 'HZ_PARTY_SITES'.
    Actually Iam updating existing instance to update party information.
    The existing instance has the accounting_class_code as 'CUST_PROD'.
    I want to update accounting class code to 'INV' while updating party information.
    Iam able to update party information but not able to update accounting class code.
    When I digged into the api, csi_item_instance_pub.update_item_instance I found some code which was updating the accounting_class_code to null if there is party information to be updated. I think this is the reason Iam not able to update accounting class.
    Please help me if there is any chance of updating accounting class code along with party information.
    Thanks in advance

  • Autocomplete suggests my user ID and date of birth on the log in page of my savings account - how do I stop this?

    For the most part autocomplete is really helpful. However, when I log in to my savings account, my user ID and DOB are suggested, allowing anyone on my PC to view my account (a security code is required to carry out any transactions which does not appear to be autocompleted!) - how can I switch this off please? This has started since I reset Firefox (due to slowness, as recommended by Firefox). Thanks.

    Thank you jscher2000: all fixed now!

  • Can I create new wip accounting class type?

    What are the differences between wip accounting class types are set? and can I define new types?

    >
    I could use some quick help. In our 9i environment I used to type in dbca command to create a new database. Is there a similar option in 10G express.
    >No. You cannot create a XE database: it's created when installing XE and you cannot create another database with XE software on the same host.
    >>I can not seem to find a way to create a new database instance. I am guessing I will need to re-create my schema, and table structures under the one instance. Is that true?
    >Yes you need to create your schema in the existing XE database.

  • Best for Accounting Class? Excel or Numbers '09

    I'm about to take a cost accounting class and the syllabus says that we'll be using excel to do spreadsheets and to create an interactive master budget. I'm not sure if I should go for Numbers '09 (since I'm more inclined to get iWork because of Pages and Keynotes '09) or Excel (since my professor is encouraging it). I really want to give Numbers '09 a chance but I don't want to struggle in class.

    The reasons for that encouragement could be a matter of preference/familiarity on the part of the professor, or could arise from the fact that the feature sets of the two applications are not the same.
    If the course includes use of Excel functions and features not supported by Numbers, you'll be placing an extra learning burden on yourself to find ways to do the same task without the same tools, and sometimes you'll find it much more difficult (or not possible) to do the same task without those tools.
    Regards,
    Barry

  • Display account class field in view

    Hi All,
             I want to display account class field in a view in ICWEB client but the field is not there in any of the BOL entities. In backend this field is shown in IC win client under, contract account general data. How can i integrate this field into my view?
    With Advance Thanks,
    Sujith

    Hi Manuel,
                  Thank you for the reply. I am working in CRM ISU. The CRM is in one server and ISU is in another. While i run transaction CIC0 in ISU there is a field "account class" (Possible values for the field are:- Residential customers , Open group deals, large acconts) under contract account general data. When i check for this field in BOL entities in CRM system i cant find it any where. My requirement is to display this field in BuPaMorefields view in ICWEB client. I think now its clear .
    With Advance Thanks,
    Sujith

  • Need help in Account class

    Hello
    I am new to Java and am taking my first course on it. This question deals with the Account class. I have to create an Account.java program that applies the deposit method to a balance. A second testAccount.java program tests the first. It's not working and I was wondering if anyone had some ideas for me. Here is a sample of my code:
    testAccount.java
    // enter deposit
         String depositString = JOptionPane.showInputDialog (null, "Enter Deposit", "TME 2 - 6.3", JOptionPane.QUESTION_MESSAGE);
         double deposit = Double.parseDouble(depositString);
    //create the account object
         Account account = new Account (id, balance, annualInterestRate, deposit);
    Account.java
    // reurn the balance
         public double getBalance() {
              return balance;
         // set a new balance
         public void setBalance(double balance) {
              this.balance = balance;
         // return the deposit
         public double getDeposit() {
              return deposit;
         // Deposit
         public void deposit (double deposit){
              this.balance += deposit;
    public class Account {
         private int id;
         private double balance;
         private double annualInterestRate;
         private double deposit;
         // constructor
         public Account () {
              this (1122, 20000, 4.5, 0);
         // construct an account with specified id, balance, annual interest rate
         public Account(int id, double balance, double annualInterestRate, double deposit) {
              this.id = id;
              this.balance = balance;
              this.annualInterestRate = annualInterestRate;
              this.deposit = deposit;
    Thanks very much
    Craig

    Ok, sorry for the disjointed question. This my first time seeking help on the forum. Below are my two programs. The testAccount.jave runs but returns a balance that has not been modified by the deposit / withdraw. It is how to use the deposit/withdraw methods that is throwing me for a loop.
    TestAccount.java
    import javax.swing.JOptionPane;
    public class TestAccount {
         public static void main (String [] args) {
         // enter id
         String idString = JOptionPane.showInputDialog (null, "Enter Account ID", "TME 2 - 6.3", JOptionPane.QUESTION_MESSAGE);
         int id = Integer.parseInt(idString);
         // enter balance
         String balanceString = JOptionPane.showInputDialog (null, "Enter Account Balance", "TME 2 - 6.3", JOptionPane.QUESTION_MESSAGE);
         double balance = Double.parseDouble(balanceString);
         // enter annual interest rate
         String annualInterestRateString = JOptionPane.showInputDialog (null, "Enter Account Annual Interest Rate", "TME 2 - 6.3", JOptionPane.QUESTION_MESSAGE);
         double annualInterestRate = Double.parseDouble(annualInterestRateString);
         // enter deposit
         String depositString = JOptionPane.showInputDialog (null, "Enter Deposit", "TME 2 - 6.3", JOptionPane.QUESTION_MESSAGE);
         double deposit = Double.parseDouble(depositString);
         // enter withdraw
         String withdrawString = JOptionPane.showInputDialog (null, "Enter Withdraw", "TME 2 - 6.3", JOptionPane.QUESTION_MESSAGE);
         double withdraw = Double.parseDouble(withdrawString);
         //create the account object
         Account account = new Account (id, balance, annualInterestRate);
         //print results
         String output = "The Balance is " + account.getBalance() + "\nThe monthly interest is " + account.monthlyInterest();
         JOptionPane.showMessageDialog (null, output, "TME 2 - 6.3", JOptionPane.INFORMATION_MESSAGE);
         System.exit(0);
    And here is the Account.java program
    public class Account {
         private int id;
         private double balance;
         private double annualInterestRate
         // constructor
         public Account () {
              this (1122, 20000, 4.5);
         // construct an account with specified id, balance, annual interest rate
         public Account(int id, double balance, double annualInterestRate, double deposit) {
              this.id = id;
              this.balance = balance;
              this.annualInterestRate = annualInterestRate;
         // return the id
         public int getID() {
              return id;
         // set a new id
         public void setID(int id) {
              this.id = id;
         // reurn the balance
         public double getBalance() {
              return balance;
         // set a new balance
         public void setBalance(double balance) {
              this.balance = balance;
         // Deposit
         public void deposit (double deposit){
              balance += deposit;
         // Withdraw
         public void withdraw ( double withdraw) {
              this.balance -= withdraw;
         // return the annual interest rate
         public double getAnnualInterestRate() {
              return annualInterestRate;
         // set a new annual interest rate
         public void setAnnualInterestRate(double annualInterestrate) {
              this.annualInterestRate = annualInterestRate;
         // convert annual interest rate into monthly
         public double monthlyInterest() {
              double monthlyInterest = annualInterestRate / 1200 * balance;
              return monthlyInterest;
    Thanks very much in advance
    Craig

  • Update AR Invoice - Distribution Account - Class Revenue

    Hi,
    I want to update AR Invoice - Distribution Account - Class Revenue. The transaction is completed but not posted into GL. From front-end I can do it easily, but I have 1000 + transactions.
    Is there any API available to update AR Invoices Distribution Accounts?
    Thanks
    Waqas Hassan

    Hi,
    There is no update API available. I have uploaded AR Invoices and all that invoices are complete. But our Financial Consultant send me the request to change to Distribution Account.
    It can be, if I do the invoices to incomplete and then delete it.
    This could be the logic to re-create the invoices.
    Please guide me how could I do it incomplete?
    Thanks

  • Account class

    Hello, is there a concept called account class in SAP. For example , for account 1000255100 the account class is 1(the account class is denoted by the first letter)...thx

    ok, functionally we have a concept known as classes of accounts :
    e.g class 1 :accounts 10000000 - 19999999 for supplier.
          class 6: accounts 60000000 - 69999999 for G/L accounts.
    the requirement is to create an authorisation so that user cannot charge on accounts of a certain class(E.G class 1 ).
    But, we do not have the class concept in SAP. we rather have the account type concept -> for example type S may refer to all G/L accounts(starting with 6........).
    i'm trying to find an authorisation object for transaction FB01 which will allow me to do this.
    Edited by: Antish  Awootar on Jun 12, 2009 10:58 AM

  • Account class reference

    what do u mean  by account class reference and is that as same as how is that differ from account category reference?

    what do u mean  by account class reference and is that as same as how is that differ from account category reference?
    There is nothing in SAP called account class reference , There is a term called Account class which is used for creating Account groups, Account category reference is used for assignment of valuation class to Material type for pulling & assignment of G/L accounts

  • Help Transfering Money in Account Class

    Hi, i had a task where i have to add some feature to a account class. I have done the first two (checking if in credit, and applying a credit charge) but i am having trouble with the transfer one. Money has to be transfered from "from" to the account. The tip says the following.
    "Send the message to withdraw to the object passed as a parameter. Then you will need to add the withdrawn amount to the balance in the current account. Remember the object from is a seperate account and is passed by reference. Consequence of passing the handle to the object by value. So that all changes made to the formal parameter from are made to the actual object that is passed."
    My question is that how do i set up the reference to the account from, as i am unsure how to, as how i have it at the moment is just withdrawing from the current account? Also at the moment i have
    "getBalance()=getBalance()+amount;" why will it not allow this as they are all double?
    Super class
    class Account
      private double theBalance    = 0.00;   // Balance of account
      private double theMinBalance = 0.00;   // Minimum bal (Overdraft)
      public double getBalance()
        return theBalance;
      public double withdraw( final double money )
        assert money >= 0.00;
        if ( theBalance - money >= theMinBalance )
          theBalance = theBalance - money;
          return money;
        } else {
          return 0.00;
      public void deposit( final double money )
        assert money >= 0.00;
        theBalance = theBalance + money;
      public void setMinBalance( final double money )
        theMinBalance = money;
      public double getMinBalance()
        return theMinBalance;
    }And my subclass
    public class AccountBetter extends Account
    boolean a;
    double charge;
    double newbal;
    double awooga;
    public boolean in_credit(){
    if (getBalance()>0.00)
    a = true;
    else
    {a = false;
    return a; }
    public void credit_charge()
    {if (getBalance()<0.00)
    {charge = getBalance() * -0.00026116;
    if (withdraw(charge)>getMinBalance()){
    setMinBalance(getMinBalance()-charge);
    withdraw(charge);
    public void transfer (AccountBetter from, double amount)
    withdraw(amount);
    getBalance()=getBalance()+amount;
    }

    Hi, i had a task where i have to add some feature to a
    account class. I have done the first two (checking if
    in credit, and applying a credit charge) but i am
    having trouble with the transfer one. Money has to be
    transfered from "from" to the account. The tip says
    the following.Finally somebody who's posting code, asking precise questions and makes sense :-)
    "Send the message to withdraw to the object passed as
    a parameter. Then you will need to add the withdrawn
    amount to the balance in the current account. Remember
    the object from is a seperate account and is passed by
    reference. Consequence of passing the handle to the
    object by value. So that all changes made to the
    formal parameter from are made to the actual object
    that is passed."Pass-by-reference v.s. pass-by-value
    Search on that in this forum, you'll find about everything you ever want to know (and don't want to know) about it.
    My question is that how do i set up the reference to
    the account from, as i am unsure how to, as how i have
    it at the moment is just withdrawing from the current
    account?Imagine 2 account objects, method calls with parameters and calling methodson both objects.
    (Also remember the pass-by-reference thingies you spent time on reading here in the forum :-P )
    Also at the moment i have
    "getBalance()=getBalance()+amount;" why will it not
    allow this as they are all double?This won't ever work, sorry about that, but no luck there.
    You cannot assign a value to a method call.
    <snip-code />
    I would take a look at the coding standards while you were at it,
    for example: the method credit_change is not according to the, general accepted, coding standards ;-)
    About your problem,
    the signature of the transfer money is sufficient but think about the following:
    - Where do i want to transfer from?
    - Where do i want to transfer to?
    - Can i assign values to a method or can i only do that to variables that are visible in the scope i'm working in?
    - Are there any other methods I could use, for example inherited ones?

  • Accounting Class

    I need to do a presentation for my accounting class. For that,
    I need to know more about Oracle's accounts receivable. What
    kind of infomation can you give me? It does not need to be very
    specific. Thank you for all your help.
    Joe Fogarty

    The reasons for that encouragement could be a matter of preference/familiarity on the part of the professor, or could arise from the fact that the feature sets of the two applications are not the same.
    If the course includes use of Excel functions and features not supported by Numbers, you'll be placing an extra learning burden on yourself to find ways to do the same task without the same tools, and sometimes you'll find it much more difficult (or not possible) to do the same task without those tools.
    Regards,
    Barry

  • Will it hurt my credit score to apply for CDs and a savings account around the same time?

    In general, do banks conduct a hard pull when we apply for CDS, money market funds and savings accounts?
    I want a start a CD and a new savings account with higher yield asap.
    I'm pretty disciplined financially, but I don't know enough as I should. I've been trying to research it but no clear answers came up.
    I just got approved for a new credit card and the bank did a hard pull on all three bureaus. I still have a pretty good credit score for my age.
    Should I wait a little while? What would be a good strategy?
     I'm probably going to use a different bank for each one.

    I wouldn't buy a CD now under any circumstances, not even a short-term one.  Rates will almost assuredly be going upwards and still suck currently for CD's anyway, and locking yourself into a fixed interest rate that will have a penalty to cancel early, bad mojo.  Stick money elsewhere, least savings account is liquid in this case.

  • IPC UserExits, Custsomer Account Class, Populate ACCNT_CLS For Vertex

    With reference to our landscape: CRM40 w/ IPC40 SP 07 Patch 26.
    We are in the process of extending our CRM 40 system for consumer use in Canada. We have been running our US implementation since 2005. In the US we have implemented the java PricingUserExits in order to implement our custom routines.
    For Canada however, we have a user exit in R/3 side that contains functionality we need to replicate in our CRM system. This userexit is implemented (based on oss note 302998) in order to populate CH_USER_CHANGED_FIELDS-ACCNT_CLS field. The  userexit name is EXIT_SAPLFYTX_USER_001. Below is the code segment:
      select single gform
             into ch_user_changed_fields-accnt_cls
             from kna1
             where kunnr = ch_user_changed_fields-accnt_no. "Ship-To
    On the r/3 system, the ACCNT_CLS value is passed to Vertex which in turn handles the proper tax determination.
    I have researched OSS, SDN and Web as well as my own trial and error coding in java user exits ItemTaxUserExit and DocumentTaxUserExit in order to bind ACCNT_CLS attribute along with a hard coded value. However the functionality/result I expect is as if Vertex is not receiving or recognizing the value. I can bind the attribute ACCNT_CLS without error. Here is the simple explanation of my enhancement:
    In ItemTaxUserExit.addAttributeBindings  along with some conditional logic, I am invoking the following method calls against object itemUserExitAccess and document
    itemUserExitAccess.addHeaderAttributeBinding("ACCNT_CLS","GW");
    document.addHeaderAttributeBinding("ACCNT_CLS","GW");
    in ItemTaxUserExit.determineRelevantAttributes I have specified the following:
    return new String[] { PricingCustomizingConstants.AttributeNames.product_taxability_type, "ACCNT_CLS" };
    One thing to note is the ACCNT_CLS is not one of the PricingCustomizingConstants.AttributeNames so I have explicitly used ACCNT_CLS.
    I also output the value of this attribute to the log to verify it has been set and contains value. It is successful and has value
    Log.getInstance().log(this,Severity.DEBUG,"accntclsBinding was not null " + accntclsBinding.getName() + " = " + accntclsValue.getValue() ,null);
    I feel I am heading in the right direction but possibly off the beaten path. I have tried to bind bogus attributes and receive a java null pointer exception so binding ACCNT_CLS successfully is a good thing. But why it is not communicated to Vertex.
    I found two oss notes 673222 and 586939. Do you feel these are applicable and an appropriate for resolving my issue?
    Any advise and direction you can provide would be greatly appreciated.

  • Need help with class inheritance

    I've got a class called jemAccount and i need to create a savings account class and a checking account class that inherit from it.
    Here is the jemAccount:
    public class jemAccount
    protected String myName;
    protected double myBalance;
    protected double[] withdrawls = new double [50];
    protected double[] deposits = new double [50];
    protected int withIndex = 0;
    protected int depIndex = 0;
    public jemAccount ()
    myBalance = 0;
    public jemAccount (String newName)
    myName = newName;
    myBalance = 0;
    public jemAccount (String newName, double newBal)
    myName = newName;
    myBalance = newBal;
    public void setName(String newName)
    myName = newName;
    public double balance()
    return myBalance;
    public void withdrawl (double amount)
    if (amount < 0)
    myBalance += amount;
    else
    myBalance -= amount;
    if (withIndex < 50)
    withdrawls[withIndex] = amount;
    withIndex++;
    public void deposit (double amount)
    if (amount > 0)
    myBalance += amount;
    if (depIndex < 50)
    deposits[depIndex] = amount;
    depIndex++;
    public void printAccount()
    System.out.println("Owner of account: " + myName);
    System.out.println("Balance of account: " + myBalance);
    System.out.println("Deposits: ");
    for (int i = 0; i < depIndex; i++)
    System.out.println(" " + deposits);
    System.out.println("");
    System.out.println("Withdrawls: ");
    for (int i = 0; i < withIndex; i++)
    System.out.println(" " + withdrawls[i]);
    System.out.println("");
    System.out.println("");
    } // end of class jemAccount
    Here are my requirements for the savings account class:
    � Call the class "abcSaveAccount".
    � Have this class inherit from "jemAccount"
    � Add a float for keeping track of the yearly interest rate of the checking account. Call this class variable "interest" Make it protected.
    � Add a public constructor for the savings account class. It should have one parameter, a float that initializes the new savings account class variable. This constructor should also call the parent class constructor with no arguments.
    � Add a public method for calculating interest. Call it "calcInterest". Have it take one parameter, an integer which represents the number of months to calculate the interest for. This method should return a float, the result of the interest calculation. For example, if 30 months are entered as a parameter of 30, then 2 and one/half years of interest on the balance are calculated and returned.
    Here are the requirements for the checking account class:
    � Call the class "abcCheckAccount"
    � Have this class inherit from "jemAccount"
    � Add an array for keeping track of the checks you write. For now, just make this an array of 100 doubles, very similar to withdrawals
    � Add a public constructor for the checking account class. It should have zero parameters. This constructor should also call the parent class constructor with no arguments.
    � Add a new public method to your checking account class. Call it "writeCheck". This should take one double parameter. If the value of the parameter is positive, subtract the parameter from the balance, and copy the value into the "checks" array. (Keep the checks and withdrawals separate.) Else do nothing.
    � Override the "printAccount" method. Have the checking account "printAccount" run its parent "class printAccount", then print out a list of the checks, after the list of the withdrawals.
    Here's what i have so far for the savings account class:
    public class abcSaveAccount extends jemAccount
    protected float interest;
    public void abcSaveAccount (float newSavings)
    super ();
    public calcInterest (int numberMonths)
    return interest;
    And here's what i have so far for the checking account class:
    public class abcCheckAccount extends jemAccount
    double[] checks = new doulbe[100];
    public abcCheckAccount ()
    super ();
    public writeCheck (double value)
    if (value >= 0)
    balance = balance - value;

    Few changes,
    public class abcCheckAccount extends jemAccount {
         private double[] checks = new double[100];
         private int checkIndex;
         public abcCheckAccount() {
              super ();
              checkIndex=0;
         public void writeCheck (double value) {
              if ( value >= 0) {
                   withdrawl(value);
                   checks[checkIndex++]=value;
         public void printAccount() {
              super.printAccount();
              System.out.println("Checks:");
              for (int i = 0; i < checkIndex; i++) System.out.println("     "+checks[ i ]);
              System.out.println("");
              System.out.println("");
    } // end of abcCheckAccount classand
    public class abcprog {
       public static void main (String args[]) {
              abcCheckAccount check = new abcCheckAccount();
              check.setName("Sudha");
              check.deposit(1000.0);
              check.deposit(200.0);
              check.withdrawl(112.0);
              check.writeCheck(300.0);
              check.printAccount();
              abcSaveAccount save = new abcSaveAccount(6);
              save.setName("Mike");
              save.deposit(1000.0);
              save.withdrawl(112.0);
              save.printAccount();
              System.out.println("Calculated Interest : "+save.calcInterest(120));
    }U can use this program to test your classes.
    Sudha

Maybe you are looking for

  • Accessing model in other class

    Hi all, I have two classes, one is a JFrame and the the other one is a JDialog. In the JFrame, I have a JList that uses the DefaultListModel and an "Add" JButton. When the user clicks the Add button. The JDialog pops up and allows the user to enter t

  • Where do I get eps parser plugin for adobe photodeluxe home edition 3.x and photodeluxe business edition 1.x

    Had to do a recovery on my Windows Xp Media Edition yesterday.  Just got this message when I started up my PC today and tried to open up Adobe Photoshop Business Edition 1.0 (I know, i know, but I LIKE Photoshop Business Edition 1.0.  It does everyth

  • EJB3 and/or Toplink and setting context for VPD

    We are looking at moving to the latest version of jdeveloper and taking advantage of the ejb3 and/or toplink features for the model part of applications. I have a question on how to set the vpd context using this new model. Currently we use: Jdevelop

  • AdbeRdrUpd1001_Tier1.msp Update Does Not Install using Nullsoft

    Hello, I am attempting to use the Nullsoft Scriptable Install system to install the Adobe® Reader® 10.0.1 update on Windows XP SP3.  I determined that the Adobe update will install as expected when I run the msp on a console command line with the fol

  • "Export To Premiere" Does Not Work

    Premiere sequence sent to Audition for editing does not export back to Premiere. It does create the new audio files in a seesion folder. I can import the files into my project, but that's not how it's supposed to work. It worked in the past. CS6