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
laila [671]
3 years ago
12

Walmart store wants to compare the sales of five of its stores. Write a complete program to ask the user to enter the sales for

5 stores. Create a bar chart displaying stars representing the sale amount for the day. must follow the requirements main method calls the print method. a for loop is required print method accepts an integer as its parameter representing the sale for the day. display stars based on the sale. one star represents $100 sale. a for loop is required Sample output:

Computers and Technology
1 answer:
marysya [2.9K]3 years ago
8 0

Answer:

Here is the C++ program.

#include <iostream>  //to use input output functions

using namespace std;   //to identify objects cin cout

   void print(int sales){   //method that accepts integer as its parameter representing the sale for the day

          for(int i=0;i<(sales/100);i++){  //loop to create a bar chart

           cout<<"*";   }   }  //prints stars representing the sale amount for the day

   int main(){          

       int sales1;    // stores the sales of store 1

       int sales2;    // stores the sales of store 2

       int sales3;    // stores the sales of store 3

       int sales4;     // stores the sales of store 4

       int sales5;    // stores the sales for store  5    

       

       cout<<"Enter the sales for store 1: ";  //prompts user to enter sales for store 1

       cin >>sales1;  //reads the value of sales for store 1 and stores it in sales1

       print(sales1);  //calls print method to display start representing the sales amount for the day for store 1

       cout<<"\nEnter the sales for store 2: ";  //prompts user to enter sales for store 2

     cin >>sales2;  //reads the value of sales for store 2 and stores it in sales2

       print(sales2); //calls print method to display start representing the sales amount for the day for store 2

       cout<<"\nEnter the sales for store 3: ";  //prompts user to enter sales for store 3

     cin >>sales3;  //reads the value of sales for store 3 and stores it in sales3

       print(sales3);  //calls print method to display start representing the sales amount for the day for store 3

       cout<<"\nEnter the sales for store 4: ";  //prompts user to enter sales for store 4

     cin >>sales4;  //reads the value of sales for store 4 and stores it in sales4

       print(sales4);  //calls print method to display start representing the sales amount for the day for store 4

       cout<<"\nEnter the sales for store 5: ";  //prompts user to enter sales for store 5

     cin >>sales5;  //reads the value of sales for store 5 and stores it in sales5

       print(sales5);     } //calls print method to display start representing the sales amount for the day for store 5

Explanation:

The program is well explained in the comments attached with each line of the program. Lets say user enters 100 as sales for store 1. Then the for loop works as follows:

for(int i=0;i<(sales/100);i++)

At first iteration:

i = 0

i<(sales/100) is true because 0 is less than 100/100 = 1

so the program moves to the body of loop which has the statement:

cout<<"*"

This prints one asterisk one output screen. Next the loop breaks when i = 1. So this only prints one asterisk in output since one star represents $100 sale. The screenshot of the program along with its output is attached.

You might be interested in
Explain how data structures and algorithms are useful to the use of computer in data management<br>​
laiz [17]

Answer:

programmers who are competent  in data  structures and algorithms  can easily perform the tasks related  to data processing ,automated reasoning ,or calculations . data structure and algorithms  is significant  for developers  as it shows their problems solving abilities amongst the prospective employers .

5 0
3 years ago
You can add additional design elements to a picture by adding a color background, which is accomplished by using what Paint feat
katrin2010 [14]

Answer:

Fill with Color tool

6 0
3 years ago
What is Microsoft Word an application used for word-processing, an example of?
LuckyWell [14K]

Microsoft word is an example of a graphical word program

7 0
3 years ago
An online museum is creating a site hosting hundreds of thousands of digital representations of art from around the world. The w
Firdavs [7]

Answer:

A. the museum can choose a heuristic approach which will achieve a lossless compression, but they cannot be sure that it is the most efficient compression for each image

C. algorithms for lossless compression exist, so the museum can use those to compress the image

Explanation:

4 0
3 years ago
Contast between backups controlled within the SAN and backups controlled from the application server.
luda_lava [24]

Answer and Explanation:

Backup control within the SAN is one which confines the backup to the SAN and does not pass it via corporate network.

Backup traffic within the SAN are  easier to maintain and easily handled in contrast to the application server.

Backup in SAN is governed by  such applications and mechanism which allows the easy handling of the backup traffic which is not provided by the application servers.

In case of occurrence of any failure,  unlike application server, SAN provides smooth and fast migration

SAN holds data in cluster  by the use of backup techniques not used in application server.

6 0
3 years ago
Other questions:
  • 1. Jesse wants a recommendation about creating an SCR help desk. She said that I can find lots of information about help desks o
    7·1 answer
  • What can help you best learn about appearance, habitats and behaviors of birds in your area
    9·1 answer
  • What tasks does google do?
    5·1 answer
  • In a non-formatted/standard template, if the number 25 is converted to text format, the
    14·1 answer
  • You have been asked to create a query that will join the Production.Products table with the Production.Categories table. From th
    6·1 answer
  • What should be used to screw on broadheads? needle-nose pliers gloves thumb and forefinger only specially designed wrench
    6·1 answer
  • What are some of these new iPad extras? One is the iMarker. Crayola teamed up with another company to make it. It costs $29.99.
    8·1 answer
  • In this section of your final project, you will write a basic script to create and back up files. You will create this script wi
    11·2 answers
  • A record is a specific piece of information state true or false​
    12·1 answer
  • Use python
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!