1answer.
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
Anit [1.1K]
2 years ago
9

Assume that the population of Mexico is 114 million and that the population increases 1.01 percent annually. Assume that the pop

ulation of the United States is 312 million and that the population is reduced 0.15 percent annually. Write an application that displays the populations for the two countries every year until the population of Mexico excceds that of the United States, and display the number of years it took. Save file as Population.java.***NOTE**** This is my first class of java the program that I have to write has to be of what we have learned in the last 6 chapters it cannot have stuff that is way more advanced than the first 6 chapters.
Computers and Technology
1 answer:
AfilCa [17]2 years ago
6 0

Answer:

#include <bits/stdc++.h>

using namespace std;

// main function

int main()

{

// variables

   double mexico = 114;

   double usa = 312;

   double mexicoRate = .0101;

   double usaRate = .0015;

// calculate population after every year until mexico population exceed the usa populationn

   while (usa>mexico)

   {

// print the population

       cout<<"Mexico's population ::"<<mexico<<" million."<<endl;

       cout<<"USA's population ::"<<usa<<" million."<<endl;

// update the population

       mexico+=mexico*mexicoRate;

       usa-=usa*usaRate;

   }

return 0;

}

Explanation:

Declare and initialize mexico and usa with their initial population.Also declare and initial their increase and decrease rate.Find the population of both the  country each year until mexico population exceeds the usa population.

Output:

Mexico's population ::114 million.                                                                                          

USA's population ::312 million.                                                                                            

Mexico's population ::115.151 million.                                                                                      

USA's population ::311.532 million.

.

.

.

Mexico's population ::270.546million.                                                                                      

USA's population ::274.213 million.                                                                                        

Mexico's population ::273.278million.                                                                                      

USA's population ::273.802 million.

You might be interested in
Andy is trying to put together a holiday gift knapsack (with W=8) for Sarah. He has n items to choose from, each with infinitely
Sever21 [200]

Answer:

See explaination

Explanation:

Given 3 items: {w1 = 1, v1 = 3}, {w2 = 3, v2 = 2}, {w3 = 4, v3 = 3}

Hence OPT(1) = 3, OPT(3) = 2, OPT(4) = 3

Recursive formula for OPT(k) to minimize value is

OPT(k) = INFINITE if k <= 0

= min(3 + OPT(k-1), 2 + OPT(k-3), 3 + OPT(k-4))

Let us calculate OPT(1) to OPT(8)

OPT(1) = 3

OPT(2) = min ( 3 + OPT(1), 2 + OPT(-1), 3 + OPT(-2)) = 6

OPT(3) = 2

OPT(4) = 3

OPT(5) = min ( 3 + OPT(4), 2 + OPT(2), 3 + OPT(1)) = min(6, 8, 6) = 6

OPT(6) = min ( 3 + OPT(5), 2 + OPT(3), 3 + OPT(2)) = min(9, 4, 9) = 4

OPT(7) = min ( 3 + OPT(6), 2 + OPT(4), 3 + OPT(3)) = min(7, 5, 5) = 5

OPT(8) = min ( 3 + OPT(7), 2 + OPT(5), 3 + OPT(4)) = min(8, 8, 6) = 6

3 0
3 years ago
Describe encryption at gateways in thePresentation layer of the OSI Reference Model
puteri [66]

Answer:  

In the presentation layer of the OSI reference model provides a variety of coding and functions that can be applied in application layer data. Information send by the application layer are ensured by these functions. As, presentation layer is the important layer in the OSI reference model because it is responsible for important services like  data compression, data conversion, decryption and encryption.

Encryption at gateway is defined as, when the important data is first encrypted using protocol and then it is transferred in the network. And gateway re-director operates in the presentation layer.

4 0
2 years ago
A simple C program to find the logarithm of any number in any base.....​
elena-s [515]

Answer:

tera bur mast hai jwjvszvVbzNjz

8 0
2 years ago
Is using abbreviations and symbols in social media a problem? Why or why not?
Ugo [173]
The correct answer is..A? 
5 0
3 years ago
In Microsoft PowerPoint, a _____ gives viewers a visual image of data, such as a line graph or a three-
Vera_Pavlovna [14]

Answer:

graph

Explanation:

I don't know anything else that would be a visual representation of data.

5 0
3 years ago
Other questions:
  • The North American Free Trade Agreement (NAFTA) among Canada, Mexico, and the United States is intended to _____.
    5·2 answers
  • Who usually signs a collection letter?
    15·2 answers
  • Carson's supervisor has asked him to review a variety of portable computers for possible purchase for their company's employees.
    13·1 answer
  • What is a step by step procedure written to carry out a task?
    11·1 answer
  • Public static String doSomething(String s) { final String BLANK = " "; //BLANK contains a single space String str = ""; //empty
    6·1 answer
  • Count positive and negative number and compute the average. The program will have the user input an unspecified number of intege
    6·1 answer
  • What is the output of the code snippet given below?string s = "abcde";int i = 1;while (i &lt; 5){ cout &lt;&lt; s.substr (i, 1);
    11·1 answer
  • What is a simulation?
    5·2 answers
  • The transmission control protocol (TCP) layer helps computers to communicate in which of the following ways?
    10·1 answer
  • I WILL MARK IT BRAINLIEST FOR SURE ☺️❤️
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!