| CS 199 | Willamette University | Spring, 2019 |
|
Programming in PHP, Databases with MySQL, and Web Applications |
||
Develop a Web page and css style sheet (with editing only from a simple editor). Although the content of your page is completely up to you, your page must include the following elements:
<!--
Name:
Campus Mailbox:
Assignment Name:
Assignment Due Date:
Academic honesty certification:
Written/online sources used:
[include textbook(s), course labs or readings,
give complete citations for Web or other written sources
write "none" if no surces used]
Help obtained:
Following the class policies, I understand that I am not
allowed to discuss this problem with anyone, except the instructor
My signature below confirms that the above list of sources
is complete AND that I have not talked to anyone else
about this problem
-->
In submitting this problem, please include the following (printed on paper).
A baby sitter charges $8.75 per hour until 9:00 pm (while the kids are still up), $6.50 per hour between 9:00 pm and midnight, and $9.25 per hour after midnight (since late night baby sitting interferes with morning classes).
Write a program that reads four integer values (the sitter's starting time in hours and minutes and the ending time in hours and minutes) and computes the sitter's fee. Assume all times are between 6:00 pm and 6:00 am, and hours should be specified as being between 0 and 12 (inclusive). Hours outside the range of 0 to 12 should be considered invalid.
The following table may clarify allowed time values for this problem.
| Starting | Starting | Ending | Ending | Starting | Ending |
|---|---|---|---|---|---|
| Hour | Minutes | Hour | Minutes | Time | time |
| 8 | 0 | 3 | 30 | 8:00pm | 3:30am |
| 6 | 0 | 0 | 45 | 6:00pm | 12:45am |
| 12 | 0 | 6 | 0 | 12:00am (midnight) | 6:00am |
Programming Note: You may NOT use loops or recursion in this program.
When investigating a loan, a customer typically states the amount of money (loanAmount) and specifies the loan's length (number of months N). A bank or other lender proposes an annual interest rate (annRate) for the loan. With this information, the monthly payment for the loan is given by the formulae:
monthlyRate = annRate / 1200.0
payment = loanAmount * monthlyRate / (1.0 - (1 + monthlyRate)(-N))
For example, a loan to purchase a house might involve $26,000 for 25 years (300 months) at an annual rate of 8.75%, yielding a monthly payment of $213.76.
The expectation is that the customer will pay this amount (in dollars and cents) each month, although a slight adjustment may be needed the last month to make up for any rounding in the computation.
The expected payment notwithstanding, the terms of many loans allow the customer to pay an additional amount for one or more months in order to shorten the length of the loan and possibly save some interest charges. This problem investigates the consequences of paying twice the required amount for the first few months.
More specifically, your work for this problem should have these elements:
pow ((1 + monthlyRate), -N)
Although not particularly efficient, this approach will suffice for now
(See me about alternatives, if you have time and interest.)