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
marishachu [46]
3 years ago
11

Write a program that produces a bar chart showing the population growth of Prairieville, a small town in the Midwest, at 20-year

intervals during the past 100 years. The program should read in the population figures for 1900, 1920, 1940, 1960, 1980, and 2000 from a file named People.txt. It is understood that the first value represents the population in 1900 (for example, 2,843), the second the population in 1920 and so on. For each year it should display the year, followed by at least one space followed by a bar consisting of one asterisk for each 1,000 people. (The program should round UP so that a population of 1 would generate one asterisk -- as would 1000, while a population of 1,001 would generate two, etc.)
Computers and Technology
1 answer:
Sunny_sXe [5.5K]3 years ago
5 0

Answer:

#include <iostream>

#include <fstream>

using namespace std;

int main()

{

ifstream Inputfile;

Inputfile.open("People.txt"); // Open file

if (!Inputfile) // Test for open errors

{

cout << "Error opening file.\n";

return 0;

}

int Pop; // Population

// Display Population Bar Chart Header

cout << "PRAIRIEVILLE POPULATION GROWTH\n"

<< "(each * represents 1000 people)\n";

for (int Year = 1; Year <= 6; Year++)

{ // One iteration per year

switch (Year)

{

case 1 : cout << "1900 ";

break;

case 2 : cout << "1920 ";

break;

case 3 : cout << "1940 ";

break;

case 4 : cout << "1960 ";

break;

case 5 : cout << "1980 ";

break;

case 6 : cout << "2000 ";

break;

}

Inputfile >> Pop; // Read from file

// calculate one per 1000 people

//cout<<"**"<<Pop<<endl;

while(Pop > 0)

{ // Display one asterisk per iteration

// One iteration per 1000 people

cout << "*";

Pop -= 1000;

}

cout << endl;

}

Inputfile.close(); // To close file

return 0;

}

Explanation:

You might be interested in
Gunther is filling in his own input mask. He wants to format the Social Security numbers of his clients. The field must contain
kati45 [8]
Last one I am not sure they
4 0
3 years ago
Which relation is created with the primary key associated with the relationship or associative entity, plus any non-key attribut
konstantin123 [22]

Answer:

- Transform binary or unary M:N relationship or associative entity with its own key.

Explanation:

Transform binary relation is described as the method through which a decimal can easily be converted into binary while the unary relationship is described as a relationship in which both the two participants occurs from the same entity.

In the given case, 'transform binary or unary M:N relationship' can be created using 'the primary key linked with the relationship plus any non-key aspects of the relationship and the primary keys of the related entities' as it displays the existence of a relationship between the occurrences of a similar set of the entity i.e. associative entity here.

5 0
3 years ago
Write a query to show the price reduced by 10% for all products that are tables or entertainment centers with a standard price g
IceJOKER [234]

Answer:

Below is the required code:

Explanation:

SELECT Product_Finish AS "Desk Finish",

avg(Standard_Price) AS "Average Price"

FROM Product_T

WHERE "Average Price">200

ORDER BY "Average Price" DESC;

8 0
3 years ago
What is the different between 32bit anf 64 bit verision​
Elina [12.6K]

<u>The different between 32 bit and 64 bit version:​</u>

  • The main difference between 32-bit and 64-bit versions is that a 32-bit version can access 2^3^2 memory addresses which is roughly equivalent to 4 GB of memory.
  • On the other hand, a 64-bit version can access 2^6^4 memory addresses which equates to a huge amount of memory, 16 exabytes to be precise.  
  • Nowadays, we observe that almost all the computers have 64-bit processors, which means that they can access any amount of memory over 4 GB till 16 exabytes.
  • 64-bit processors have various advantages like the increased speed of operations, smooth multitasking and they can also support video games and software's that have high graphical requirements.
8 0
3 years ago
The java class library interface queue method tagg retrieves the entey at the front of a queue but themrows a NosuchElementExcep
SCORPION-xisa [38]

Answer:D) peek

Explanation:Peek operation or function is the method that is used for the returning of the values on the front of the queue or stack type datatypes.               This operation function over those datatypes having group or collection of the elements and does not eliminate any element from the queue.

NOsuchElemnet exception is shown when there is the peek operation in the queue for the element to be displayed on the top and no deletion can take place .Thus, the correct option is option(D).

5 0
3 years ago
Other questions:
  • Can a computer evaluate an expression to something between true and false? Can you write an expression to deal with a "maybe" an
    13·2 answers
  • HELP ASAP????? please
    5·2 answers
  • The ________ of the operating system enables users to communicate with the computer system. modem window network adapter card us
    14·1 answer
  • Lydia noticed that she feels tired and out of breath after walking her dog up a hill in the park. Which area of fitness does she
    8·1 answer
  • ________________ occur when a system produces incorrect, inconsistent, or duplicate data.
    6·2 answers
  • What is the value of the result after the following statement is executed? int result = 2 + 3 + 4 ;
    7·1 answer
  • Project manager Erica is discussing with her team to prepare a document to describe the deliverables and goals of a software pro
    13·1 answer
  • Select the correct answer.
    7·1 answer
  • Brainly not working for me not showing any ads or answers
    5·2 answers
  • Which of the following is NOT a method for applying the SDLC model?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!