1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
zlopas [31]
3 years ago
11

1. Write a program that asks for 4 separate numbers that are binary (1 or 0). Create a variable called b0 for the first, b1 for

the second, b2 for the third, and b3 for the last. After gathering the four-input run the following calculation: 8b0 4b1 2b2 b3. Output the formula with the input values followed by the answer.
Computers and Technology
1 answer:
Snowcat [4.5K]3 years ago
8 0

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));

   }

}

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

You might be interested in
What email address should you use to send questions to a UC faculty or staff member?
ValentinkaMS [17]

Answer:

obviously your own////

Explanation:

8 0
4 years ago
Read 2 more answers
Full meaning of LAN and WAN
tekilochka [14]

Answer: <u>Hello Friend! The answers would be</u><u> Local Area Network (LAN) and Wide Area Network (WAN)</u><u>, Sorry if I'm incorrect!</u>

Explanation: <u>A local wide network is a computer network that connects to computers in a limited area. Ethernet and Wifi are the two main kind of technologies used in the local networks. A wide area network is a distributed private telecommunications. Routers and multi function devices are mainly used.</u>

<u />

6 0
3 years ago
Read 2 more answers
Why is brainly not working it say im logged out rn but im not i cant acces anything but this
Grace [21]

Answer:

the answers are unlimited now so you cant sigh up but if you cant log in then one of the things you filled i. Might be wrong

Explanation:

3 0
4 years ago
Read 2 more answers
What word does<br> this pattern spell?<br> d.
Advocard [28]

Answer:

BEG

Explanation:

In traditional music theory, pitch classes are typically represented by first seven Latin alphabets (A,B,C,D,E ,F and G) . And in the below music notes attachment we can understand that the answer is option (a) BEG

7 0
4 years ago
Create an interface called Runner. The interface has an abstract method called run() that displays a message describing the mean
4vir4ik [10]

Answer:

Please find the code and its output in the attached file.

Explanation:

In the above-given code, an interface "Runner" is defined, inside the interface, an abstract method run is declared.

In the next step, three class "Athlete, Machine, and PoliticalCandidate" s defined that implements the run method, and use the print message that holds a given value as a message.

In the next step, a class "DemoRunners" is defined, and inside the main method, the three-class object is declared, which calls the run method.

 

5 0
3 years ago
Other questions:
  • An engineer is assigned the task of reducing the air pollutants being released from a power plant that generates electricity by
    9·1 answer
  • Why you think Operating System is pivotal in teaching and learning.
    13·1 answer
  • 4. Where do you find the command to create bibliography citations or a table of contents?
    14·2 answers
  • ______________ helps you see how your document will appear on the paper. ​
    10·1 answer
  • Consider a file currently consisting of 100 blocks. Assume that the file control block (and the index block, in the case of inde
    12·1 answer
  • What occurs when a website can know enough about a person's likes and dislikes that it can fashion offers that are more likely t
    9·1 answer
  • What is a router?
    9·1 answer
  • Match the index with the value
    14·1 answer
  • Complete the sentence.
    10·1 answer
  • Makayla is cre iting a brochure for her computer consulting company. She designed the layout and placed a banner containing the
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!