I cant get it right. 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...


I cant get it right.


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.




code




import java.util.Scanner;



public class BarChart2 {

publicstaticvoidmain(String[] args) {

Scanner input =newScanner(System.in);

int artPoints;

int bobPoints;

int calPoints;

int danPoints;

int eliPoints;

finalint AMT_EACH_ASTERISK =10;

System.out.println("Enterpoints 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("\nPoints for Season (each asterisk represents " + AMT_EACH_ASTERISK + " points)\n");



drawChart("Art", artPoints,AMT_EACH_ASTERISK);

drawChart("Bob", bobPoints,AMT_EACH_ASTERISK);

drawChart("Cal", calPoints,AMT_EACH_ASTERISK);

drawChart("Dan", danPoints,AMT_EACH_ASTERISK);

drawChart("Eli", eliPoints,AMT_EACH_ASTERISK);

}



publicstaticvoiddrawChart(Stringname,intpoints,intamt_each) {

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

for (int i =1; i <= points;="" i="" +="amt_each)">

System.out.print("*");

}

System.out.println();

}

}




Jun 10, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here