Java Need To See Example Code For Accumulating Values And Displaying Them But

Java—Need to see example code for accumulating values and displaying them. But the example has to have a loop do you want to repeat process Y OR N . The code should not display most recent input it needs to display all of them like grand total etc.