-
Notifications
You must be signed in to change notification settings - Fork 0
/
Nation.h
48 lines (39 loc) · 1.21 KB
/
Nation.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// Copyright (c) 2016 Roger Dubbs
#pragma once
#include <vector>
#include <string>
#include "Population.h"
class State;
/**
* A nation consisting of a number of states. This concept is currently modeled on the United States of America.
*/
class Nation {
public:
explicit Nation(std::vector<State>& states);
/**
* @return the list of all the states of the nation.
*/
const std::vector<State>& states() const;
private:
std::vector<State> m_states;
};
/**
* Compute the maximum number of representatives for the states given - one per 30000 total population.
* @param states The states to compute the representation for.
* @return the maximum number of representatives.
*/
unsigned int maxRepresentatives(const Nation& nation);
/**
* Load a nation from the named CSV file.
* The CSV file must contain State,Population
*
* @param filename The name of the file to read the data from
* @return A list of all the states in the CSV File.
*/
Nation readPopulations(std::string filename);
/**
* Returns the total population of the nation passed.
* @param nation The nation to compute the population of.
* @return The population of the nation.
*/
Population totalPopulation(const Nation& nation);