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
Mnenie [13.5K]
3 years ago
8

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

than the population 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
Computers and Technology
1 answer:
weeeeeb [17]3 years ago
6 0

Answer: The c++ program is given below.

#include <iostream>

using namespace std;

int main() {

float townA, townB, growthA, growthB, populationA, populationB;

    int year=0;    

cout<<"Enter present population of town A : ";

cin >> townA;  

cout<<endl<<"Enter present growth rate of town A : ";

cin >> growthA;

growthA = growthA/100;  

cout<<endl<<"Enter present population of town B : ";

cin >> townB;  

cout<<endl<<"Enter present growth rate of town B : ";

cin >> growthB;

growthB = growthB/100;  

do

{

    populationA = townA + (townA * growthA);

    populationB = townB + (townB * growthB);      

    townA = populationA;

    townB = populationB;      

    year++;      

}while(populationA < populationB);  

cout<<endl<<"After " <<year<< " years, population of town A is "<<populationA << " and population of town B is "<< population<<endl;

return 0;

}

Explanation:

All the variables for population and growth rate are declared with float datatype.

The user inputs the present population of both the towns.

The growth rate entered by the user is the percentage growth.

For example, town A has 10% growth rate as shown in the output image.

The program converts 10% into float as 10/100.

growthA = growthA/100;

growthB = growthB/100;

The above conversion is done to ease the calculations.

The year variable is declared as integer and initialized to 0.

The growth in population is computed in a do-while loop. After each growth is calculated, the year variable is incremented by 1.

The loop continues until population of town A becomes greater than or equal to population of town B as mentioned in the question.

Once the loop discontinues, the final populations of town A and town B and the years needed for this growth is displayed.

The new line is introduced using endl keyword.

The function main has return type int hence, 0 is returned at the end of the program.

You might be interested in
List out two ways to execute the script.​
castortr0y [4]

Answer:

1) Execute Shell Script Using File Name. Use the shell script file name to execute it either by using it's relative path or absolute path as shown below

2) Execute Shell Script Using Source Command.

7 0
3 years ago
Read 2 more answers
Sort short_names in reverse alphabetic order.
tangare [24]

lst = short_names.split()

print(sorted(lst,reverse = True))

6 0
3 years ago
Which of the following is a high-speed network dedicated to storage that connects different kinds of storage devices, such as ta
Montano1993 [528]

Answer:

SAN

Explanation:

A Storage Area Network (SAN) is a high-speed sub network of shared storage devices. A SAN's architecture works in a way that makes all storage devices available to all servers on a LAN or WAN. As more storage devices are added to a SAN, they too will be accessible from any server in the larger network.

8 0
3 years ago
What is the best software for game design
riadik2000 [5.3K]

The 2D Design Engines

10. Sploder

This program should be labeled a product for the very novice of game designers and developers. It features a very simple interface that can be used to make shooters and platformers. The custom game, which Sploder creates, always comes out as flash, which is arguably one of the best places to start anyway. It features a drag and drop interface, and your games can also be shared with other Sploder users, making it a community application.

9. RPG Maker XP

Yet another beginner program RPG Maker is well known all around the gaming community as an awesome place to start designing. It features many tropes of those old 16bit RPG games that were in the rage during the early 90’s. Along the way, the program usually holds your hand through the process of creating your world and story, which is also supplemented by countless FAQs and forums discussing the program.

8. Multimedia Fusion 2

For the fledgling designer who has more than a few games under their belt, Multimedia Fusion 2 is the next logical step in design. It contains and intricate system that details a lot of design when it comes to levels, characters, and actions. The design also allows for easy assignment of behaviors to objects, as everything can be done through dragging and a little bit of event planning. Overall, this is a powerful program that any designer should try out in the long run.

7. Construct Classic

Construct Classic shares a lot of the same tropes with easy to use designing software in that it is very easy to use. The classic version of this program boasts the ability to create Direct X titles with the addition of an awesome physics engine, even system, and fully realized pixel shader effects. The program is ideal for creating prototypes, but can also be used to make simple games.

6. Flixel

In terms of 2D game design, Flixel reigns supreme because of one very important fact. A created game with the Flixel engine can be distributed freely, with no need to purchase a license to distribute the said game. It also got one of the most supportive forums as the program is constantly updated with improved collision and even boxes, along with countless 2D objects.

The 3D Design Engines

5. UDK (Unreal Development Kit)

The Unreal Engine is an iconic design program, and there are tons of titles that prove the very same. It has been in use for so many years that no one can dispute how powerful it really is. At the same time, it’s a very good intermediate level design program, as it features a full 3D workspace where designs for levels and characters can all be made. Be forewarned though, this is a very professional program, and if you intend to create game, you’ll have to pay $100 plus royalties for each sale.

4. Blitz Max

For beginners that want to upgrade from 2D to 3D without too many hiccups, Blitz Max is the perfect tool to translate that journey. It features a very fundamental approach to 3D games design, buy at the same time, it doesn’t restrict the user in too many ways. In terms of graphical quality, don’t expect too much out of it as the aesthetics are based on the most fundamental designs.

3. Pygame

One of the reasons why Pygame is on this list is because it deals with the Python programming language. This makes it a very big contender as Python mostly belongs the PS3 format, and is a tricky language to master. However, this program, with the many countless tutorial books makes it easier to grasp every concept required in making games.

2. XNA Games Studio

XNA is the prime language you should pick if you’re really considering getting serious with games design and creation. The design program has countless different titles under its already well established repertoire, and that is still fast growing. However, you also have to be aware that the software is on the technical side of design, as you may see in games Spelunky or Magicka.

1. Unity3D

We can’t all be masters of programming languages, and certainly, not all of us have the ability to create game engines from scratch. This is basically the idea behind Unity 3D, and it upholds that same ideal very well because it takes a very hands-off approach to your design. There are many different tutorials on how you can get started on this engine, so starting now might be beneficial to you.

7 0
3 years ago
Read 2 more answers
Explain cell reference and its types with examples?​
skad [1K]

Answer:

There are two types of cell references: relative and absolute. Relative and absolute references behave differently when copied and filled to other cells. Relative references change when a formula is copied to another cell. Absolute references, on the other hand, remain constant, no matter where they are copied.

8 0
3 years ago
Other questions:
  • What are the example of dedicated computers?
    5·1 answer
  • Write a class named Averager containing: An instance variable named sum of type integer, initialized to 0. An instance variable
    6·1 answer
  • Technology progresses so new needs can be satisfied.<br><br> A. true<br><br> B. false
    12·2 answers
  • True or false. Every word has only one correct spelling and pronunciation.
    6·1 answer
  • A regular polygon is an n-sided polygon in which all sides are of the same length and all angles have the same degree (i.e.,the
    15·1 answer
  • Today's Apple Mac computers run with the same internal hardware as the Windows-based PC.
    10·2 answers
  • Ayuda no encuentro la información de estas tres preguntas:
    10·1 answer
  • 22
    15·1 answer
  • 12. In cell A14, use the INDEX function and structured references to display the value in the first row and first column of the
    8·1 answer
  • Dynamics simulate stillness via calculations performed by the computer.
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!