Skip to content

Latest commit

 

History

History
116 lines (84 loc) · 3.29 KB

checklist.md

File metadata and controls

116 lines (84 loc) · 3.29 KB

Checklist for Databse application

If stuck or ready you can check below expectations.

Separate header and source files for classes

  • Files: Student.hpp, Student.cpp, Employee.cpp, Employee.hpp, Person.cpp, Person.hpp, Database.cpp, Database.hpp, main.cpp (names can differ of course)
  • Optional PeselValidation.hpp and/or PeselValidation.cpp. It may also be a part of Database.

Person.hpp

  • Name, surname and address should be strings
  • Gender should be an enum
  • No default constructor
  • Virtual destructor
  • Should have common fields: name, lastName, pesel, gender, address
  • All fields should be private
  • Should have public setAddress function
  • Should have serialization function eg. toString to make displaying and saving easier

Person.cpp

  • Fields should be filled on constructor initilization list

Employee.hpp

  • Should have private salary field
  • Should have public getSalary const function
  • Should have public setSalary function

Employee.cpp

  • Constructor should call base class constructor

Student.hpp

  • Should have private index field
  • Should have public getIndex const function

Student.cpp

  • Constructor should call base class constructor

Database.hpp

  • Should have a container of pointers to Person (or smart pointers to Person)
  • Should have alias using on a container (or typedef)
  • The container should be a private field in Database class
  • Can have NotFound exception
  • Should have functions like add, find, show/display, sort, generate, save, load, remove, modifySalary, modifyAddress
  • Should have isValid(pesel) function returning bool

Database.cpp

  • Find can use std::find or std::find_if
  • Show/display should call serialization method on every person, not get every field here.
  • Sort should use std::sort
  • Save should also use serialization function to avoid duplication
  • Remove should use std::remove_if and erase functions
  • Streams should be used for serialization (displaying, saving, loading)

main.cpp

  • Should use assertions to check validity of the program
  • Can use assertions for checking pesel like below one: (just copy and adjust to your program)
     assert(not isPeselValid("1234567a901", Gender::Female) && "not a digit");
     assert(not isPeselValid("12345678901", Gender::Female) && "invalid month");
     assert(not isPeselValid("12325678901", Gender::Female) && "invalid day");
     assert(not isPeselValid("03222978901", Gender::Female) && "not leap year");
     assert(not isPeselValid("04222978911", Gender::Female) && "not a female");
     assert(not isPeselValid("04222978901", Gender::Male) && "not a male");
     assert(not isPeselValid("04222978901", Gender::Female) && "invalid checksum");
     assert(isPeselValid("04222978907", Gender::Female) && "valid");