My code is attached below. My problem is I need the decimal output (sum/count) to print two decimal places. For example, instead of 9.5 I need it to print 9.50. 1 import java.util.Scanner; 2. 3 public...


My code is attached below. My problem is I need the decimal output (sum/count) to print two decimal places. For example, instead of 9.5 I need it to print 9.50.


1 import java.util.Scanner;<br>2.<br>3 public class LabProgram {<br>public static void main(String[] args) {<br>Scanner sc = new Scanner(System.in);<br>int count-0, max3D0%3B<br>float sum=0;<br>while(true){<br>int n =<br>if(n<0)<br>break;<br>count++;<br>if(count=31)<br>4<br>6.<br>6.<br>sc. nextInt();<br>10<br>11<br>12<br>13<br>14<br>max=n;<br>15<br>else if(max<n)<br>16<br>max=n;<br>17<br>sum+=n;<br>18<br>}<br>System.out.println max+

Extracted text: 1 import java.util.Scanner; 2. 3 public class LabProgram { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int count-0, max3D0%3B float sum=0; while(true){ int n = if(n<0) break;="" count++;="" if(count="31)" 4="" 6.="" 6.="" sc.="" nextint();="" 10="" 11="" 12="" 13="" 14="" max="n;" 15="" else="">
se<br>Enter program input (optional)<br>15 20 0 3-1<br>Run program<br>Input<br>Program output displayed here<br>20 9.5<br>

Extracted text: se Enter program input (optional) 15 20 0 3-1 Run program Input Program output displayed here 20 9.5

Jun 11, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here