o1.election

package o1.election

Type members

Classlikes

class Candidate(val name: String, val votes: Int, val party: String)

Represents a candidate in an election results application.

Represents a candidate in an election results application.

A candidate object is immutable.

Value parameters:
name

the candidate’s name

party

the name (or abbreviation) of the candidate’s party

votes

the number of votes received by the candidate

class District(val name: String, val seats: Int, val candidates: Vector[Candidate])

The class District represents electoral districts (Finnish: vaalipiiri). Each district has a certain number of seats for which a (larger) number of candidates compete in an election. Each district has its own candidates.

The class District represents electoral districts (Finnish: vaalipiiri). Each district has a certain number of seats for which a (larger) number of candidates compete in an election. Each district has its own candidates.

A district object is immutable.

Value parameters:
candidates

the candidates vying for the seats in the district; there is always at least one candidate per district

name

the name of the electoral district

seats

the number of seats (elected positions) available

final class testElection

Value members

Concrete methods

A small program that uses the classes in this package. May be customized by the student.

A small program that uses the classes in this package. May be customized by the student.