Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a program in either Java 1 7 or later ( called HH . java ) or Python 3 . 1 1 or later (
Write a program in either Java or later called HHjava or Python or later called HHpy to
implement the HuntingtonHill algorithm described in the textbook. Write the program so that:
it implements the method APPORTIONCONGRESS given in pseudocode in figure on page of
the textbook; note that the method takes two parameters: an array of state populations and the
number of representatives.
contains a main method that reads in the population data from a file described below, calls the
method APPORTIONCONGRESS and passes it an array of the populations and the value the
number of representatives
prints a list showing with each states name, a tab character, and the number of representatives
apportioned to that state on its own line. For example, the first few lines might look something
like:
Alabama
Alaska
Arizona
The population file, STATEPOPULATIONS.TXT contains lines, one for each state. Each line contains the
states name, a space, and an integer population.
Write the program so that it can be run from the Windows command line as follows:
For Java: java HH StatePopulations.txt
For Python: python hhpy StatePopulations.txt
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started