An integer is a whole number (no fractions). There are two basic types of integers
- Unsigned integers: only positive integers (0, 1, 2, ...).
- Signed integers: positive and negative integers (..., -2, -1, 0, 1, 2).
Various programming languages limit the range of values a single integer can hold. They may also have various variants that have different range restrictions. Theses names include, but are not limited to:
A student may have no understanding of floating point numbers as more than numbers with decimal points.
- Explain what integer types are supported in your langauge, and when to use them.
- Ensure that type conversions are understood if appropriate (e.g. rounding, overflows)
- Ensure that students know how to compare numbers to each other.
This exercise asks students to write code to analyse the production of an assembly line. The reference implementation (C#) teaches:
- Arithmetic
- Comparing numbers
- Converting between integers and floating point numbers.
- Conditionals
Track | Exercise | Changes |
---|---|---|
C# | cars-assemble | None |
F# | cars-assemble | None |
Go | numbers | None |