Giter VIP home page Giter VIP logo

geometry's Introduction

Geometry

Description

This is the repository for the homework 1 of the course Design Pattern opened during the 2020 Spring Semester at the National Taipei University of Technology.

Problem Description

You will have to program a simple geometry application called geo that sorts shapes, whose SRS is specified below. Specifically, you must write the implementations and tests for the classes and their methods given in this template project (only accessible to Gmail accounts of domain ntut.org.tw).

Software Requirements Specification (SRS)

  • As a command line application, geo reads shapes from an input file, sorting the shapes by area or perimeter in increasing or decreasing order, and writes the result to an output file.
  • A shape's toString() method returns a string describing the shape itself. The string format is given here.
  • The class InputOutput is responsible the program logic and must be called by the main function inside the class Geo (the application entry point).
  • Vectors used to create a ConvexPolygon need to be sorted in either clockwise or counterclockwise direction. ConvexPolygon(s) whose vectors are not correctly sorted are invalid.
  • The program must throw exception should a shape given in the input file is invalid. The program must also handle these exceptions by simply ignoring them.
  • The parameters of the application's command line argument are defined as follow:
    • The first parameter is the path of the input file, which contains the shapes information.
    • The second parameter is the path of the output file, which will contain the sorted shapes information.
    • The third parameter is the condition to sort the shapes.
      • area to sort the shapes by their areas.
      • perimeter to sort the shapes by their perimeters.
    • The last parameter is the order to sort the shapes (by the condition given in the previous parameter).
      • inc to sort the shapes in increasing order.
      • dec to sort the shape in decreasing order.

Execution

The program can be executed using the following command:

mvn exec:java -Dexec.mainClass="org.ntutssl.shapes.Geo" -Dexec.args="test_data/input.txt test_data/output.txt area inc"

Contributor

Reference

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.