answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Marina86 [1]
2 years ago
13

The population of town A is less than the population of town B. However, the population of town A is growing faster than the pop

ulation of town B. Write a program that prompts the user to enter: The population of town A The population of town B The growth rate of town A The growth rate of town B The program outputs: After how many years the population of town A will be greater than or equal to the population of town B 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%.)
Computers and Technology
1 answer:
defon2 years ago
3 0

Answer:

#include<iostream>

using namespace std;

void main()

{

int townA_pop,townB_pop,count_years=1;

double rateA,rateB;

cout<<"please enter the population of town A"<<endl;

cin>>townA_pop;

cout<<"please enter the population of town B"<<endl;

cin>>townB_pop;

cout<<"please enter the grothw rate of town A"<<endl;

cin>>rateA;

cout<<"please enter the grothw rate of town B"<<endl;

cin>>rateB;

while(townA_pop < townB_pop)//IF town A pop is equal or greater than town B it will break

{

townA_pop = townA_pop +( townA_pop * (rateA /100) );

townB_pop = townB_pop +( townB_pop * (rateB /100) );

count_years++;

}

cout<<"after "<<count_years<<" of years the pop of town A will be graeter than or equal To the pop of town B"<<endl;

}

Explanation:

You might be interested in
Write the 8-bit signed-magnitude, two's complement, and ones' complement representations for each decimal number: +25, + 120, +
pshichka [43]

Answer:

Let's convert the decimals into signed 8-bit binary numbers.

As we need to find the 8-bit magnitude, so write the powers at each bit.

      <u>Sign -bit</u> <u>64</u> <u>32</u> <u>16</u> <u>8</u> <u>4</u> <u>2</u> <u>1</u>

+25 - 0 0 0 1 1 0 0 1

+120- 0 1 1 1 1 0 0 0

+82 - 0 1 0 1 0 0 1       0

-42 - 1 0 1 0 1 0 1 0

-111 - 1 1 1 0 1 1 1 1

One’s Complements:  

+25 (00011001) – 11100110

+120(01111000) - 10000111

+82(01010010) - 10101101

-42(10101010) - 01010101

-111(11101111)- 00010000

Two’s Complements:  

+25 (00011001) – 11100110+1 = 11100111

+120(01111000) – 10000111+1 = 10001000

+82(01010010) – 10101101+1= 10101110

-42(10101010) – 01010101+1= 01010110

-111(11101111)- 00010000+1= 00010001

Explanation:

To find the 8-bit signed magnitude follow this process:

For +120

  • put 0 at Sign-bit as there is plus sign before 120.
  • Put 1 at the largest power of 2 near to 120 and less than 120, so put 1 at 64.
  • Subtract 64 from 120, i.e. 120-64 = 56.
  • Then put 1 at 32, as it is the nearest power of 2 of 56. Then 56-32=24.
  • Then put 1 at 16 and 24-16 = 8.
  • Now put 1 at 8. 8-8 = 0, so put 0 at all rest places.

To find one’s complement of a number 00011001, find 11111111 – 00011001 or put 0 in place each 1 and 1 in place of each 0., i.e., 11100110.

Now to find Two’s complement of a number, just do binary addition of the number with 1.

6 0
1 year ago
Explain why each of the following names does or does not seem like a good variable name to represent a state sales tax rate.
tatyana61 [14]

a. stateTaxRate  - A good variable name because it represents what it holds, the state sales tax rate, without being too wordy. Also correctly capitalized in camelcase.

b. txRt  - A bad variable name because while short and simple, it is too hard to understand what the variable represents.

c. t  - A very bad variable name if you plan on using the variable often. Far too short and you will forget what it represents and is needed for.

d. stateSalesTaxRateValue  - A bad variable name because it is just too wordy. Cutting it down to A's variable name is much more reasonable

e. state tax rate  - A bad variable name and probably invalid because it has spaces in the name.

f. taxRate  - A good variable name if there are no other tax calculations other than state tax rate. Otherwise you would confuse state vs local tax rate or something, making it a bad variable name.

g. 1TaxRate  - A bad variable name because the number 1 has no reason being in the variable name. It doesn't add anything to the name.

h. moneyCharged - A bad variable name because it is not specific enough in explaining why the money is being charged and what for.

7 0
2 years ago
The vast amount of data collected from Internet searches, social media posts, customer transactions, military
Brums [2.3K]

Answer:

A. Big Data

Explanation:

It is big data. The internet searches, customer transactions, social media posts, medical tests, weather sensors, military surveillance, and all the data source you are seeing around yourself forms together with the big data. And a big social media company gathers around so many petabytes of data each day. And there are so many such companies, plus all sorts like eLearning sites, etc. And all these together form the big data.

3 0
2 years ago
Write an if-else statement to describe an integer. Print "Positive even number" if isEven and is Positive are both true. Print "
Nina [5.8K]

Answer:

C code explained below

Explanation:

#include <stdio.h>

#include <stdbool.h>

int main(void) {

int userNum;

bool isPositive;

bool isEven;

scanf("%d", &userNum);

isPositive = (userNum > 0);

isEven = ((userNum % 2) == 0);

if(isPositive && isEven){

  printf("Positive even number");

}

else if(isPositive && !isEven){

  printf("Positive number");

}

else{

  printf("Not a positive number");

}

printf("\n");

return 0;

}

6 0
1 year ago
JAVA...Write a statement that calls the recursive method backwardsAlphabet() with parameter startingLetter.
scoray [572]

Answer:

RecursiveCalls.backwardsAlphabet(startingLetter);

Explanation:

The statement that is needed is a single-line statement. Since the class RecursiveCalls is already in the same file we can simply use that class and call its function without making a new class object. Once we call that class' function we simply pass the variable startingLetter (which is already provided) as the sole parameter for the function in order for it to run and use the letter 'z' as the starting point.

       RecursiveCalls.backwardsAlphabet(startingLetter);

3 0
1 year ago
Other questions:
  • What is one effective way for employees to keep their skillsets current?
    8·2 answers
  • The term load is often used to describe opening a page in a ____. Answer
    11·1 answer
  • Using information from the lesson, explain how new technologies change your experience as a consumer.
    5·2 answers
  • What is a typical grace period for a credit card...
    15·2 answers
  • Static packet filtering firewalls are limited to ________. inspecting packets for which there are good application proxy filteri
    8·1 answer
  • Suppose your name was George Gershwin. Write a complete program that would print your last name, followed by a comma, followed b
    11·2 answers
  • Samuel received an email that looked like it came from his bank. The email told him to click a link that opened an official look
    7·1 answer
  • Produce a list named prime_truths which contains True for prime numbers and False for nonprime numbers in the range [2,100]. We
    11·1 answer
  • The PictureBook class is a subclass of the Book class that has one additional attribute: a String variable named illustrator tha
    9·1 answer
  • #Write a function called string_finder. string_finder should #take two parameters: a target string and a search string. #The fun
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!