Question: Java code to adjust: import java.util.Scanner; public class BarChart2 { public static void main (String[] args) { Scanner input = new Scanner(System.in); int artPoints; int

 Java code to adjust: import java.util.Scanner; public class BarChart2 { public

Java code to adjust:

import java.util.Scanner;

public class BarChart2 {

public static void main (String[] args) {

Scanner input = new Scanner(System.in);

int artPoints;

int bobPoints;

int calPoints;

int danPoints;

int eliPoints;

final int AMT_EACH_ASTERISK = 10;

System.out.println("Enter points earned for the season");

System.out.print(" by Art >> ");

artPoints = input.nextInt();

System.out.print(" by Bob >> ");

bobPoints = input.nextInt();

System.out.print(" by Cal >> ");

calPoints = input.nextInt();

System.out.print(" by Dan >> ");

danPoints = input.nextInt();

System.out.print(" by Eli >> ");

eliPoints = input.nextInt();

System.out.println(" Points for Season (each asterisk represents " +

AMT_EACH_ASTERISK + " points)");

drawChart("Art",artPoints,10);

drawChart("Bob",bobPoints,10);

drawChart("Cal",calPoints,10);

drawChart("Dan",danPoints,10);

drawChart("Eli",eliPoints,10);

}

public static void drawChart(String name, int points, int amt_each) {

System.out.print(name+": ");

for(int i = 0;i

System.out.print("*");

}

System.out.println();

}

}

Modify the BarChart program from Chapter 6 Exercise 13 to accept the number of points scored by each player in a season. The bar chart displays one asterisk for each 10 points scored by a player. For example, if a player has scored 48 points, then display 4 asterisks. An example of the program is shown below: Enter points earned for the season by Art >> 10 by Bob >> 20 by Cal >> 30 by Dan >> 40 by Eli >> 50 Points for Season (each asterisk represents 10 points) * ** Art Bob Cal Dan Eli *** **** *****

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!