1 Replies - 1010 Views - Last Post: 23 July 2012 - 04:47 AM Rate Topic: -----

#1 crohnsandme  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 23
  • Joined: 17-July 12

convert user input into a percentage value?

Posted 23 July 2012 - 04:19 AM

hi all , so i need to do a task which user inputs start amount and final amount and then interest and would out how many years it takes for the start amount to be at least final amount going by the users interest.

i understand the command

interest = double.parse(console.readline());

reads in the users input and converts it into double type but how do i get it to move the decimal to the right 2 places? because when i do

start = (start + (interest * start));


to work out the new amount of the start with the added interest it isnt correct because say 5% is going in as 5 and not 0.05?

thanks

Is This A Good Question/Topic? 0
  • +

Replies To: convert user input into a percentage value?

#2 crohnsandme  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 23
  • Joined: 17-July 12

Re: convert user input into a percentage value?

Posted 23 July 2012 - 04:47 AM

im very sorry i know how to do it now i just was overlooking it , i divided the user input by 100 which moves the decimal places across :) if someone wants to delete this thread please carry on thanks
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1