4. To make telephone numbers easier to remember, some companies
use letters to show their telephone number. For example, using letters,
the telephone number 438-5626 can be shown as GET LOAN. In some
cases, to make a telephone number meaningful, companies might use
more than seven letters. For example, 225-5466 can be displayed as
CALL HOME, which uses eight letters. Write a program that prompts the
user to enter a telephone number expressed in letters and outputs the
corresponding telephone number in digits. If the user enters more than
seven letters, then process only the first seven letters. Also output the
– (hyphen) after the third digit. Allow the user to use both uppercase
and lowercase letters as well as spaces between words. Moreover, your
program should process as many telephone numbers as the user wants.
5
8.
Write a program that uses while loops to perform the following steps:
a. Prompt the user to input two integers: firstNum and secondNum
(firstNum must be less than secondNum).
b. Output all odd numbers between firstNum and secondNum.
c. Output the sum of all even numbers between firstNum and
secondNum.
d. Output the numbers and their squares between 1 and 10.
Copyright 2018 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-208
342 Chapter 5: Control Structures || (Repetition)
e. Output the sum of the square of the odd numbers between
firstNum and secondNum.
f. Output all uppercase letters.
The population of town A is less than the population of town B. How-
ever, the population of town A is growing faster than the population
of town B. Write a program that prompts the user to enter the popu-
lation and growth rate of each town. The program outputs after how
many years the population of town A will be greater than or equal to
the population of town B and the populations of both the towns at that
time. (A sample input is: Population of town A = 5,000, growth rate
of town A = 4%, population of town B = 8,000, and growth rate of
town B = 2%.)
20. When you borrow money to buy a house, a car, or for some other pur-
pose, you repay the loan by making periodic payments over a certain
period of time. Of course, the lending company will charge interest on
the loan. Every periodic payment consists of the interest on the loan
and the payment toward the principal amount. To be specific, suppose
that you borrow $1,000 at an interest rate of 7.2% per year and the
payments are monthly. Suppose that your monthly payment is $25.
Now, the interest is 7.2% per year and the payments are monthly, so
the interest rate per month is 7.2/12 = 0.6%. The first month’s interest
on $1,000 is 1000 X 0.006 = 6. Because the payment is $25 and the
interest for the first month is $6, the payment toward the principal
amount is 25 – 6 = 19. This means after making the first payment,
the loan amount is 1,000 – 19 = 981. For the second payment, the
interest is calculated on $981. So the interest for the second month
is 981 X 0.006 = 5.886, that is, approximately $5.89. This implies that
the payment toward the principal is 25 – 5.89 = 19.11 and the remain-
ing balance after the second payment is 981 – 19.11 = 961.89. This
process is repeated until the loan is paid. Write a program that accepts
as input the loan amount, the interest rate per year, and the monthly
payment. (Enter the interest rate as a percentage. For example, if the
interest rate is 7.2% per year, then enter 7.2.) The program then out-
puts the number of months it would take to repay the loan. (Note that
if the monthly payment is less than the first month’s interest, then after
each payment, the loan amount will increase. In this case, the program
must warn the borrower that the monthly payment is too low, and
with this monthly payment, the loan amount could not be repaid.)
(Apartment problem) A real estate office handles, say, 50 apartment
units. When the rent is, say, $600 per month, all the units are occupied.
However, for each, say, $40 increase in rent, one unit becomes vacant.
Moreover, each occupied unit requires an average of $27 per month for
maintenance. How many units should be rented to maximize the profit?
Write a program that prompts the user to enter:
The total number of units.
b. The rent to occupy all the units.
The increase in rent that results in a vacant unit.
d. Amount to maintain a rented unit.
The program then outputs the number of units to be rented to maxi-
mize the profit.
a.
c.

Purchase answer to see full
attachment




Why Choose Us

  • 100% non-plagiarized Papers
  • 24/7 /365 Service Available
  • Affordable Prices
  • Any Paper, Urgency, and Subject
  • Will complete your papers in 6 hours
  • On-time Delivery
  • Money-back and Privacy guarantees
  • Unlimited Amendments upon request
  • Satisfaction guarantee

How it Works

  • Click on the “Place Order” tab at the top menu or “Order Now” icon at the bottom and a new page will appear with an order form to be filled.
  • Fill in your paper’s requirements in the "PAPER DETAILS" section.
  • Fill in your paper’s academic level, deadline, and the required number of pages from the drop-down menus.
  • Click “CREATE ACCOUNT & SIGN IN” to enter your registration details and get an account with us for record-keeping and then, click on “PROCEED TO CHECKOUT” at the bottom of the page.
  • From there, the payment sections will show, follow the guided payment process and your order will be available for our writing team to work on it.