- From the textbook: page 142, self-check exercises #1 and #2.
- Write a program that generates a company letterhead using three functions.
The first function prints the standard company letterhead.
The second function prints a statement indicating that the account is past due.The third function prints a closing statement.
Here is a sample of an output
Seven Monkeys Co.,
Animal Club
Savana, Africa
Dear Mr./Mrs Zombie:
Your account is past due. We appreciate your prompt payment.
Sincerely,
Lionnet K.
- Write a program asking the user to enter two numbers (integer or float).
The program then calls one function that adds the numbers and another function
that substracts them.
The numbers are passed as parameters to the functions which return their
sum and difference.
The program displays the sum and difference of the two numbers.
Here is a sample of an input/output
Enter two numbers: 231 78
The sum is: 308
The diff is: 153
Note: Use any combination of integers and float to test your program.
- Write a function to compute the monthly loan payment
as follows. The function accepts three parameters: the amount of a
loan (principal), the number of months a payment is to be made
(period), and the annual interest rate as a decimal.
The function should calculate and return the monthly payment.
In general most of the banks use the following formula :
monthly payment = (rate × principal/12)/ (1 - (1 + rate/12)-period)
Write a driver program to test this function.