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?
 
sarabandeConnect With a Mentor Commented:
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
 
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
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.