troubleshooting Question

Create a class called BarChart that displays a series of asterisks (*) for a specific number.

Avatar of Flex Tron
Flex TronFlag for United States of America asked on
8 Comments1 Solution243 ViewsLast Modified:
Dear Java Gurus,
I have an assignment where I need your help.
This is the Question:
Create a class called BarChart that displays a series of asterisks (*) for a specific number. The class’s constructor should have one integer parameter that represents the number of asterisks to display. The class should also have a method called displayBar that displays the series of asterisks.

Create a second class called BarChartTester that contains the mainmethod. The method should ask the user fora number and use the BarChart class to create a BarChart object that displays the appropriate number of asterisks. This should be repeated five times.

The BarChartTester class should produce the following example input/output:
Enter a number: 5
Enter a number: 15
Enter a number: 7
Enter a number: 3
Enter a number: 23

I have attached my code in the question.
I am using Netbeans
The error I am getting is :
Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - illegal start of expression
      at barchart.BarChart.main(
Flex Tron

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 8 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 8 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros