coldfusion logic help

I need help coming up with the logic.

I have 2 classess that been purchased on the payment plan. (the payment plan options are: 4,6 ,9 payments plan).

Let say that course 1 was purchased on 4 payment plan option. The course is consists of 1 theoretical part and 7 practical .

When payment 1 is made no practical parts are released,
when payment 2 is posted 2 practical parts get open up
when payment 3 is posted 2 more practical parts open up
when payment 4 is posted 3 more  practical parts open up

Let say that course 2 was purchased on 4 payment plan option. The course is consists of 1 theoretical part and 3 practical .

When payment 1 is made no practical parts are released,
when payment 2 is posted 1 practical parts get open up
when payment 3 is posted 1 more practical parts open up
when payment 4 is posted 1 more  practical parts open up

Let say that course 3 was purchased on 6 payment plan option. The course is consists of 1 theoretical part and 7 practical .

When payment 1 is made no practical parts are released,
when payment 2 is posted 1 practical parts get open up
when payment 3 is posted 1 more practical parts open up
when payment 4 is posted 1 more  practical parts open up
when payment 5 is posted 2 more  practical parts open up
when payment 6  is posted 2 more  practical parts open up


and so on
LVL 19
erikTsomikSystem Architect, CF programmer Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

sarabandeCommented:
you can make a table from a structure where all these informations easily can be defined:

struct PayPlan
{
     int courseNo;
     int payopt;
     int theo;
     int pract;
     int  partsOpen[9];
};

PayPlan cp[] = 
//  no     plan  theo     prac    p1  p2   p3   p4   p5   p6  p7   p8   p9
 {
  {  1 ,    4,      1,      7,  {  0, -2,  +2, +3,   0,   0,   0,   0,  0 },  },
  {  2 ,    4,      1,      3,  {  0, -1,  +1, +1,   0,   0,   0,   0,  0 },  },
  {  3 ,    9,      1,      7,  {  0, -1,  +1, +1,  +2,  +2,   0,   0,  0 },  },  
    ....
};  

Open in new window


negative numbers for parts mean absolute number of parts opened, positive numbers mean "more" parts,

Sara
0
erikTsomikSystem Architect, CF programmer Author Commented:
looks good but how would I use this
0
sarabandeCommented:
unfortunately i am  c and c++ programmer and not familiar with coldfusion.

but i assume you would be able to translate the structure and table into coldfusion syntax.

if done, an incoming payment should trigger a function which

   - takes the course number and the payment number
   - searches for the course number in the payment table
   - if the course was found it checks whether the payment number is less or equal to the plan option
         - if yes,
                - compute the sum sp of parts already opened by a loop starting from p1 to pn_1
                  where pn_1 is the last parts-to-open before the current payment.
                 Always add the absolute parts.
               - the new number of parts to release is in pn
               - if sp >= theoretical parts all new parts are practical parts
               - else at least the first of the new parts of pn is a theoretical part and the rest (if any) are practical

(you may have only positive numbers for the parts to open in the payment table. don't see any need to differ between the initial number of parts to open and the 'more' parts).

Sara
1

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

erikTsomikSystem Architect, CF programmer Author Commented:
I took your advice and put it in the table
0
_agx_Commented:
When payment 1 is made no practical parts are released,
when payment 2 is posted 1 practical parts get open up
when payment 3 is posted 1 more practical parts open up
when payment 4 is posted 1 more  practical parts open up
when payment 5 is posted 2 more  practical parts open up
when payment 6  is posted 2 more  practical parts open up
Out of curiosity, how is the number released determined?
0
erikTsomikSystem Architect, CF programmer Author Commented:
Business logic
0
_agx_Commented:
No, I meant what exactly are the rules.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming

From novice to tech pro — start learning today.