Code Monkey home page Code Monkey logo

bop2_lab09's Introduction

Task 1 (mandatory)

IComparable and ISerializable are abstract interface classes, Person is derived from them both (multiple interface inheritance).

Implement the missing functions in Person.h and Person.cpp. You may need to declare new functions as well.

Decomposition of the program:

  • IComparable.h, ISerializable.h, Person.h: class declaration headers;
  • Person.cpp: implementation of class members declared in the header;
  • Main.cpp: the main program with testing code.

Task 2 (mandatory)

Sorter.h declares a Sorter class that is a collection of multiple sorting algorithms. Each sorting algorithm takes an array of IComparable* pointers. These functions can sort any type that implements the IComparable interface such as our Person type.

Add a Sorter.cpp file and implement bubble sort and quicksort there. Test your solution in Main.cpp.

Task 3 (optional)

There are many other sorting alorigthms. Add another one and test it in the main function. Examples: merge sort (in place or not), insertion sort.

Task 4 (optional)

Add another sortable type. Implementing the IComparable interface makes a type sortable. Create an array of your type and sort it via the Sorter class. Test your solution in the main function.

Examples of sortable types:

  1. Complex numbers. Should be sorted by absolute value (length of the vector).
  2. Rational numbers as a ratio of two integers p/q. Numerical sorting is well defined.
  3. 3D vectors. Should be sorted by length.

Completing one or both optional tasks can make up for mistakes in the first task.

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.