Your program has a loop. You want to pass control back to the start of a loop if a certain condition is met.
What statement will keep you in the loop but skip the rest of the code in the loop?
continue
exit
quit
break
Answer:
continue
Explanation:
what technical was the microscope invented in?
Answer:
Two Dutch spectacle-makers and father-and-son team, Hans and Zacharias Janssen, create the first microscope in 1590.
Explanation:
A microscope is an instrument that makes an enlarged image of a small object, thus revealing details too small to be seen by the unaided eye. The most familiar kind of microscope is the optical microscope, which uses visible light focused through lenses. Eeuwenhoek observed animal and plant tissue, human sperm and blood cells, minerals, fossils, and many other things that had never been seen before on a microscopic scale. He presented his findings to the Royal Society in London, where Robert Hooke was also making remarkable discoveries with a microscope.
Write a program that takes in a positive integer as input, and outputs a string of 1's and 0'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 0'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 functions. The function integer_to_reverse_binary() should return a string of 1's and 0's representing the integer in binary (in reverse). The function reverse_string() should return a string representing the input string in reverse.
def integer_to_reverse_binary(integer_value)
def reverse_string(input_string)
Note: This is a lab from a previous chapter that now requires the use of a function.
Answer:
#include <iostream>//header file
#include <string>//header file
using namespace std;
string integer_to_reverse_binary(int integer_value)//defining a method integer_to_reverse_binary
{
string ret = "";//defining string variable
while (integer_value > 0) //using while loop to check integer_value value is greater than 0
{
ret += '0' + (integer_value % 2);//adding zeros in remainder value
integer_value /= 2;//holding quotient value
}
return ret;//return string value
}
string reverse_string(string input_string)//defining a method reverse_string that holds a parameter user_String
{
string result;//defining a string variable
for (int i = 0; i < input_string.length(); ++i)//use for loop to calculate value
{
result += input_string[input_string.length()-i-1];//add value in result variable
}
return result;//result result variable value
}
int main()//defining main method
{
int num;//defining integer variable
string str;//defining string variable
cin >> num;//input num value
str = integer_to_reverse_binary(num);//use str variable to call the integer_to_reverse_binary method
cout << reverse_string(str) << endl;//printing the reverse_string method value
return 0;
}
Output:
6
110
Explanation:
In this code two string method "integer_to_reverse_binary and reverse_string" is defined that holds one parameter "integer_value and input_string".
In the first method a string variable is defined, that use the while loop to check integer value is greater than 0 and add zeros in the value and return its value as a string.
In the second it reverse the string value and store into the result variable, and in the main method the "num and str" variable is defined, and in the num it takes integer value and pass into the above method and print its return value.
Need help plz with the code
Answer:
its blocked
Explanation:
Classify the characteristics as abstract classes or interfaces.
A. Uses the implements keyboard
B. Cannot have subclasses
C. Does not allow static and final variables
D. Can have subclasses
E. Uses the extends keyboard
F. Allows static and final variables
______ are special characters that allow you to
search for multiple words at the same time.
-Find expressions
-Defined expressions
-Regular expressions
-Search expressions
Answer:
Defined Expression
Explanation:
This will be your answer
А ______
network is good for connecting computers over boundaries.
campus area
local area
wide area
system area
Answer:
wide area network (WAN)
Explanation:
Answer: B. Local area
A local area network is good for connecting computer clusters
In the binary system, 1 and 0 are not known as digits. Instead, they are called
bits
switches
flow
variables
decimals
Answer:
Variables
Explanation:
I hope it helps
Answer:
C variables
Explanation:
Why do we use return statements? Choose all that apply
A.
Javascript requires functions to have return values.
B.
To return multiple data types simultaneously
C.
To allow a function to give different values depending on input.
D.
So that we no longer have to use console.log();
E.
To save the result of a function in a variable in other functions
Answer:
A.
Javascript requires functions to have return values.
1. Write a class Name that stores a person’s first, middle, and last names and provides the following methods:
public Name(String first, String middle, String last)—constructor. The name should be stored in the case given; don’t convert to all upper or lower case.
public String getFirst()—returns the first name
public String getMiddle()—returns the middle name
public String getLast()—returns the last name
public String firstMiddleLast()—returns a string containing the person’s full name in order, e.g., "Mary Jane Smith".
public String lastFirstMiddle()—returns a string containing the person’s full name with the last name first followed by a comma, e.g., "Smith, Mary Jane".
public boolean equals(Name otherName)—returns true if this name is the same as otherName. Comparisons should not be case sensitive. (Hint: There is a String method equalsIgnoreCase that is just like the String method equals except it does not consider case in doing its comparison.)
public String initials()—returns the person’s initials (a 3-character string). The initials should be all in upper case, regardless of what case the name was entered in. (Hint: Instead of using charAt, use the substring method of String to get a string containing only the first letter—then you can upcase this one-letter string. See Figure 3.1 in the text for a description of the substring method.)
public int length()—returns the total number of characters in the full name, not including spaces.
2. Now write a program TestNames.java that prompts for and reads in two names from the user (you’ll need first, middle, and last for each), creates a Name object for each, and uses the methods of the Name class to do the following:
a. For each name, print
first-middle-last version
last-first-middle version
initials
length
b. Tell whether or not the names are the same.
Here is my code. I keep getting a method error with getFullName in the Name.java file. Please help me re-write the code to fix this issue.
//Name.java
public class Name
{
private String firstName, middleName, lastName, fullName;
public Name(String first, String middle, String last)
{
firstName = first;
middleName = middle;
lastName = last;
String fullName = firstName '+' middleName '+' lastName;
}
public String getFirst()
{
return firstName;
}
public String getMiddle()
{
return middleName;
}
public String getLast()
{
return lastName;
}
public String firstMiddleLast()
{
return firstName + ' ' + middleName + ' ' + lastName;
}
public String lastFirstMiddle()
{
return lastName + ", " + firstName + ' ' + middleName;
}
public boolean equals(Name otherName)
{
return fullName.equalsIgnoreCase(otherName.getFullName());
}
public String initials()
{
return firstName.toUpperCase().substring(0,1)
+ middleName.toUpperCase().substring(0,1)
+ lastName.toUpperCase().substring(0,1);
}
public int length()
{
return firstName.length() + middleName.length() + lastName.length();
}
}
//NameTester.java
import java.util.Scanner;
public class NameTester
{
public static void main(String[] args)
{
Scanner input = new Scanner(System.in);
String firstName1 = new String();
String middleName1 = new String();
String lastName1 = new String();
String firstName2 = new String();
String middleName2 = new String();
String lastName2 = new String();
System.out.print("\nPlease enter a first name: ");
firstName1 = input.nextLine();
System.out.print("Please enter a middle name: ");
middleName1 = input.nextLine();
System.out.print("Please enter a last name: ");
lastName1 = input.nextLine();
Name name1 = new Name(firstName1, middleName1, lastName1);
System.out.print("\nPlease enter another first name: ");
firstName2 = input.nextLine();
System.out.print("Please enter another middle name: ");
middleName2 = input.nextLine();
System.out.print("Please enter another last name: ");
lastName2 = input.nextLine();
Name name2 = new Name(firstName2, middleName2, lastName2);
System.out.println();
System.out.println(name1.firstMiddleLast());
System.out.println(name2.firstMiddleLast());
System.out.println(name1.lastFirstMiddle());
System.out.println(name2.lastFirstMiddle());
System.out.println(name1.initials());
System.out.println(name2.initials());
System.out.println(name1.length());
System.out.println(name2.length());
if (name1.equals(name2))
System.out.println("The names are the same.");
else
System.out.println("The names are not the same.");
}
}
i dont know the answer lol thats too long
Explanation:
CH4 has how many of each type of atom?
Its easy that moderators that see this answer can think that my answer isn't without explanation.
• Type of atom C (Carbon)
C = 1
• Type of atom H (Hydrogen)
H = 4
You dont understand? JUST SEE THE FORMULA C MEANS ONLY HAVE 1 CARBON ATOM AND H4 MEANS 4 ATOM OF HYDROGEN
oK. have a nice day hope you understands
What is the influence of new technology on society?
Ο Α. .
New technology hardly has any impact on society.
OB.
New technology is only beneficial to society and cannot be detrimental.
OC.
New technology is detrimental, as it makes the existing technology obsolete.
OD. New technology normally utilizes a lot of resources and can adversely affect the economy.
O E.
New technology is beneficial but can also be usedly a detrimental way.
Answer:
E. New technology is beneficial but can also be used in a detrimental way.
Explanation:
New technology such as cryptocurrency (powered by blockchain technology) can be regarded as a welcome development that has benefited the society in so many good ways. However, cryptocurrency as a new technology also has disadvantages it presents to the society. One of such negative influence cryptocurrency has is that it can be used for illicit activities such as money laundering, funding terrorism and so on.
So, in summary, we can conclude that:
"New technology is beneficial but can also be used in a detrimental way."
How does the pay for many Science, Technology, Engineering, and Mathematics workers compare to the overall median for all careers? It is far lower than the overall median. It is far higher than the overall median. It is slightly higher than the overall median. It is about the same as the overall median.
Answer:
B
Explanation:
It just is
Answer:
B is correct
Explanation:
What infection type can send information on how you use your computer to a third party without you realizing it
Answer:
Spyware collects your personal information and passes it on to interested third parties without your knowledge or consent. they also install trojan horses
Explanation:
Which of the following is a contact force?
A. friction
B. magnetism
C. gravity
D. electricity
Answer:
A
Explanation: