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
A string is represented as an array of characters. If you need to store an array of 5 strings with the maximum length of a strin
erastova [34]

Answer:

char str[5][100]

Explanation:

See attachment for options:

From the options, we can see that the programming language is C language.

The syntax to store an array of m strings with a maximum of n elements in C is:

char array-name[m][n]

In this case:

m = 5 --- Number of strings in the array

n = 100 --- Maximum character in each string

Assume the array name is str, the syntax can be expressed as:

char str[5][100]

3 0
2 years ago
Which best describes an advantage of conceptual notes? They are great for studying vocabulary terms. They help students memorize
larisa86 [58]

Answer:

They make it easy to quickly see relationships between ideas.

Explanation:

A concept is an idea or a principle that could be used to understand an abstract notion. A conceptual note is one that makes the relationship between ideas easily discernible.

Without breaking much sweat or reading too deeply, the reader would find it easier to easily determine the relationship between ideas and how they relate to the subject matter. Conceptual notes can be taken on a laptop or paper.

5 0
2 years ago
Read 2 more answers
What is the process to correct a single spelling mistake that has been indicated by the spelling checker in PowerPoint Online?
marshall27 [118]
I’m not to sure what this is asking, if by selecting word- it means the word is already left-click selected, so it would be option 3. If not, then it would be option 2 I believe
6 0
3 years ago
Cloud vendors that are hosting hardware, operating system, database, and other software, which clients can then use to build the
iren2701 [21]

Answer:

a. Software as a Service.

Explanation:

These Cloud vendors are said to be providing Software as a Service. This is because regardless of that the underlying specs are in regards to hardware, operating systems, database, etc. The vendor is selling a subscription to their cloud software which bundles all of these services together. Therefore, what they are ultimately providing is a Software that the individual can use as a service, and enjoy all of the included benefits/capabilities.

8 0
2 years ago
Can someone please answer this for me ? What is data centre virtualization?
castortr0y [4]
Data center virtualization is the process of designing, developing and deploying a data center on virtualization and cloud computing technologies. It primarily enables virtualizing physical servers in a data center facility along with storage, networking and other infrastructure devices and equipment.
3 0
3 years ago
Other questions:
  • If it can be applied, the least-damaging recovery option is ________.
    10·1 answer
  • Give two examples of non printing characters
    6·1 answer
  • Peter has recently bought a media player and a digital camera he wants to buy a memory card and then use devices which memory do
    11·2 answers
  • I need urgent help. which of these network has minimum data loss. a. LAN b. MAN c. WAN ​
    11·1 answer
  • BRAINLIEST !!A game design document is like a diary for game developers.
    11·1 answer
  • What are minimum computer requirements for a software program?
    5·1 answer
  • Two categories of payroll deductions are required deductions and ___ deductions.
    9·2 answers
  • Various gabs in the digital divide​
    8·1 answer
  • I love my baby boy and can someone help me with this
    6·1 answer
  • Defination of formula bar​
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!