Question
1. Write a program to check if the following condition satisfies for a user input number: ABC = A! + B! + C! Example: 145
1.
Write a program to check if the following condition satisfies for a user input
number:
ABC = A! + B! + C!
Example: 145 = 1! + 4! + 5! = 1+24+120 = 145
(5
points)
2.
Suppose we can buy a chocolate bar from the vending machine for
$1 each
.
Inside every chocolate bar
,
there
is a coupon. We can redeem
7 coupons
for one
chocolate bar from the machine. We would like to know how many choc
olate
bars can be eaten, including those redeemed via coupon, if we have
n
dollars.
For example, if we have 20 dollars then we can initially buy 20 chocolate bars.
This gives us 20 coupons. We can redeem 14 coupons for 2 additional chocolate
bars. Thes
e two additional chocolate bars have 2 more coupons, so we now have
a total of 8 coupons when added to the six leftover from the original purchase.
This gives us enough to redeem for one final chocolate bar. As a result we now
have 23 chocolate bars and
2 leftover coupons.
Write a program that inputs the
number of dollars and outputs how many chocolate bars you can collect after
spending all your money and redeeming as many coupons as possible. Also
output the number of leftover coupons. The easiest
way to solve this problem is
to use a loop.
(10
points)
3.
A credit card company currently has three member levels, Platinum, Gold, and
Silver. Each credit card has a different interest rate:
Platinum member: 1% per month
Gold member: 2% per month
Silver member:
3% per month
If Platinum or Gold level customers make a late payment, then their interest rate for
the month doubles. For example, if a Platinum member is late, then his interest rate
increases from 1% to 2% for the month.
If a Silver level customer is
late on a payment, their interest rate does not increase.
Instead, they are assessed a flat $20 penalty for being late.
For this assignment, you will write a program that calculates the minimum payment,
which is 2% of the principle plus any interest and f
ees. You will also need to
calculate the percentage of the payment that goes to the principle. This is given by
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started