Java.util.Date null output -


I do not know why my code is giving me a blank for java.util.date

Question: Write a test program which creates an account object with an account id of 1122, the balance of 20000 and the annual interest rate of 4.5%. Use the withdrawal method to withdraw 2500 dollars, use the deposit method to deposit $ 3000 and print the balance, monthly interest and the date when this account was created. Here is my code:

  Import java.util. *; Public class account {private id id; Private double balance; Private Double Annual Interest; Personal java.util.Date dateCreated; Public Account () {} Public Account (Ent ID, Double Balance, Double Annual Interest) {this.ID = ID; this.Balance = Balance; This.annualInterestRate = annualInterestRate; } Public Zero Set ID (Ent ID) {this.ID = ID; } Public Zero Set Balance (Double Balance) {this.Balance = Balance; } Public Zero Set Uncertainty (double annuity interest) {this.annualInterestRate = annualInterestRate; } Public int getID () {return ID; } Public Double getBalance () {Return Balance; } Public Double getInterestRate () {Annual Return InterestRate; } Public java.util.Date getDateCreated () {return date; } Public Double Gain Monthly Indirect () {Return Annual Indestruct / 12; } Public Zero (if ((balance - val) <0) {System.out.println ("Unpleasant content deleted from this line") with scare (double valve); } Other {Balance - = Val; }} Public zero dePosits (double value) {balance = + value; } Public Static Zero Main (String [] Ripening) {Account Account = New Account (1122, 20000, .045); Account.withDraw (2500); account.dePosits (3000); Println (account.getBalance ()); Println (account.getDateCreated ()); }   

}

You have not started DateCreated . For example, in constructor (or somewhere else depending on your usage case)

  dateCreated = new java.util.Date ();   

or any other way to get started with the date of need.

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -