Created
October 30, 2014 13:11
-
-
Save SniperProSerria117/637ce24472a29bf891cb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package barchart; | |
import java.util.Scanner; | |
public class BarChart { | |
public static void main(String[] args) | |
{ | |
// declare a double array | |
double[] store = new double[5]; | |
Scanner scan = new Scanner(System.in); | |
//declare a for loop | |
for(int i = 0; i < 5; i++) | |
{ | |
System.out.printf("Enter today's sales for store %d: ", i + 1); | |
store[i] = scan.nextDouble(); | |
} | |
System.out.println("SALES BAR CHART"); | |
// declare a for loop | |
for(int i = 0; i < 5; i++) | |
{ | |
System.out.printf("Store %d: ", i + 1); | |
//Nested for loop | |
for(int c = 0; c < store[i]/100; c++) | |
System.out.print("*"); | |
System.out.println(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment