Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

Problem:

Question- Write a C++ program which calculates and displays each year's population of egrets based of some user input and the following formula:

NextYr = Rate ? CurrentYr ? (1 ? CurrentYr) 1000000

where CurrentYr is the current egret population, NextYr is the population one year later, and Rate can be thought of as the “growth rate” and can have a value between 0 and 4.

Requirements:

a. The program must read input from the user for the initial value of CurrentYr. Valid input for this value is an integer greater than 0 and less than 1000000.

b.  The program must read input from the user for the value of Rate. Valid input for this value is a real number greater than 0 and less than 4.

c. For each of the values which the user must enter (CurrentYr and Rate), if any invalid input (including negative numbers) is entered, then a message informing the user of the valid ranges must be displayed and the user be given a second chance to enter the number. If invalid input is entered on the second chance then the program must terminate with a message that the input can’t be used and without doing any population change calculations.

d. The program is only required to work if an integer is entered by the user for CurrentYr and a numeric value is entered for Rate – i.e. you can assume that the correct type of input is obtained although you must check whether or not it is in the valid range.

e. The program must display the initial population entered by the user (as year 0), followed by the population for each of the next 25 years found by applying the formula above, in the format shown in the sample run below.

f.  If the calculated value for NextYr includes a fractional part, the fractional part must be dropped.

g. The numbers must be right-aligned in their columns as shown in the sample run.

 

Please write the code that calculates and displays each year's population.

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M91174039

Have any Question?


Related Questions in Computer Engineering

Short answer1 what is the difference between a logic error

Short Answer 1. What is the difference between a logic error and a syntax error? 2. Define and discuss the difference between unary, binary and ternary operators. Give an example of each. 3. When must you use curly brace ...

Question what are some of the specifics of a dbms that must

Question : What are some of the specifics of a DBMS that must be taken into consideration when building a database design? The response must be typed, single spaced, must be in times new roman font (size 12) and must fol ...

Penetration testing is a technique used to identify

Penetration testing is a technique used to identify security weaknesses in your network. Discuss a type of penetration testing and the different methods utilized to recognize vulnerabilities in your network.

Assignment 1 accessibilitybuilding a user interface that

Assignment 1: Accessibility Building a user interface that meets the needs of a diverse population can be incredibly difficult. Research the best practices for developing a universally usable interface, as well as some o ...

Question suppose a new standard the iddd-643 standard is

Question Suppose a new standard, the IDDD-643 standard, is developed for storing numbers in a string of 16 bits. The first bit is used for the sign of the number (0 if positive and 1 if negative). The next 5 bits store t ...

Question cybersecurity policy design issues1describe

Question: Cybersecurity Policy Design Issues 1. Describe cybersecurity roles and responsibilities to protect security for the corporate business mission (for example, the Insider threat, Access Controls, Biometric Authen ...

In this project you will format a document you will select

In this project, you will format a document. You will select and format text and then use the Find and Replace command to correct errors in the document. You will convert text to a numbered list as well as a bulleted lis ...

Calculate the standard gibbs free energy change and the

Calculate the standard Gibbs free energy change and the equilibrium constant for the oxidation of a formate ion to carbon dioxide at pH=7 and room temperature.

In terms of reducing the total number of memory accesses a

In terms of reducing the total number of memory accesses a program might require. Using the arithmetic expression S = (A+B)-(C+D), support this statement.

Run a c code to solve the following problemsuppose that you

Run a C code to solve the following problem: Suppose that you are planning to pay $14500 yearly for 4 years for a car which is $50000 now what would be the interest rate? You may follow the bellow formula: P=A((1+i)^n-1) ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As