Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public String toString() {
- if(!tavarat.isEmpty() && tavarat.size() > 1) {
- int yhteispaino = 0;
- for (int i = 0; i < tavarat.size(); i++) {
- yhteispaino = yhteispaino + tavarat.get(i).getPaino();
- }
- return tavarat.size() + " tavaraa " + "(" + yhteispaino + " kg)";
- }else if (tavarat.size() == 1) {
- return "1 tavara " + "(paino " + this.yhteispaino() + ")";
- }else{
- return "ei tavaroita (0 kg)";
- }
- }
Add Comment
Please, Sign In to add comment