Question: import java.util.Scanner; public class Calculator { static int array [ ] ; public static void main ( String [ ] args ) { int min;
import java.util.Scanner;
public class Calculator
static int array;
public static void mainString args
int min;
int max;
int sum;
double average;
Scanner sc new ScannerSystemin;
char ch n;
do
startEnteringBinaryNumberssc;
sum ;
average ;
min Integer.MAXVALUE;
max Integer.MINVALUE;
forint i ; i array.length;i
ifarrayi min
min arrayi;
ifarrayi max
sum sum arrayi;
average doublesumarraylength;
System.out.printlnSum: sum;
System.out.printlnMinimum: min;
System.out.printlnMaximum: max;
System.out.printlnAverage: average;
System.out.printlnFor try again enter y or Y : ;
ch scnextcharAt;
System.out.println;
whilech y ch Y;
public static void startEnteringBinaryNumbersScanner sc
System.out.printHow many binary numbers would you like to enter? ;
int n scnextInt;
array new intn;
forint i ; i n; i
String binaryNum enterBinaryNumbersc;
arrayi convertBinaryToDecimalbinaryNum;
public static String enterBinaryNumberScanner scanner
System.out.printEnter binary number: ;
return scanner.next;
public static int convertBinaryToDecimalString binaryNumber
int dec ;
int j ;
for int i binaryNumber.length;i ; i
dec intdec IntegervalueOfbinaryNumbercharAti Math.pow j;
j;
return dec;
The following is a sample run of the program: How many binary numbers would you like to enter?
Enter the binary number:
The binary number you just entered has decimal value
Enter the binary number:
The binary number you just entered has decimal value
The sum is The minimum value is
The maximum value is
The average is
Would you like to try again Y or y for yes y
How many binary numbers would you like to enter?
Enter the binary number:
The binary number you just entered has decimal value
Enter the binary number:
The binary number you just entered has decimal value
Enter the binary number:
The binary number you just entered has decimal value
The sum is
The minimum value is
The maximum value is
The average is
Would you like to try again Y or y for yes n
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
