Answer:
import java.util.Scanner;
public class CocaColaVendingTest {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.println("Enter four sepertate binary numbers (1 or 0)");
int b0 = in.nextInt();
int b1 = in.nextInt();
int b2 = in.nextInt();
int b3 = in.nextInt();
System.out.println("This formula \"8b0 4b1 2b2 b3\" is applied to get the following" +
" "+(8*b0)+", "+(4*b1)+", "+(2*b2)+", "+(b3));
}
}
Step-by-step explanation:
This is implemented in java
Using the scanner class, the user is prompted to enter for values (0s or 1s)
These are received and stored in the variables b0, b1,b2,b3 as ints.
The formula 8b0 4b1 2b2 b3 is then applied within the output statement to display the results as required by the question