In: Computer Science
Assignment 2- 9 USING A FOR LOOP
Create a PL/SQL block using a FOR loop to generate a payment schedule for a donor’s pledge, which is to be paid monthly in equal increments. The values variable for the block is starting payment due date, monthly payment amount, and a number of total monthly payments for the pledge. The list that’s generated should display a line for each monthly payment showing payment number, date due, payment amount, and donation balance (remaining amount of pledge owed).
Assignment 2 – 10 USING A BASIC LOOP
Accomplish the task in Assignment 2-9 above by using a basic loop structure.
Assignment 2 – 11 USING A WHILE LOOP
Accomplish the task in Assignment 2-9 by using a WHILE loop structure. Instead of displaying the donation balance (remaining amount of pledge owed) on each line of output, display the total paid to date.
Assignment 2 – 12 USING A CASE EXPRESSION
Donors can select one of three payment plans for a pledge indicated by the following codes: 0 = one-time (lump sum) payment, 1 = monthly payments over one year, and 2 = monthly payments over two years. A local business has agreed to pay matching amounts on pledge payments during the current month. A PL/SQL block is needed to identify the matching amount for a pledge payment. Create a block using the input values of a payment plan code and a payment amount. Use a CASE expression to calculate the matching amount, based on the payment plan codes 0 = 25%, 1 = 50%, 2 = 100%, and other = 0. Display the calculated amount.
Assignment 2 – 13 USING NESTED IF STATEMENTS
An organization has committed to matching pledge amounts based on the donor type and pledge amount. Donor types include I = Individual, B = Business organization, and G = Grant funds. The matching percents are to be applied as follows:
Donor Type |
Pledge Amount |
Matching (%) |
I |
$100-$249 |
50% |
I |
$250-$499 |
30% |
I |
$500 or more |
20% |
B |
$100-$499 |
20% |
B |
$500-$999 |
10% |
B |
$1,000 or more |
5% |
G |
$100 or more |
5% |
Create a PL/SQL block using nested IF statements to accomplish the task. The input value for the block is the donor type code and the pledge amount.