Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

State Primaries: You are to write a program called Lab06A that prints a table of State Abbreviations, State Populations, and State Electoral Votes. After the

State Primaries: You are to write a program called Lab06A that prints a table of State Abbreviations, State Populations, and State Electoral Votes. After the table, the program prints the Total Population, and Total Electoral Votes (see sample output below). After the totals, it will prompt the user to enter state abbreviation, and reports the specific state population and state electoral votes. An incorrect state abbreviation entered will cause your program to continuously prompt the user to enter a correct state abbreviation.

You code must handle any correct casing (e.g. FL, fl, etc.). You will use three arrays to report this information. Below is the code to declare, create, and populate them - you can copy/paste this into your program.

Code for the arrays

String stateAbbreviations[] = {"AL", "AK", "AZ", "AR", "CA", "CO", "CT", "DE", "DC", "FL", "GA", "HI", "ID", "IL", "IN", "IA", "KS", "KY", "LA", "ME", "MD", "MA", "MI", "MN", "MS", "MO", "MT", "NE", "NV", "NH", "NJ", "NM", "NY", "NC", "ND", "OH", "OK", "OR", "PA", "RI", "SC", "SD", "TN", "TX", "UT", "VT", "VA", "WA", "WV", "WI", "WY"}; int statePopulations[] = {4858979, 738432, 6828065, 2978204, 39144818, 5456574, 3590886, 945934, 0, 20271272, 10214860, 1431603, 1654930, 12859995, 6619680, 3123899, 2911641, 4425092, 4670724, 1329328, 6006401, 6794422, 9922576, 5489594, 2992333, 6083672, 1032949, 1896190, 2890845, 1330608, 8958013, 2085109, 19795791, 10042802, 756927, 11613423, 3911338, 4028977, 12802503, 1056298, 4896146, 858469, 6600299, 27469114, 2995919, 626042, 8382993, 7170351, 1844128, 5771337, 586107}; int stateElectoralVotes[] = {9, 3, 11, 6, 55, 9, 7, 3, 3, 29, 16, 4, 4, 20, 11, 6, 6, 8, 8, 4, 10, 11, 16, 10, 6, 10, 3, 5, 6, 4, 14, 5, 29, 15, 3, 18, 7, 7, 20, 4, 9, 3, 11, 38, 6, 3, 13, 12, 5, 10, 3}; To format your table so that your output is aligned neatly (columns are exactly as the sample output below), you can format the output by following these guidelines.

image text in transcribed

AK WILLI Lumpice, Picu u your l eurs projLL LLS LL LIPWC WC Sample output: State Population Ele ctoral Votes 4,858,979 738,432 6,828,065 2,978,204 39,144,818 5, 456, 574 3,590,886 945,934 42 20,271,272 10,214,860 1,431, 603 1,654,930 12,859,995 6,619, 680 3,123,899 2,911, 641 4,425,092 4,670, 724 1,329, 328 6,006, 401 6,794, 422 9,922,576 5, 489,594 2,992,333 6,083,672 1,032,949 1,896,190 2,890,845 1,330, 608 8,958,013 2,085, 109 19,795,791 10,042, 802 756, 927

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

Real Time Database And Information Systems Research Advances

Authors: Azer Bestavros ,Victor Fay-Wolfe

1st Edition

1461377803, 978-1461377801

More Books

Students also viewed these Databases questions