12. Bar Chart Write a program that asks the user to enter today’s sales for five stores. The program should display a bar chart comparing each store’s sales. Create each bar in the bar chart by displaying a row of asterisks. Each asterisk should represent $100 of sales. Here is an example of the program’s output: Enter today's sales for store 1: 1000 [Enter] Enter today's sales for store 2: 1200 [Enter] Enter today's sales for store 3: 1800 [Enter] Enter today's sales for store 4: 800 [Enter] Enter today's sales for store 5: 1900 [Enter] SALES BAR CHART Store 1: ********** Store 2: ************ Store 3: ****************** Store 4: ******** Store 5: *******************
Using array and loops to re-do Programming Challenge 12 (enclosed in this document) in Chapter 4 so that duplicate or similar code is minimized.
Hi,
please find the code below.
(since programming language isn't mentioned I have used c++ )
#include <iostream>
#include <stdlib.h> // to use div_t
using namespace std;
int main()
{
int todaysSales[5];
int i,j;
int valOfEachAsterisk=100;
string a = "*";
div_t divresult;
/* initializing elements of array todaysSales */
for ( i = 1; i<=5; i++ )
{
cout << " Enter today's sales for
store " << i << ":" << endl;
cin >> todaysSales[i];
}
for (int j = 1; j <= 5; j++)
{
string c;
divresult = div(todaysSales[j],valOfEachAsterisk);
for(int p=1;p<=divresult.quot;p++)
{
c+=a;
}
cout << "Store" << j << ":"<< c <<
endl;
}
return 0;
}
output:

kindly upvote
12. Bar Chart Write a program that asks the user to enter today’s sales for five...
Assignment: Write a program that asks the user to enter today’s sales for five stores. The program should then display a bar chart comparing each store’s sales. Create each bar in the bar chart bydisplaying a row or asterisks. Each asterisk should represent $100 of sales. You must use a loop to print the bar chart. If the user enters a negative value for the sales amount, the program will keep asking the user to enter the sales amount until...
Question 1 and 2 ... Visual Basic
dlear the contents of the textboxes. Do not accept a negative value for any of the inputs. Your application should have a button clear and utilize a separate procedure to e an application that prompts the user to enter today's sales for five program should then display a simple bar graph comparing each 2. Creat stores. The stores sales. Create each bar in the bar grah by displaying a row of asterisks (*)...
Java
BasketBall Bar Chart Write a program that allows you to create a bar chart for the active members of a basketball team during a game. (Recall: there are only 5 active players on the court per team in a standard basketball game.) Your program should do the following tasks: 1) Prompt the user to store the first name of the five players 2) Prompt the user to enter the points scored by each player a. Use a do...while loop...
Total Sales Design a program that asks the user to enter a store’s sales for each day of the week. The amounts should be stored in an array. Use a loop to calculate the total sales for the week and display the result. Need: variable lists, IPO Chart, pseudocode, Flowchart, and working Python code. 2. Lottery Number Generator Design a program that generates a 7-digit lottery number. The program should have an Integer array with 7 elements. Write a loop...
C++ Write a program that asks user for a positive integer side length. If they enter an illegal value, they must be prompted to enter a good one until they do. It then displays, using asterisks, a filled diamond of the given side length. For example, if the side length is 4, the program should display:
Write a program in JAVA that asks the user to enter an integer. Store the integers in an array. Allow for up to 10 integers. When the user enters -1, the program should end. Print the number of integers entered as well as the number of times each integer was entered.
Write a javascript program that asks the user to enter five test scores. The program should display a letter grade for each score and the average test score. Write the following methods in the program: calcAverage—This method should accept five test scores as arguments and return the average of the scores. determineGrade—This method should accept a test score as an argument and return a letter grade for the score,
(Write a program for C++ )that allows the user to enter the last names of five candidates in a local election and the number of votes received by each candidate. The program should then output each candidate’s name, the number of votes received, and the percentage of the total votes received by the candidate. Your program should also output the winner of the election. A sample output is: Candidate Votes Received % of Total Votes Johnson 5000 25.91...
Design a program that asks the user to enter a store's sales for each day of the week. The amounts should be stored in an array. Use a loop to calculate the total sales for the week and display the result. Be sure to attach your PYTHON code. No modularization required.
Write a program that allows the user to enter the last names of five candidates in a local election and the number of votes received by each candidate. The program should then output each candidate's name, the number of votes received, and the percentage of the total votes received by the candidate. Your program should also output the winner of the election. A sample output is: Candidate Votes Received % of Total Votes Johnson 5000 25.91 Miller 4000 20.73 Duffy...