java - How do i modify a constructor? -
I am very new to Java and am trying to figure out that constructor to create a bank account object How to modify, which is the monthly interest when the user uses the annual interest rate of the format? I have no idea? The bank account constructor originally deposited the monthly interest rate for the instant account of the bank account object, but if the annual rate needs to be changed in monthly rate, how do I change it?
/ ** * bank account class * This class limits a bank account * * (By Tony Gaddis by Pearson Edik in the beginning of 2008 by Java - Early Objects * (Third Edition) Taken.) * * / Public-class bank account (public static zero main) (string [] args) {} private double balance; // Account balance private double interest; // interest rate private double interest; // Interest earned / ** * Constructor starts balancing * and equality and differences with the values passed to start interest rates. * Interest area is assigned 0.0 /. * Public bank account (double startbill, double interest) {balance = bookkeeping; Interest rate = intrate; Interest = 0.0;} / ** * The deposit method combines the amount of balance * amount. * The amount of parameters from the public balance (double amount) {Remaining = = amount;} / ** * removing the method * reduces the amount of parameters * / Public wasted return (double amount) {balance - = amount;} / ** * AddInterest method adds interest to the month * in the balance. * / Public Zero Advertising Dinterest () {interest = balance * interestRate; Balance = = interest; } / ** * Returns the value in the getBalance method balance field. * / Public Double Matching Balance () {Return Balance; } / ** * getInterest method returns * value in the interest area * / public double getInterest () {return interest; }}
You can create any number of creators in Java, the name of the method Name of the class
Public bank account (double startbill, double interact, float interest) {balance = start balance; InterestRate = intrate; Interest = 0.0; }
Comments
Post a Comment