Advertisement
grodek118

Bar chart

Nov 22nd, 2022
596
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.66 KB | None | 0 0
  1. package com.company;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Main {
  6.  
  7.     public static void main(String[] args){
  8.        
  9.        Scanner scanner = new Scanner(System.in);
  10.  
  11.        int store1, store2, store3,
  12.                store4, store5;
  13.  
  14.         System.out.print("Enter today's sales for store 1: ");
  15.         store1 = scanner.nextInt();
  16.         System.out.print("Enter today's sales for store 2: ");
  17.         store2 = scanner.nextInt();
  18.         System.out.print("Enter today's sales for store 3: ");
  19.         store3 = scanner.nextInt();
  20.         System.out.print("Enter today's sales for store 4: ");
  21.         store4 = scanner.nextInt();
  22.         System.out.print("Enter today's sales for store 5: ");
  23.         store5 = scanner.nextInt();
  24.  
  25.         System.out.println("SALES BAR CHART");
  26.         System.out.print("Store 1: ");
  27.  
  28.         for (int i = 0; i < store1; i += 100)
  29.         {
  30.             System.out.print("*");
  31.         }
  32.  
  33.         System.out.println(" ");
  34.         System.out.print("Store 2: ");
  35.  
  36.         for (int i = 0; i < store2; i += 100)
  37.         {
  38.             System.out.print("*");
  39.         }
  40.  
  41.         System.out.println(" ");
  42.         System.out.print("Store 3: ");
  43.  
  44.         for (int i = 0; i < store3; i += 100)
  45.         {
  46.             System.out.print("*");
  47.         }
  48.  
  49.         System.out.println(" ");
  50.         System.out.print("Store 4: ");
  51.  
  52.         for (int i = 0; i < store4; i += 100)
  53.         {
  54.             System.out.print("*");
  55.         }
  56.  
  57.         System.out.println(" ");
  58.         System.out.print("Store 5: ");
  59.  
  60.         for (int i = 0; i < store5; i += 100)
  61.         {
  62.             System.out.print("*");
  63.         }
  64.     }
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement