(Decimal to binary) Write a recursive method that converts a decimal number into a binary number as a string. The method header is public static String dec2Bin(int value) Write a test program that prompts the user to enter a decimal number and displays its binary equivalent.

Answers

Answer 1

Answer and Explanation:

import java.util.Scanner;

public class convertToBinary {

public static String declToBin(int value){

if(value == 1){

return declToBin((value/2) + "" + (value%2);

}

else{

declToBin((value/2) + "" + (value%2);

}

}

public static void main(String args[]){

int number;

Scanner change = new Scanner(System.in);

System.out.print("Enter decimal value: ");

number = change.nextInt();

System.out.println(declToBin(number));

}

}

The recursive function declToBin(int value) keeps executing code until value==1. Recursive functions reduces lines of code and makes it more efficient.

Note: Decimal is number in base 10(denary). To convert a decimal number to base 2(binary), we keep dividing the decimal number entered by the user by 2 until the result is zero(when the number divided is one)

We use the Java programming language here. First we import the Scanner object(import.java.util.Scanner). We use the method nextint() from the object to convert the string value entered by the user to int value( because our declToBin function takes an int parameter).


Related Questions

What is the function of the operating system of a computer?

It allows the CPU to communicate with input and output devices.
It executes commands from other computer hardware.
It lets the user communicate with the mouse.
It processes information from the hard drive to allow programs to run.

Answers

Answer:

It allows the CPU to communicate with input and output devices.

Explanation:

Plzzzzzzzzzzzzz give me brainiest

Ms office suite comes with its own set of pictures in the​

Answers

Answer:

clipart ...........................

Explanation:

clipart is the correct answer for the above question.

Which of the following is a real job title on The interactive media career pathway?

Answers

Answer:

The right answer is A

Explanation:

Plzzzzzzzzzzzzz give me brainiest

The answer to your question is B

An inkjet printer’s output appears to have missing elements. What is the first thing a technician should try if the ink cartridge appears to be full?

Answers

Answer:

Check the printing properties or print test page.

Explanation:

In a situation whereby an inkjet printer’s output appears to have missing elements. The first thing a technician should try if the ink cartridge appears to be full to "Check the printing properties."

This helps to serve as a maintenance technique or solve the ink cartridge problems.

Depending on the windows or PC's Operating System. To check the printer's properties on Windows 7, a user will have to click on the “Start” button > Control panel > Devices and Printers. Followed by right-clicking the printer icon and open up “Printer Properties” and click “Print Test Page”

what's a website layout

Answers

Answer:

Explanation:

A website layout is a pattern (or framework) that defines a website's structure. It has the role of structuring the information present on a site both for the website's owner and for users. It provides clear paths for navigation within webpages and puts the most important elements of a website front and center.

Effective home page layout is all about making your website easy to use and navigate. It allows you to steer your visitors' focus to things you want them to pay extra attention to. Let's get started on what to include in an effective home page, and we'll dive into some specific examples and layouts!

How DNS service are to be deployed on the network (15 -30 words)

Answers

Each device connected to the Internet has a unique IP address which other machines use to find the device. DNS servers eliminate the need for humans to memorize IP addresses such as 192.168.1.1 (in IPv4), or more complex newer alphanumeric IP addresses such as 2400:cb00:2048:1::c629:d7a2 (in IPv6).

plsss help me
give two examples of problems that can occur when sytems do not work properly​

Answers

Answer:

Explanation:

1. There can be a run out of something ex. The water cycle we could run out of water if evaporation stops happening

2. Something wont happen ex. In a shoe factory if no one is boxing the shoes the shoes don’t get boxed.

Hope this helps

The sensitivity range for an objective function coefficient is the range of values over which the current __________________ remains the same.

Answers

Answer:

Optimal solution point

Explanation:

The sensitivity range for an objective function coefficient is the range of values over which the current optimal solution point remains the same.

Additionally, the range of optimality can be defined as the optimality range with respect to an objective coefficient that comprises of the range of values over which a current optimal solution point will always remain optimal.

Hence, the managers supervising various production lines are saddled with the responsibility of focusing on the objective function coefficient for optimal level of output or productivity.

descriptive paragraph about a forest beside a lake

Answers

Luscious green leaves of the forest blew in the lukewarm winds of the day. The crystal waters of the lake just beside me reflected the forest in all its glory. The lake feel frigid, but the forest made me feel warm again. A sight to see, and a wonderful place to be was that gorgeous forest by the lake.

the term technology is derived from the Chinese word. it is true or false​

Answers

Answer:

True

Explanation:

it's your perfect answers

Yes it is true
Its true

1. Identify one modern technology and discuss its development and discuss what future changes might occur that could have an even greater impact on your life.

2. Identify one environmental and organizational background imperative of a contemporary technology. How might those conditions have influenced that technology’s development?3. Solve (2011) uses the hammer and an example of his concept polypotency; what are some other examples of familiar artifacts?

Answers

Explanation:

1- The cell phone is a modern technology that has been developing and gaining new features in addition to being just a device for making phone calls. Currently cell phones perform the same tasks as computers, making it possible to exchange information from the internet, share media, etc.

The development of smartphones will still be significant and will impact even more on the lives of all users, as an essential device for communication at work, and through software developed for cell phones that facilitate human life, such as through the possibility of making purchases , order a taxi, carry out bank transactions, etc.

2- A management information system is a technology aimed at organizations, in order to assist a manager in the decision-making process.

An MIS is an intelligent system that uses a large volume of data and information to generate information and solutions so that a manager has a greater chance of analyzing a scenario in the organization, and makes a more effective decision for the company.

The system is derived from procedures and interaction between people, which generates constant learning and improvement focused on organizational decisions.

MIS was created to assist current organizational management, whose processes derive from a large amount of data and information, in addition to the high competitiveness in the market, which requires decisions to be made quickly, effectively and at the lowest cost.

3- The cell phone and the computer are examples of polypotent technologies, that is, those that are used for purposes greater than those for which they were created, for example, the computer was created to compute data, and the cell phone to make telephone calls, but currently perform functions of being media sharing, communication and leisure equipment.

Please solve the ones you can. Solving Both will be appreciated. thank you

Answers

Answer:a=b+c=2ca

Im not sure about this answer

Explanation:

Write a program that will add the content of two counters every 45 seconds and place the result in an integer register.

Answers

Answer:

Explanation:

The following code is written in Java and runs a thread every 45 seconds that adds the two counters together and saves them in an integer variable called register. Then prints the variable. If this code runs 5 times it automatically breaks the loop. This can be changed or removed by removing the breakLoopCounter variable.

 public static void add_Counters(int counterOne, int counterTwo) {

       int register = 0;

       int breakLoopCounter = 0;

       try {

           while (true) {

               register += counterOne + counterTwo;

               System.out.println(register);

               Thread.sleep(45000);

               breakLoopCounter += 1;

               if (breakLoopCounter == 5) {

                   break;

               }

           }

       } catch (InterruptedException e) {

           e.printStackTrace();

       }

   }

Write a program that lets the user play the game Rock, Paper, Scissors against the computer. The program should:

Answers

Answer:

import random

def simulateRound(choice, options):

   compChoice = random.choice(options)

   if choice == compChoice:

       return ["Tie", compChoice]

   elif choice == "rock" and compChoice == "paper":

       return ["Loser", compChoice]

   elif choice == "rock" and compChoice == "scissors":

       return ["Winner", compChoice]

   elif choice == "paper" and compChoice == "rock":

       return ["Winner", compChoice]

   elif choice == "paper" and compChoice == "scissors":

       return ["Loser", compChoice]

   elif choice == "scissors" and compChoice == "rock":

       return ["Loser", compChoice]

   elif choice == "scissors" and compChoice == "paper":

       return ["Winner", compChoice]

   else:

       return ["ERROR", "ERROR"]

def main():

   

   options = ["rock", "paper", "scissors"]

   choice = input("Rock, Paper, or Scissors: ")

   choice = choice.lower()

   if choice not in options:

       print("Invalid Option.")

       exit(1)

   result = simulateRound(choice, options)

   print("AI Choice:", result[1])

   print("Round Results:", result[0])

if __name__ == "__main__":

   main()

Explanation:

Program written in python.

Ask user to choose either rock, paper, or scissors.

Then user choice is simulated against computer choice.

Result is returned with computer choice.

Result is either "Winner", "Loser", or "Tie"

Cheers.

Write a for loop to print the numbers 88, 84, 80, ...44 on one line. Expected Output 88 84 80 76 72 68 64 60 56 52 48 44

Answers

The solution in python is:

for x in range(88, 43, -4):

   print(x, end=" ")

I hope this helps!

hai ima guurl andd here r the lyricss to mah favorite song
All I need is a little love in my life
All I need is a little love in the dark
A little but I'm hoping it might kick start
Me and my broken heart
I need a little loving tonight
Hold me so I'm not falling apart
A little but I'm hoping it might kick start
Me and my broken heart
Yeah
Shotgun, aimed at my heart, you got one
Tear me apart in this song
How do we call this love
I tried, to run away but your eyes
Tell me to stay oh why
Why do we call this love
It seems like we've been losing control
So bad it don't mean I'm not alone
When I say
All I need is a little love in my life
All I need is a little love in the dark
A little but I'm hoping it might kick start
Me and my broken heart
I need a little loving tonight
Hold me so I'm not falling apart
A little but I'm hoping it might kick start
Me and my broken heart
Maybe some part of you just hates me
You pick me up and play me
How do we call this love
One time tell me you need me tonight
To make it easy, you lie
And say it's all for love
It seems like we've been losing control
So bad it don't mean I'm not alone
When I say
All I need is a little love in my life
All I need is a little love in the dark
A little but I'm hoping it might kick start
Me and my broken heart
I need a little loving tonight
Hold me so I'm not falling apart
A little but I'm hoping it might kick start
Me and my broken heart
Me and my broken heart
Me and my broken
Yeah, yeah, yeah
It's just me
It's just me
It's just me
Me and my broken heart
All I need is a little love in my life
All I need is a little love in the dark
A little but I'm hoping it might kick start
Me and my broken heart
I need a little loving tonight
Hold me so I'm not falling apart
A little but I'm hoping it might kick start
Me and my broken heart

Answers

Answer:wow that’s a lot of lyrics but intersting

Explanation:

Answer:

that's a cool song

Explanation:

have a great day:)

differences between formula and function as used in spreadsheet​

Answers

I hope it is helpful for you ...

How do I fix my mistake in the code, do not give me a bs answer like “I don’t know sorry” if you do not know just move on because I will report it like I have before.

Answers

The problem lies within your if statement. You're using a single equals sign when you should be using two.

if (operation == 1)

Two equal signs is a comparison operator. It checks to see if one value equals another value. In your case, its checking if operation equals 1. But, this only solves half the problem. Operation is a string and you need to compare it to a string.

if (operation == "1")

I hope this helps!

Write a complete program that reads a string and displays the vowels. The vowels are A, E, I, O, U and a, e, i, o, u. Here are three sample runs:Sample Run 1Enter a string: Welcome to PythonThe vowels are eoeooSample Run 2Enter a string: Student UnionThe vowels are ueUioSample Run 3Enter a string: AREIOUaeiouRTEThe vowels are AEIOUaeiouENote: your program must match the sample run exactly.using python

Answers

text = input("Enter a string: ")

new_text = ""

vowels = "aeiou"

for x in text:

   if x.lower() in vowels:

       new_text += x

print(new_text)

I hope this helps!

Start making better decisions with the world's leading survey platform. Already have an account? Log in for faster support.

Answers

Answer: ummmm is that a question?!?

Explanation:

Answer:

Mark brainliest please

which of the following file formats cannot be imported using Get & Transform?

Answers

Answer:

The answer to this question is given below in the explanation section.

Explanation:

In this question, the given options are:

A.) Access Data table

B.)CVS

C.)HTML

D.)MP3

The correct option to this question is D- MP3.

Because all other options can be imported using the Get statement and can be further transformed into meaningful information. But MP3 can not be imported using the GET statement and for further Transformation.

As you know that the GET statement is used to get data from the file and do further processing and transformation.

Please help. Will give brainliest

Answers

I don’t understand it sorry :(.

100 points and brainlist....................................................................................................................................................................................................................... It Takes a Village! In every business, it takes more than one person to create success - whether you are talking about a berry farm, a historic theater, a popular amusement park, or an expanding coffee chain. While you watch the videos, notice how many different people work together to support and sustain these operations. Cogdell Berry Farm Fox Theatre Six Flags Jittery Joes Now, let's put it all together by creating a presentation entitled "It Takes a Village." Your presentation could either be a word document, a digital mind map, or a slideshow, but it must include a chart and research paragraph for each company. In your presentation, you should create a visual chart or slideshow featuring each company and highlighting at least two different jobs that are needed to keep each company running. Make it clear that each company is comprised of many different positions and discuss how people with different skills and interests work together to contribute to a successful enterprise. Finally, pick out one career from each video and do some additional research on it. Let's consult our handy reference, the Bureau of Labor Statistics' Occupational Outlook Handbook once again to find more information. This time check out the headings 'How to Become One,' 'Pay,' and 'Job Outlook' for each career you choose. Your presentation should include the following content: A chart/slideshow that describes each of the four companies with at least two jobs discussed in each company. In depth research on one job per company, including: How to Become One Pay Job Outlook However you choose to arrange your presentation, make sure to show clearly that the companies you learned about rely on more than one position to keep things running smoothly.

Answers

Answer:  what do i need to do Im confused I will edit my answer to answer correctly to help you Have a Nice day and that was a very nice trick

Explanation:

Answer:

give them brainliest :)

Explanation:

Assume a large shared LLC that is tiled and distributed on the chip. Assume that the OS page size is 16KB. The entire LLC has a size of 32 MB, uses 64-byte blocks, and is 32-way set-associative. What is the maximum number of tiles such that the OS has full flexibility in placing a page in a tile of its choosing?

Answers

Answer:

19 - 22 bits ( maximum number of tiles )

Explanation:

from the given data :

There is 60 k sets ( 6 blocks offset bits , 16 index bits and 18 tag bits )Address has 13-bit page offset and 27 page number bits14-22 bits are used for page number and index bits

therefore any tour of these bits can be used to designate/assign tile number

so the maximum number of tiles such that the OS has full flexibility in placing a page in a tile of its choosing can be between 19 -22 bits

Iman manages a database for a website that reviews movies. If a new movie is going to be added to the database what else will need to be added.

Answers

Answer:

The answer would be a record.

Explanation: Took the test

why is monitor called softcopy output device?​

Answers

Answer:

A display device is the most common form of output device it presents output visually on a computer screen.the output appears temporarily on the screen and can easily altered or erased,it is sometimes referred to as softcopy

PLS HELP I WILL MARK BRAINLIEST

Answers

Answer:

C

Explanation:

Animal cells each have a centrosome and lysosomes, whereas plant cells do not. Plant cells have a cell wall, chloroplasts and other specialized plastids, and a large central vacuole, and animal cells do not.

A ____________ monitor measures the usage of a cloud-based IT resource by a given cloud consumer for billing purposes.

Answers

Answer:

pay-per-use monitor

Explanation:

The pay-per-use monitor mechanism can be described as a measurement of cloud-based IT resource usage which are in line with already defined pricing parameters and which can generate usage logs which are used for the calculations of accumulated fees calculations and are also used for billing purposes. This service uses models that are subscription based and also consumption based.

Varied amount of input data Statistics are often calculated with varying amounts of input data. Write a program that takes any number of integers as input, and outputs the average and max. Ex: When the input is 15 20 0 5, the output is:

Answers

In Python 3.8:

nums = list(map(int, input("Enter your numbers space separated: ").split()))

print(f"The largest number is {max(nums)} and the average of all the numbers entered is {sum(nums)/len(nums)}")

Using a third-party package of your choice, write a program that reads the contents of a csv file and saves it to an Excel file. The program should take two arguments. The name of the input file and the name of the output file.

Answers

Answer:

import pandas as pd

df = pd.read_csv("file_csv")

df.to_excel("file.xlsx", sheet_name = "name_of_sheet")

# or use: with df.ExcelWriter("file.xlsx", mode='a') as file,

#df.to_excel(file, sheet_name= "sheet name")

Explanation:

This python source code uses the pandas package to read csv (comma separated values) file and converts it to an excel file (xlsx) using the read_csv and ExcelWriter methods respectively.

Other Questions
CAN SOMEBODY HELP ME WITH THIS?????? I WILL MARK BRAINLIESTCAN SOMEBODY HELP ME WITH THIS?????? I WILL MARK BRAINLIEST jaleia borrows $1500 from the bank. To pay back the loan this year, she will pay the bank the amount she borrowed plus 12% simple interest. Jaleia wants to know the total amount she will pay back[tex]y \\ [/tex] A ski lodge sells 50additional ski passes for every 34inch of snow that falls overnight.Which equation describes the relationship between p, the number of ski passes sold, and s, the inches of snowfall? Name 2 fundamental units of SI system except that of MKS system. HELP ME IS SUPER NOT SMART Which compound inequality has no solution? x > 2 and 3x 9 x > 1 and 2x 2 x > 1 and 4x 8 x > 2 and 5x 15 Three isotopes of argon occur in nature. Calculate the average atomic mass of argon given the following relative atomic masses and abundances of each of the isotopes. Isotope Relative Atomic Mass AbundanceAr-36 35.97 amu 0.337%Ar-38 37.96 amu 0.063%Ar-40 39.96 amu 99.600% a35.97 amu b37.95 amu c39.95 amu d38.96 amu Geologic Time ScaleTime Period Duration (Millions of Years ago)Cenozoic 66-0Mesozoic 252-66Paleozoic 541-252Trilobites appeared approximately 521 years ago and disappeared approximately 250 million years ago. During which era did the trilobites live? aCenozoic bMesozoic cPaleozoic dNone of These Leaves are composed of vascular tissue that brings water in so that ground tissue can conduct photosynthesis. Based on this information, what level of organization describes leaves? Tissue Tissue Organ Organ Organ system Organ system OrganismOrganism Punctuate the following sentence correctly using commas, semicolons, or colons.I have not eaten any of the following vegetables green beans, brussels sprouts, cabbage, and asparagus.A. I have not eaten any of the following vegetables: green beans, brussels sprouts, cabbage, and asparagus.B. I have not eaten any of the following vegetables; green beans, brussels sprouts, cabbage, and asparagus.C. I have not eaten any of the following vegetables, green beans, brussels sprouts, cabbage, and asparagus.D. I have not eaten any of the following vegetables green beans, brussels sprouts, cabbage, and asparagus. Find the number,if 1/5 of it is 15 Show how you would simplify the following expressions. Show your work. I dont understand how to do this question please help and explain thank you! Downing Company issues $4,000,000, 8%, 5-year bonds dated January 1, 2020 on January 1, 2020 (ten periods). The bonds pay interest semiannually on June 30 and December 31. The bonds are issued to yield 5%. What are the proceeds from the bond issue? The gulf stream and global warming reading passage answers ? >) Jaxson and Bryon collected an equal amount ofmoney during a car wash. They collected cash andchecks as shown below. If each check is written forthe same amount, x, what is the total amount ofmoney collected by both boys? Explain.JaxsonBryanJaxsonBryon Read this excerpt from Through the Looking-Glass by Lewis Carroll Shortly after Alice sings this song. Tweedledee and Tweedledum begin to battle This is evidence that "I'm sure I'm very sorry," was all Alice could say, for the words of the old song kept ringing through her head like the ticking of a clock, and she could hardly help saying them out loud - walking backward means going forward in the looking-glass land one has to run quickly in order to stand still in the looking-glass land O fictional characters are real in the looking-glass land things happen only every other day in the bar "Tweedledum and Tweedledee Agreed to have a battle, For Tweedledum said Tweedledee Had spoiled his nice new rattle glass land Just then flew down a monstrous crow As black as a tar-barrel Which frightened both the heroes so, They quite forgot their quarrel." Which pair of lines are perpendicular? A. x - y = 7 and y = x + 3B. y = -4x + 1 and 8x + 2y = -10 C. y = -8 and y = 2 D. x = 4 and y = -1 Which one of these words describe mirror image A.Translation B.Dialation C.Reflection D.Rotation What is an equation of the line that passes through the points (-4,-3) and (3,-3)