rankall and rank hospital functions

part of assignment 3