**** Please answer with complete sentences and
explanation
Solution public static boolean negativeSum(Scanner in) { boolean neg = false; int sum = 0; int steps = 0; while(in.hasNextInt() && neg == false) { int token = in.nextInto; steps++; sum += token; if(sum < 0) { neg - true; } } if(neg == false) { System.out.println("no negative sum"); return false; } else { System.out.println(sum + " after + steps + " steps"); return true; } } 1 Answer the following: This solution works, but stylistically, it's meh. Identify at least two style choices here that are not ideal.
Solution public static boolean negativeSum(Scanner in) { boolean neg = false; int sum = 0; int steps = 0; while(in.hasNe
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
Solution public static boolean negativeSum(Scanner in) { boolean neg = false; int sum = 0; int steps = 0; while(in.hasNe
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!