Skip Top Navigation Bar

Creating Records and Record Objects

Your Turn: Creating a New Type with a Record and Create a Record Object

For each of the following descriptions:

  • create a new record type
  • create a new object to represent the provided example or examples

Practice 1: Plant Data

Plant data includes:

  • name: a String
  • species: a String
  • growing zone: a value between 1 and 10.

Example:

  • name: "Southern Blueberry Plant"
  • species: "Vaccinium myrtilloides"
  • growing zone: 6

Practice 2: Planet Data

Planet data includes:

  • name
  • mass
  • length of day
  • distance from the sun
  • whether it has a global magnetic field or not
  • number of moons.

Examples

  • Example 1: Mercury has a mass of 0.330, length of day equal to 4222.6 hours, distance from the sun is 57.9, it has a global magnetic field, and does not have any moons.
  • Example 2: Mars has a mass of 0.642, length of day equal to 24.7 hours, distance from the sun is 228.0, it does not have a global magnetic field, and it has 2 moons.

Practice 3: Product Data

Product data includes:

  • name
  • manufacturer
  • product size
  • number of calories

Example 1: The name chicken noodle soup, made by the Sheldon Noodle Soup company, can size is 16oz, and the number of calories is 150.