calculating the average of a value over a month [closed]

I am working on a project right now that is having me calculate monthly interest on a bank account. The way the interest is supposed to be calculated is as follows:

Use the daily average to calculate interest. The daily average balance of an account is calculated by the taking the average of the end of the day balance for every day in the month. So, at the end of the every month, calculate the daily average balance for that month and use this to calculate interest.

The basic gist of my software is as follows: it’s a Desktop Java Application with a Swing GUI and a serialized text file to store information about bank accounts when the software is not running.

What is a good way to go about calculating this daily average and applying interest at the correct time?

NOTE: If possible, I really really do not want to have to implement some sort of centralized data base with SQL or something similar. This would require me to rewrite a lot of code, and I don’t know really anything about SQL as it is..

Additional Info
I will be using Joda-Time to keep track of the time/date.

I have contemplated just doing some sort of calculation on the time, date and balance every time I close/open the program. But what if the software is left running for, say 15 days straight?

Let’s say I just wanted to implement some code to calculate the average balance for the month whenever the program is opened, and not worry about the program being run for days at a time. How could I go about doing this? I was thinking about having some sort of lastAccessed field that would store the date of the last time the program was opened. Then calculate the the average every time the software was opened using that last accessed field somehow.

6

First I am going to put a disclaimer:

I really hope this is a school assignment project because storing account numbers and maintaining funds balance in a desktop application with a text file is unbelievably insecure and prone to error. I vehemently recommend more of a client/server/database design with security built between all layers.

With that being said, I will give you some advice as to how many banking and accounting systems manage funds and account balances.

Maintain a master account record with a master balance. Throughout the day when debits or credits are initiated in your application you will correspond these to a separate record that maintains Hold’s against account numbers.

What is a hold? It is a temporary hold of money on an account. For an account that is being debited funds, you put a hold on that account for the amount to transfer. The account receiving the credit will also have a Hold that signifies it will eventually be credited with the amount of the transfer.

Before initiating a transaction you have to do a balance check on the accounts to authorize the transaction. Take into account the master account balance +/- all debit and credit holds on the account.

At the end of the day at a specified time, or after the application starts up you need to do what is called “Hard charging”. This is where you calculate the new master balance of the accounts in the ledger with all of the holds that have been previously placed. This new balance will be your starting point now for the remainder of the day.

Why this complexity? This allows for easier integration with accounting packages and software as well as with payments going out to a bank or other financial institution.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật