Author |
Message |
naqibaba
|
Posted: Thu Dec 10, 2009 11:22 pm Post subject: Increasing the number in the list and having the same number for a certain times in the list.!!!!! CONFUSING. |
|
|
The program is prompting the user for cash investment, interest rate, compounding period and term of investment in months.
The output should look like this. This is just a sample numbers, though the actual numbers will be entered by the teacher when he checks it.
The output should be:
initial amount: 10
interest rate: 12 (% which is 10*12/100=1.2 and 1.2/4 as quaterly is 0.30)
compounded: M,Q,S,A : Q
Term: Months 12
Months : investment : interest : total
1 10.00 .00 10.00
2 10.00 .00 10.00
3 10.00 .30 10.30
4 10.30 .00 10.30
5 10.30 .00 10.30
6 10.30 .30 10.60
7 10.60 .00 10.60
8 10.60 .00 10.60
9 10.60 .31 10.91
10 10.91 .00 10.91
11 10.91 .00 10.91
12 10.91 .32 10.23
...........................................................................................
The problem I am facing is How to show the same numbers in a list and increase them after 3 times as well as showing them for 3 times in the list. I am using for loop command but not really working out. Can Any one Help. This assignment is already late one day. I am really stuck. I will appreciate any kind of HELP.!
|
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
jbking
|
Posted: Fri Dec 11, 2009 2:11 pm Post subject: Re: Increasing the number in the list and having the same number for a certain times in the list.!!!!! CONFUSING. |
|
|
What specifically about a for loop isn't working out for you? Usually a for loop is used when you want something repeated a specific number of times.
|
|
|
|
|
![](images/spacer.gif) |
naqibaba
|
Posted: Sun Dec 13, 2009 3:16 am Post subject: Re: Increasing the number in the list and having the same number for a certain times in the list.!!!!! CONFUSING. |
|
|
Months are 1 to 12. Then Investment is 10.00 to 10.91 and interest increases from .00 quaterly at %12 and the last list is the total. My problem is to show the list like this. I only know how to increase them from one end to another but here everything is connected and I have to increase them by %12 quaterly. The investment was $10. Interest %12 quaterly means every 3 months. I am prompting the user for all these things I mean investment, Interest and term of investment(prompting the user to enter the months of their choice). This is so confusing. I hope you understood what I tried. YOu can reply to ask anything. Thank you.
|
|
|
|
|
![](images/spacer.gif) |
Tony
![](http://wiki.compsci.ca/images/f/f4/OniTony.gif)
|
Posted: Sun Dec 13, 2009 3:25 am Post subject: RE:Increasing the number in the list and having the same number for a certain times in the list.!!!!! CONFUSING. |
|
|
I'm guessing that you want to know which months are "quarter" months: 3, 6, 9, 12
You can either increment the for-loop by 3
code: |
for i: 1 .. 12 by 3
|
Or figure out if the counter variable is divisible by 3 using modulo operator.
|
Tony's programming blog. DWITE - a programming contest. |
|
|
|
![](images/spacer.gif) |
jbking
|
Posted: Sun Dec 13, 2009 3:27 pm Post subject: Re: Increasing the number in the list and having the same number for a certain times in the list.!!!!! CONFUSING. |
|
|
Are these really lists or merely the values of variables over time? There is a difference here as to my mind, as a list is a collection of multiple values within a single variable. The other option is merely printing out a few variables each time to be each row of output. While there is some complexity to this program, having an initial implementation to handle monthly or annual values and then handling the other cases, is my suggestion for an approach. End of quarter would be a month being divisible by 3 while semi-annual is a month being divisible by 6.
|
|
|
|
|
![](images/spacer.gif) |
naqibaba
|
Posted: Mon Dec 14, 2009 2:13 am Post subject: Re: Increasing the number in the list and having the same number for a certain times in the list.!!!!! CONFUSING. |
|
|
you can see the assignment here.
Description: |
That is how the out should be |
|
Filesize: |
180.44 KB |
Viewed: |
48 Time(s) |
![Picture 1.jpg](uploads/attachments/thumbs/t_picture_1_162.jpg)
|
|
|
|
|
|
![](images/spacer.gif) |
naqibaba
|
Posted: Mon Dec 14, 2009 2:15 am Post subject: Re: RE:Increasing the number in the list and having the same number for a certain times in the list.!!!!! CONFUSING. |
|
|
see the output assignment page and help out with it. This maybe easy.
|
|
|
|
|
![](images/spacer.gif) |
|