Coder Social home page Coder Social logo

fleetmanagement's Introduction

Internship recruitment task: Ship Fleet Management Library

This library is designed to facilitate the management of a fleet of ships, focusing on container ships and tanker ships. The library ensures data integrity through validation checks for ship details, including IMO numbers, dimensions, and coordinates. Library meets all Task Requirements.

Key Features

Ship Management

  • Adding ships
  • Ship position update

Container Ship Operations

  • Loading and unloading containers

Tanker Ship Operations

  • Refueling and emptying tanks

Prerequisites

  • IDE supporting .NET eg. Visual Studio 2022, Rider
  • .NET 8 SDK

Steps to Run and Tests the library:

Step 1: Clone the repository containing the class library and its unit tests to your local machine using Git:

  git clone https://github.com/Szymongr14/FleetManagement

Step 2: Open the Solution in IDE

Step 3: Build the Solution

Step 4:: Run the Unit Tests FleetManagementAppTest > Run All Tests

Step 4: Create Console App project and link library inside this solution to test library

My thought process when coding this task

Shipowner can add two types of ship (container and tanker ship), so I naturally thought about creating abstract class Ship with common fields {Id, name, width, length, position} and two inheriting classes from Ship class, which are ContainerShip and TankerShip with custom fields and methods specific for their usage.

For storing ships in the fleet I decided to use HashSet data structure because it ensures that all ships in the fleet are unique and provides efficient insertion, removal, and lookup operations. I override Equals() and GetHashCode() to compare and count hash depending only on ID, knowing it is unique.

For storing ship's current and previous positions I decided to use LinkedList because it has inserting in O(1) complexity and naturally keeps inserting order.

In the Requirements it is said that refueling and emptying tanks should refers to specific tank, so I added ID to them as well.

I also created custom exceptions classes for this library therefore users will know more precisely context of thrown exception.

I decided to store GPS timestamp and record time in Position record to have more precise control over the data being processed. It will have crucial impact when GPS signal is significantly delayed.

Asumptions

  • From ship we can fully or partially empty tank only with given ID as it is in the requirements
  • For simulating GPS delay I subtract from current time 70ms and store it into GPSTime variable in Position record.
  • Every metric variable is in SI unit eg. MassKg
  • Ship's name must be at least 2 characters
  • Coordinates must be: Latitude <-90, 90>, Longitude <-180, 180>
  • Equals method returns true only when comparing ships from the same subclass i.e. ContainerShip and TankerShip with the same ID.

fleetmanagement's People

Contributors

szymongr14 avatar

Watchers

 avatar

Forkers

pmikolajczak

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.