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 bear 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:
I can't seem to get my code to work. This is what I have so far
import javax.swing.JOptionPane;
public class BarChart
{
public static void main(String[] args)
{
String inputOne = JOptionPane.showInputDialog("Enter today's sales " +
"for store 1: ");
int storeOne = Integer.parseInt(inputOne);
String inputTwo = JOptionPane.showInputDialog("Enter today's sales " +
"for store : ");
int storeTwo = Integer.parseInt(inputTwo);
String inputThree = JOptionPane.showInputDialog("Enter today's " +
"sales for store 3: ");
int storeThree = Integer.parseInt(inputThree);
String inputFour = JOptionPane.showInputDialog("Enter today's " +
"sales for store 4: ");
int storeFour = Integer.parseInt(inputFour);
String inputFive = JOptionPane.showInputDialog("Enter today's " +
"sales for store 5: ");
int storeFive = Integer.parseInt(inputFive);
JOptionPane.showMessageDialog(null, "\nSALES BAR CHART");
}
}
for (int count = 0; count <= barOne; count++)
{
JOptionPane.showMessageDialog(null, '*');
}