Answered step by step
Verified Expert Solution
Question
1 Approved Answer
import java.util.Scanner; public class Calculator { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System .
import java.util.Scanner;
public class Calculator
public static void mainString args
Scanner scanner new ScannerSystemin;
char tryAgain;
do
startEnteringBinaryNumbersscanner;
System.out.printWould you like to try again Y or y for yes;
tryAgain scanner.nextcharAt;
while tryAgain Y tryAgain y;
scanner.close;
System.out.printlnThank you for using the program";
public static void startEnteringBinaryNumbersScanner scanner
int numBinaryNumbers;
int sum ;
int min Integer.MAXVALUE;
int max Integer.MINVALUE;
System.out.printHow many binary numbers would you like to enter? ;
numBinaryNumbers scanner.nextInt;
for int i ; i numBinaryNumbers; i
System.out.printEnter the binary number: ;
String binaryNumber enterBinaryNumberscanner;
int decimalValue convertBinaryToDecimalbinaryNumber;
sum decimalValue;
if decimalValue min
min decimalValue;
if decimalValue max
max decimalValue;
System.out.printlnThe binary number you just entered has decimal value decimalValue;
double average double sum numBinaryNumbers;
System.out.printlnThe sum is sum;
System.out.printlnThe minimum value is min;
System.out.printlnThe maximum value is max;
System.out.printlnThe average is average;
public static String enterBinaryNumberScanner scanner
return scanner.next;
public static int convertBinaryToDecimalString binaryNumber
int decimalValue ;
int power ;
for int i binaryNumber.length; i ; i
if binaryNumbercharAti
decimalValue Math.pow power;
power;
return decimalValue;
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started