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
Purpose for a Phone....?
jeka94
Used to talk to people, chat with people on mobile.
5 0
2 years ago
Read 2 more answers
People who are reading this:
Gnom [1K]

Answer:

Awe thanks hun!

Explanation:

3 0
2 years ago
Read 2 more answers
Case project 5-1 Network Integration ​
oee [108]

Answer:

You need to explain the entire network layout first.

Explanation:

Bringing on new IT Staff can be time consuming.  But depending on the possession you need to explain to them how the domain lay out is.  

4 0
3 years ago
What is the first step in devising security services and mechanisms?
N76 [4]

Solution:

The first step in devising security services and mechanisms is to develop a security policy.

A security policy is a document that states in writing how a company plans to protect the company's physical and information technology (IT) assets. A security policy is often considered to be a "living document", meaning that the document is never finished, but is continuously updated as technology and employee requirements change. A company's security policy may include an acceptable use policy, a description of how the company plans to educate its employees about protecting the company's assets, an explanation of how security measurements will be carried out and enforced, and a procedure for evaluating the effectiveness of the security policy to ensure that necessary corrections will be made.

This is the required answer.

4 0
2 years ago
Read 2 more answers
What does "bbl" mean? my friend uses text slang all the time and i can never understand it unless it's lol.? please help!
Mariana [72]
<span>It means be back later :)</span>
5 0
3 years ago
Other questions:
  • Rachel uses a word processor to write short stories. However, most of her time is spent toying with the keys, rather than in wri
    13·2 answers
  • Whats the Sioux City school wifi?
    15·2 answers
  • why might a portrait be both a portrait of the subject and the photographer? how is a photographer present in a portrait?
    10·2 answers
  • The used of PPE in the shop includes the following, except:
    10·2 answers
  • How many miss Dragon Ball Abridged?
    5·2 answers
  • What techniques overcome resistance and improve the credibility of a product? Check all that apply.
    8·1 answer
  • Supplies/material used in iron​
    11·1 answer
  • Xxx<br>uuuuuu<br>uuuu<br>jjnmn<br>jjh
    12·1 answer
  • A Development team begins work on a new software application and decides to involve the client’s IT experts to ensure that secur
    12·1 answer
  • What is the answer for this
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!