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
asambeis [7]
3 years ago
7

Write a Java program that prompts for integers and displays them in binary. Sample output: Do you want to start(Y/N): y Enter an

integer and I will convert it to binary code: 16 You entered 16. 16 in binary is 10000. Do you want to continue(Y/N): y Enter an integer and I will convert it to binary code: 123 You entered 123. 123 in binary is 1111011. Do you want to continue(Y/N): y Enter an integer and I will convert it to binary code: 359 You entered 359. 359 in binary is 101100111. Do you want to continue(Y/N): y Enter an integer and I will convert it to binary code: 1024 You entered 1024. 1024 in binary is 10000000000. Do you want to continue(Y/N): n
Computers and Technology
1 answer:
klasskru [66]3 years ago
8 0

Answer:

Explanation:

The following code is written in Java and creates a loop that cycles the same prompt until the user states no. While the loop runs it asks the user for an integer value and returns the binary code of that value

public static void main(String[] args) {

               Scanner in = new Scanner(System.in);

               boolean continueLoop = true;

               while (continueLoop) {

                   System.out.println("Would you like to continue? Y/N");

                   String answer = in.nextLine().toLowerCase();

                   if (answer.equals("y")) {

                       System.out.println("Enter int value: ");

                       int number = in.nextInt();

                       System.out.println("Integer: "+number);

                       System.out.println("Binary = " + Integer.toBinaryString(number));

                   } else if (answer.equals("n")){

                       System.out.println("breaking");

                       break;

                   }

               }

       }

You might be interested in
Does any body like animal jam
cricket20 [7]

Answer:

Never used it so I do not know.

Explanation:

To be honest i thought you meant like animal jelly at first

7 0
4 years ago
Read 2 more answers
The body element is where you provide browsers with information about the document
Yuliya22 [10]

The answer is False

The description above is the function of the head or the title element. The title element is used to identify the contents of an entire document. The title element may only appear once. On the other hand, the body element contains all of the content of an HTML document.


8 0
3 years ago
Discuss FOUR challenges that have an impact on domestic tourism
shutvik [7]
Crime rate
unemployment
fluctuations
suspension of terrorism
5 0
4 years ago
7.2 code practice edhesive. I need help!!
GaryK [48]

Answer:

It already looks right so I don't know why it's not working but try it this way?

Explanation:

def ilovepython():

    for i in range(1, 4):

         print("I love Python")

ilovepython()

6 0
3 years ago
4. What is the difference between portrait orientation and landscape orientation? (1.0 points)
Bezzdna [24]

Answer:

Portrait orientation is taller then it is wide, while landscape orientation is wider then it is tall.

Explanation:

3 0
4 years ago
Other questions:
  • As you apply to college when should you apply for financial aid
    9·1 answer
  • Define application pakage​
    5·2 answers
  • Which type of business is best for Juanita to start? a corporation, because she needs a large investment to get started a sole p
    13·2 answers
  • What is the result when you run the following program?<br> print("2 + 7')<br> print(3 + 1)
    6·2 answers
  • a. Create an Abstract class called Vehicle with abstract methods accelerate, stop, and gas, &amp; data of your choice (5 marks)
    12·1 answer
  • Which of the following are correct? I. Hold the middle mouse button to rotate the model on the screen. II. To pan the model, hol
    15·1 answer
  • The Analytics tracking code can collect which of the following? (select all answers that apply) (1)-Language the browser is set
    15·1 answer
  • What is presentation software in bussiness used for
    9·1 answer
  • What is the output?
    11·2 answers
  • Chloe is creating the software requirements specifications (SRS) for a project. The project is a web app that allows students to
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!