Giter VIP home page Giter VIP logo

space-flight-fun's Introduction

Instructions

  1. Read the below and map out the relationship, draw a diagram.
  2. Create methods to correspond with each of the deliverables.
  3. Build out examples in the run file, TEST YOUR CODE!

Spaceship

Attributes

  • name (String)
  • been_to_space? (Boolean)
  • Spaceships should not be able to change their name, but they should be able to change whether or not they've been to space

Methods

  • Spaceship.all
    • Should return all of the spaceship instances
  • Spaceship.find_by_name(name)
    • Should return all of the spaceship instances that match the passed in name
  • Spaceship.fresh_spaceship
    • Should return all of the spaceship instances that have not yet been to space
  • Spaceship#astronauts
    • Should return all of the astronauts that have been aboard that spaceship
  • Spaceship#add_astronaut(astronaut, mission_name)
    • Should associate the astronaut to the spaceship.

Space_Flight

Attributes

  • spaceship
  • astronaut
  • mission_name
  • Space_Flights should not be able to change their spaceship, astronaut or mission name

Methods

  • Space_Flight.all
    • Should return all of the instances of SpaceFlights
  • Space_Flight.mission_names
    • Should puts "The mission name of this spaceship is {insert mission name here}" for every Space_Flight
  • Space_Flight#astronaut
    • Should return the astronaut associated with the Space_Flight
  • Space_Flight#spaceship
    • Should return the spaceship associated with the Space_Flight

Astronaut

Attributes

  • name (String)
  • age (Number)
  • been_to_space? (Boolean)
  • Astronauts should be able to change their age and whether they've been to space, but not their name

Methods

  • Astronaut.all
    • Should return all of the instances of astronauts
  • Astronaut.eldest
    • Should return the oldest astronaut
  • Astronaut.been_to_space?
    • Should return an array of astronaut instances, who have visited space
  • Astronaut.find_all_by_name(name)
    • Should return all of the astronauts whose name matches the passed in string
  • Astronaut#space_flights
    • Should return the number of space_flights that an astronaut has been a part of
  • Astronaut#spaceships
    • Should return the name of all of the spaceships that this astronaut has flown in
  • Astronaut#add_spaceship(spaceship, misson_name)
    • Should associate an astronaut to a spaceship

space-flight-fun's People

Contributors

mlawford avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.