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
Jasper, a businessperson, has no connection with Yale University, but he has a new line of computer software that he would like
zheka24 [161]

Answer:

The answer is letter D.

Explanation:

It is unlikely that Jasper will be able to register the name "Yale Software," because it falsely suggests a connection to an institution.

3 0
4 years ago
4.12 LAB: Using math methods Given three floating-point numbers x, y, and z, output x to the power of z, x to the power of (y to
Greeley [361]

Answer:

The function is as follows:

import math

def func(x,y,z):

   print(math.pow(x, z))

   print(math.pow(x,math.pow(y, z)))

   print(math.fabs(y))

   print(math.sqrt(math.pow(x*y,z)))

Explanation:

This imports the math library

import math

This defines the function

def func(x,y,z):

Print the stated outputs as it is in the question

<em>    print(math.pow(x, z)) ---> x to power x</em>

<em>    print(math.pow(x,math.pow(y, z))) ---- x to power of y of z</em>

<em>    print(math.fabs(y)) ---- absolute of y</em>

<em>    print(math.sqrt(math.pow(x*y,z))) --- square root of xy power x</em>

<em />

4 0
3 years ago
What is the alogarithm for solving the perimeter of a triangle
Murljashka [212]
The answer is 11 cm
6 0
3 years ago
40 POINTS IF YOu ANSWER FOR EACH STEP.
NISA [10]

Answer:

4 beeps indicate a Memory Read / Write failure. Try re-seating the Memory module by removing and reinserting it in the slot. This could mean it could've just jiggled loose after a while or dust, there could be a hundred other problems but those are the two most common.n

Explanation:

8 0
3 years ago
Describe an unethical situation you might encounter at school. Discuss how you would handle the situation and explain why you wo
natali 33 [55]
If someone is threatening to shoot up the school, you would report it to the principal. You would handle it that way so the child can get arrested and nobody will be harmed.
5 0
3 years ago
Read 2 more answers
Other questions:
  • After a new technology is purchased,what are some additional costs that must be incorporated into an upgrade budget?
    6·1 answer
  • Edhesive 4.1 question 1
    9·1 answer
  • Explain Hayflick limit and why are HeLa cells able to live beyond the Hayflick limit?
    14·1 answer
  • A database administrator (DBA) must have a clear understanding of the fundamental business of an organization, be proficient in
    11·1 answer
  • What are the similarities and differences between the sample résumés, in terms of content and formatting?
    10·1 answer
  • A general-use dimmer switch is required to be counted as ? where installed in a single-gang box on a circuit wired with 12 awg c
    8·1 answer
  • Click this link to view O NET'S Wages and Employment section for Film and Video Editors.
    11·2 answers
  • Which of the following is NOT a font style? Color Bold Italic Regular
    10·2 answers
  • Networks, partnerships, and joint ventures are an example of
    7·1 answer
  • Which tool can you use to display hardware utilization statistics that tell you about the operation of your computer?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!