Problem Solving with C++ plus MyProgrammingLab with Pearson eText-- Access Card Package (9th Edition)
Problem Solving with C++ plus MyProgrammingLab with Pearson eText-- Access Card Package (9th Edition)
9th Edition
ISBN: 9780133862218
Author: Walter Savitch
Publisher: PEARSON
bartleby

Concept explainers

bartleby

Videos

Textbook Question
Book Icon
Chapter 3, Problem 6PP

The Fibonacci numbers F are defined as follows. F is 1, F is 1, and

Fi+2 = Fi + Fi+1

i = 0, 1, 2, … . In other words, each number is the sum of the previous two numbers. The first few Fibonacci numbers are 1, 1, 2, 3, 5, and 8. One place that these numbers occur is as certain population growth rates. If a population has no deaths, then the series shows the size of the population after each time period. It takes an organism two time periods to mature to reproducing age, and then the organism reproduces once every time period. The formula applies most straightforwardly to asexual reproduction at a rate of one offspring per time period.

Assume that the green crud population grows at this rate and has a time period of 5 days. Hence, if a green crud population starts out as 10 pounds of crud, then in 5 days there is still 10 pounds of crud; in 10 days there is 20 pounds of crud, in 15 days 30 pounds, in 20 days 50 pounds, and so forth. Write a program that takes both the initial size of a green crud population (in pounds) and a number of days as input, and that outputs the number of pounds of green crud after that many days. Assume that the population size is the same for 4 days and then increases every fifth day. Your program should allow the user to repeat this calculation as often as desired.

Blurred answer
Students have asked these similar questions
The equation of a line in standard form is ax + by = c , wherein both aand b cannot be zero, and a, b, and c are real numbers. If b≠0, then –a/b is the slope of the line. If a = 0, then it is a horizontal line, and if b = 0, then it is a vertical line. The slope of a vertical line is undefined. Two lines are parallel if they have the same slope or both are vertical lines. Two lines are perpendicular if either one of the lines is horizontal and the other is vertical or the product of their slopes is –1. Design the class lineType to store a line. To store a line, you need to store the values of a (coefficient of x), b (coefficient of y), and c. Your class must contain the following operations: If a line is nonvertical, then determine its slope. Determine if two lines are equal. (Two lines a₁x + b₁y = c₁ and a₂x + b₂y = c₂ are equal if either a₁ = a₂, b₁ = b₂, and c₁ = c₂, or a₁ = ka₂, b₁ = kb₂ and c₁ = kc₂, and for some real number k.) Determine if two lines are parallel. Determine if…
In the real world, functions are mathematical representations of input-output situations. A vending machine is one such example. The input is the money combined with the selected button. The output is the product. Here is another example: The formula for converting a temperature from Fahrenheit to Celsius is a function expressed as: C = (5/9)*(F - 32), where F is the Fahrenheit temperature and C is the Celsius temperature. If it is 77 degrees Fahrenheit in Phoenix Arizona, then what is the equivalent temperature on the Celsius thermometer? Our input is 77. C = (5/9)*(77 - 32) C = (5/9)*(45) C = 25 The equivalent temperature is 25 degrees Celsius. To complete the Discussion activity, please do the following: Choose your own function or choose from the list below and then provide a unique example of a function and evaluate the function for a specific input (like the example above). Arm length is a function of height. The circumference of a circle is a function of diameter. The height of…
The interest paid on a savings account is compounded daily. This means that if you start with startbal dollars in the bank, at the end of the first day you’ll have a balance ofstartbal * (1 + rate/365)dollars, where rate is the annual interest rate (0.10 if the annual rate is 10 percent). At the end of the second day, you’ll havestartbal * (1 + rate/365) * (1 + rate/365)dollars, and at the end of n days you’ll havestartbal * (1 + rate/365)ndollars. Write a program that processes a set of data records, each of which contains values for rate, startbal, and n and computes the final account balance.

Chapter 3 Solutions

Problem Solving with C++ plus MyProgrammingLab with Pearson eText-- Access Card Package (9th Edition)

Ch. 3.2 - What output will be produced by the following...Ch. 3.2 - Write a multiway if-else statement that classifies...Ch. 3.2 - Given the following declaration and output...Ch. 3.2 - Given the following declaration and output...Ch. 3.2 - What output will be produced by the following...Ch. 3.2 - What would be the output in Self-Test Exercise 15...Ch. 3.2 - What would be the output in Self-Test Exercise 15...Ch. 3.2 - What would be the output in Self-Test Exercise 15...Ch. 3.2 - Prob. 19STECh. 3.2 - Though we urge you not to program using this...Ch. 3.3 - Prob. 21STECh. 3.3 - Prob. 22STECh. 3.3 - What is the output of the following (when embedded...Ch. 3.3 - What is the output of the following (when embedded...Ch. 3.3 - Prob. 25STECh. 3.3 - What is the output of the following (when embedded...Ch. 3.3 - Prob. 27STECh. 3.3 - For each of the following situations, tell which...Ch. 3.3 - Rewrite the following loops as for loops. a.int i...Ch. 3.3 - What is the output of this loop? Identify the...Ch. 3.3 - What is the output of this loop? Comment on the...Ch. 3.3 - What is the output of this loop? Comment on the...Ch. 3.3 - What is the output of the following (when embedded...Ch. 3.3 - What is the output of the following (when embedded...Ch. 3.3 - What does a break statement do? Where is it legal...Ch. 3.4 - Write a loop that will write the word Hello to the...Ch. 3.4 - Write a loop that will read in a list of even...Ch. 3.4 - Prob. 38STECh. 3.4 - Prob. 39STECh. 3.4 - What is an off-by-one loop error?Ch. 3.4 - You have a fence that is to be 100 meters long....Ch. 3 - Write a program to score the paper-rock-scissor...Ch. 3 - Write a program to compute the interest due, total...Ch. 3 - Write an astrology program. The user types in a...Ch. 3 - Horoscope Signs of the same Element are most...Ch. 3 - Write a program that finds and prints all of the...Ch. 3 - Buoyancy is the ability of an object to float....Ch. 3 - Write a program that finds the temperature that is...Ch. 3 - Write a program that computes the cost of a...Ch. 3 - (This Project requires that you know some basic...Ch. 3 - Write a program that accepts a year written as a...Ch. 3 - Write a program that scores a blackjack hand. In...Ch. 3 - Interest on a loan is paid on a declining balance,...Ch. 3 - The Fibonacci numbers F are defined as follows. F...Ch. 3 - The value ex can be approximated by the sum 1 + x...Ch. 3 - Prob. 8PPCh. 3 - Prob. 9PPCh. 3 - Repeat Programming Project 13 from Chapter 2 but...Ch. 3 - The keypad on your oven is used to enter the...Ch. 3 - The game of 23 is a two-player game that begins...Ch. 3 - Holy digits Batman! The Riddler is planning his...
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Control Structure in Data Structure - Data Structures - Computer Science Class 12; Author: Ekeeda;https://www.youtube.com/watch?v=9FTw2pXLhv4;License: Standard YouTube License, CC-BY