o1.election

package o1.election

Members list

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.

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

Attributes

Supertypes
class Object
trait Matchable
class Any
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.

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

Attributes

Supertypes
class Object
trait Matchable
class Any
final class testElection

Attributes

Supertypes
class Object
trait Matchable
class Any

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.

Attributes