hexwolfman

Challenge 12 Bar Chart

Jul 22nd, 2019
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.59 KB | None | 0 0
  1. //Hector Villalobos
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Challenge12BarChart {
  6.   public static void main(String[] args) {
  7.    
  8.     Scanner keyboard = new Scanner(System.in);
  9.    
  10.     String barChart = "SALES BAR CHART\n";
  11.    
  12.     for(int i = 1; i <=5; i++) {
  13.      
  14.       System.out.print("Enter today's sales for store " + i + ": ");
  15.       int sales = keyboard.nextInt();
  16.       barChart += "Store " + i + ": ";
  17.      
  18.       for(int j = 100; j <= sales; j += 100) {
  19.         barChart += "*";
  20.       }
  21.       barChart += "\n";
  22.     }
  23.     System.out.println(barChart);
  24.    
  25.   }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment