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 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started