Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Future Value Calculator  RSS feed

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I was wondering if someone could show me an example of a future value calculator:

" F = P(1+rate)^t "

where
F = future value
P = initial deposit (principal)
rate = (annual) interest rate (expressed as a fraction, e.g. 0.06)
t = number of years invested

Also,

The user needs to be able too input each parameter:

"Please input the principal: ______"
"Please input the annual interest rate: ______"
"Please input the number of years invested: ______"

Then,

The program should run the calculator and output the information:

"The future value of your investment after ___ years is : ______"

Thanks,
Evan
 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> I was wondering if someone could show me an example of a future value calculator:

if you are a beginner, have a crack at it yourself - you'll learn more that
way (the downside is you may end up with a few self-inflicted wounds!)

if you get stuck, post a specific question and include the code you've tried.
 
Evan Cristofori
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey,

I was going to... I just wanted to compare my results to someone elses.

Here is my code I came up with:



How does it look?
 
Java Cowboy
Sheriff
Posts: 16084
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It looks good.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!