.car shuts down while driving on 1996 Toyota Corolla

my toyota corolla 96 model shut off while driving. in the mornings it has a hard start, when the engine is cold, it cranks but not starting instantly. while you drving it shutts off sometimes/intermitently. i'm not sure if the problem is the fuel pump or the computer box