package blood
- Alphabetic
- Public
- Protected
Type Members
- class BloodType extends AnyRef
An instance of this class corresponds to a single blood type in an ABO+Rh blood group system.
An instance of this class corresponds to a single blood type in an ABO+Rh blood group system. A person's blood type affects who they can donate blood to; the blood types of the donor and the recipient must be compatible.
As represented here, a blood type consists of two components, ABO and rhesus. For any person, the ABO component has one of the following values: "A", "B", "AB", or "O" (the letter O, not zero). The rhesus component is either positive or negative. These components describe the presence or absence of particular antigens in human blood; for further reading, see Wikipedia.
This class reprents the ABO component as a string and the rhesus component as a boolean so that
true
corresponds to positive andfalse
to negative.
Value Members
- object BloodTest extends App
This app goes through all the possible combinations of donors and recipients in the ABO+Rh system and produces a printout detailing which combinators are safe.
This app goes through all the possible combinations of donors and recipients in the ABO+Rh system and produces a printout detailing which combinators are safe. To determine whether a combination is safe, the app uses class
BloodType
.The output is expected to match the one provided by Wikipedia:
Note to students: You don't need to understand how this app works just yet. You can run it to test your
BloodType
class, though.