subject

LAB: Convert to binary - methods Write a program that takes in a positive integer as input, and outputs a string of 1's and O's representing the integer in binary. For an integer X, the algorithm is:
As long as x is greater than 0
Output x 2 (remainder is either 0 or 1)
x = x/ 2
Note: The above algorithm outputs the O's and 1's in reverse order. You will need to write a second function to reverse the string
Ex: If the input is:
6
the output is:
110
Your program must define and call the following two methods. The method integerToReverseBinary should return a string of 1's and O's representing the integer in binary (in reverse). The method reverseString should return a string representing the input string in reverse.
public static String integerToReverseBinary(int integerValue)
public static String reverseString(String inputString)
Note: This is a lab from a previous chapter that now requires the use of a method.
ACTIVITY 6.32.1: LAB: Convert to binary-methods
LabProgram. java Load default template...
1 import java. util. Scanner;
2
3 public class convertToBinary 1
4
5 public static String integerToReverseBinary(int integervalue) {
6 String binary = "";
7 while (integervalue > 0) {
8 binary += String. valueof(integervalue % 2);
9 integervalue /= 2;
10
11 return binary;
12
13
14 public static String reverseString(String inputstring) {
15 String reversed = ""
16 for (char letter : inputstring. tocharArray() {
17 reversed = String. valueof(letter) + reversed;
18
19 return reversed;
6.34 LAB: Acronyms
An acronym of the input. If a word begins with a lower case letter, dont include that letter in the acronym. Assume there will be at least one upper case letter in the input.
Ex: If the input is:
Institute of Electrical and Electronics Engineers
the output should be:
IEEE
Your program must define and call a method thats returns the acronym created for the given userPhrase. public static String createAcronym(String userPhrase)
Hint: Refer to the ascii table to make sure a letter is upper case.
LAB ACTIVITY 6.34.1: LAB: Acronyms
LabProgram. java Load default template...
1 import java. util. Scanner;
2
3 public class Acronym {
4
5
6 public static String createAcronym(String userPhrase) {
7 string acronym = "";
8 for (String word: userPhrase. split("\\5+")) {
9
10 if (Character. i suppercase (word. charAt(e))) {
11 acronym += String. valueof(word. charAt(e)); NEOPHOBO
12
13
14
15 return acronym;
16
17
18
19 public static void main(String[] args) {
20
21 Scanner scanner = new Scanner(System. in);

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 22:00
Match the steps of the process to julia's analysis. 1. analyze choices. current costs for making phone calls to foreign countries averages between five and ten cents a minute. 2. determine the goals. julia needs to reduce the cost of telecommunications without reducing her employees' ability to do their jobs. 3. gather data. the corporate computer network will be able to handle the increased traffic that will occur as a result of voip. 4. evaluate the decision. julia will have her it department set up voip in the smallest domestic office. 5. make the decision. julia will have employees document the benefits and problems that result from using the new technology.
Answers: 1
question
Computers and Technology, 23.06.2019 11:20
Http is the protocol that governs communications between web servers and web clients (i.e. browsers). part of the protocol includes a status code returned by the server to tell the browser the status of its most recent page request. some of the codes and their meanings are listed below: 200, ok (fulfilled)403, forbidden404, not found500, server errorgiven an int variable status, write a switch statement that prints out the appropriate label from the above list based on status.
Answers: 2
question
Computers and Technology, 23.06.2019 16:30
What is one reason why indoor air pollution has become an increasing problem.
Answers: 1
question
Computers and Technology, 23.06.2019 23:30
The keyboard usually has six rows of keys. which of the following is not one of the key group categories? letter keys number keys control keys graphic keys
Answers: 1
You know the right answer?
LAB: Convert to binary - methods Write a program that takes in a positive integer as input, and out...
Questions
question
Mathematics, 13.01.2020 07:31
question
Mathematics, 13.01.2020 07:31
question
History, 13.01.2020 07:31
question
Chemistry, 13.01.2020 07:31
question
Mathematics, 13.01.2020 07:31
question
Mathematics, 13.01.2020 07:31