Question: JAVA PROGRAM The voter participation data we will work with is stored in a Word document Presidential Elections.docx or you can find on http://www.sos.wa.gov/elections/voter_participation.aspx. Its

 JAVA PROGRAM The voter participation data we will work with is

JAVA PROGRAM

The voter participation data we will work with is stored in a Word document Presidential Elections.docx or you can find on http://www.sos.wa.gov/elections/voter_participation.aspx.

Its expected that you hard code the bar data in the main() method, i.e., I expect to see the corresponding values typed into your program and passed to the functions as arguments. Outside of this, you should have no magic numbers; use values from the website instead.

Constant

Description

Sample

Histogram title

Text that will appear centered (over a 80-character space) before the histogram is displayed. One blank line follows it.

"Presidential Elections"

Histogram characters

The character to be repeated to create the data bar

T, R, V

Scale

Use a scale for the chart to create bars in the appropriate size

1000000

Java Program using:

Constants (at class level), using the recommended casing and word separator

Variables (but not class-level ones)

Assignment and calculations

Definite loops

Console output

But not:

Indefinite loops (no while)

Selection control structures (no if) unless youre doing something way above and beyond

Arrays, lists, or other data structures or objects we haven't covered

Libraries or methods we haven't covered

Creating the following functions

main() should consist of a series of function calls and nothing more

printHeader() should accept one parameter the name of the chart

createBar() will be an overloaded method

the firsts variant should accept four parameters:

- an integer specifying the bar title (the year)

- an integer indicating the bar value

- the character to be repeated to create the data bar

- the scale

the second variant accepts three parameters, the same as the first but excluding the year.

createAxis() should accept one parameter a step

emptyRow() should accept no parameters

None of the functions should return any value

You may wish to use the String length method; this one is allowed.

Example:

String userName = "Any Name";

int userNameLen = userName.length();

The output of the program is a character-based histogram showing some bars of data taking from the website. Use at least 5 different years. The header should be in the center of the first line. Dont hardcode numbers, e.g., for the axis values. In other words, dont have a print statement that prints a string literal 5000 10000 15000 ; write a proper loop instead and use steps and scales. The same goes for tick marks.

Presidential Elections 2000 I TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT 2004 ITTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT 2008 I TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT 2012 ITTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT 2016 ITTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT 0 1000000 2000000 3000000 4000000 5000000 6000000

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!