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]
2 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]2 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
White lines
kykrilka [37]

Answer:

Its B                                                                                                                                            

Explanation:

7 0
2 years ago
Read 2 more answers
In CadStd, what does the Zoom All button do? A. Makes a drawing bigger so you can see small details B. Returns a drawing to a si
Afina-wow [57]
I belive in CadStd that the zoom all button <span>makes a drawing bigger so you can see small details</span>
3 0
2 years ago
Which tasks can Kim complete using the Customize Ribbon dialog box? Check all that apply.
exis [7]

Answer:

Its A, B, C, and F

Explanation:

On edg

5 0
2 years ago
Write a function solution that given an array a of n integers (between -100 and 100), returns the sign (-1,0,1) of product of al
JulijaS [17]

left[0]=a[0];

for(int i=1;i<=n-1;i++)

   left[i]=(left[i-1]*a[i])%M;

right[n-1]=a[n-1];

for(int i=n-2;i>=0;i--)

   right[i]=(right[i-1]*a[i])%M;

for query q

   if(q==0)

       return right[1]%M;

   if(q==n-1)

       return left[n-2]%M;

   return (left[q-1]*right[q+1])%M;

4 0
2 years ago
How does technology improve productivity at home? (Select all that apply.)
Aliun [14]

Answer:

B, C

Explanation:

?

5 0
3 years ago
Other questions:
  • Match each logical function with its description. AND COUNTIF SUMIF IF tests for a certain condition and returns one of two valu
    7·1 answer
  • Match terms in the first column with the order descriptions in column two.
    11·1 answer
  • When you include a word cover page in a multi page document, the cover page is not considered the first page. True or false?
    13·1 answer
  • By generating and delivering timely and relevant information supported by networks, _____ creates new opportunities for conducti
    15·1 answer
  • (a) Convert to hexadecimal: 1457.1110. Round to two digits past the hexadecimal point.
    8·1 answer
  • THIS IS PYTHON QUESTION
    11·1 answer
  • The replacer parameter of the stringify method accepts a/an ______________ or an array.
    15·1 answer
  • How to understand amortized analysis potential?
    12·1 answer
  • What does it mean for a heap to be complete?
    7·1 answer
  • The courts can adjust the penalties in lawsuits to reflect the fact that infringements may be _____.
    5·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!