Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases And Information Systems 1 International Baltic Conference Dbandis 2020 Tallinn Estonia June 19 2020 Proceedings

Authors: Tarmo Robal ,Hele-Mai Haav ,Jaan Penjam ,Raimundas Matulevicius

1st Edition

303057671X, 978-3030576714

More Books

Students also viewed these Databases questions

Question

Explain three broad global HR challenges.

Answered: 1 week ago