Java Reference
In-Depth Information
For example, a sample data is as follows:
75 0.20
95 0.35
85 0.15
65 0.30
14. Given the radius, in inches, and price of a pizza, design an algorithm and
write the pseudocode to find the price of the pizza per square inch.
15. To make a profit, the prices of the items sold in a furniture store are marked
up by 80%. After marking up the prices each item is put on sale at a
discount of 10%. Design an algorithm to find the selling price of an item
sold at the furniture store. What information do you need to find the selling
price?
Suppose a, b, and c denote the lengths of the sides of a triangle. Then, the
area of the triangle can be calculated using the formula:
sðs aÞðs bÞðs cÞ
16.
p
where s ¼ (1/2)(a+b+c). Design an algorithm that uses this formula to
find the area of a triangle. What information do you need to find the area?
17. Suppose that the cost of sending an international fax is calculated as follows:
Service charges $3.00, $0.20 per page for the first 10 pages, and $0.10 for
each additional page. Design an algorithm that asks the user to enter the
number of pages to be faxed. The algorithm then uses the number of pages
to be faxed to calculate the amount due.
18. You are given a list of students' names and their test scores. Design an
algorithm that does the following:
a. Calculates the average test scores.
b. Determines and prints the names of all the students whose test score is
below the average test score.
c. Determines the highest test score.
d. Prints the names of all the students whose test score is the same as the
highest test score.
(You must divide this problem into subproblems as follows: The first
subproblem determines the average test score. The second subproblem
determines and prints the names of all the students whose test score is
below the average test score. The third subproblem determines the highest
test score. The fourth subproblem prints the names of all the students whose
test score is the same as the highest test score. The main algorithm combines
the solutions of the subproblems.)
Search WWH ::




Custom Search