Warning: foreach() argument must be of type array|object, bool given in /var/www/html/web/app/themes/studypress-core-theme/template-parts/header/mobile-offcanvas.php on line 20

Problem 14

What are the advantages of problem analysis and algorithm design over directly writing a program in a high-level language?

Problem 15

Design an algorithm to find the weighted average of four test scores. The four test scores and their respective weights are given in the following format: testscore1 weight1 For example, sample data is as follows: 750.20 950.35 850.15 650.30

Problem 16

Design an algorithm to convert the change given in quarters, dimes, nickels, and pennies into pennies.

Problem 17

Given the radius, in inches, and price of a pizza, design an algorithm to find the price of the pizza per square inch.

Problem 18

A salesperson leaves his home every Monday and returns every Friday. He travels by company car. Each day on the road, the salesperson records the amount of gasoline put in the car. Given the starting odometer reading (that is, the odometer reading before he leaves on Monday) and the ending odometer reading (the odometer reading after he returns home on Friday), design algorithm to find the average miles per gallon. Sample data is as follows: \\[ 68723 \quad 71289 \quad 15.75 \quad 16.30 \quad 10.95 \quad 20.6530 .00 \\]

Problem 20

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: \\[ \sqrt{s(s-a)(s-b)(s-c)} \\] 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?

Problem 21

Suppose that the cost of sending an international fax is calculated as follows: Service charges \(\$ 3.00 ; \$ .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.

Problem 23

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 scores are below the average test score. c. Determines the highest test score. d. Prints the names of all the students whose test scores are 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 scores are 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 scores are the same as the highest test score. The main algorithm combines the solutions of the subproblems.)

Access millions of textbook solutions in one place

  • Access over 3 million high quality textbook solutions
  • Access our popular flashcard, quiz, mock-exam and notes features
  • Access our smart AI features to upgrade your learning
Get Vaia Premium now
Access millions of textbook solutions in one place

Recommended explanations on Computer Science Textbooks