Answered step by step
Verified Expert Solution
Link Copied!

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 17 or later (called HH.java) or Python 3.11 or later (called HH.py) to
implement the Huntington-Hill algorithm described in the textbook. Write the program so that:
it implements the method APPORTIONCONGRESS given in pseudocode in figure 0.5 on page 9 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 435(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 6
Alaska 1
Arizona 10
The population file, STATEPOPULATIONS.TXT, contains 50 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 hh.py StatePopulations.txt

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

DATABASE Administrator Make A Difference

Authors: Mohciine Elmourabit

1st Edition

B0CGM7XG75, 978-1722657802

More Books

Students also viewed these Databases questions