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
strojnjashka [21]
3 years ago
12

You have been handed a mysterious piece of data by an unknown person. Judging by his shifty eyes and maniacal laughter you don't

think he can be trusted. Complete the below method to tell you the type for this unknown data. The example already implemented can be adapted for other wrapper classes as well. Complete the method to analyze String, Character, and Double. Examples: whatAmI(1) -> "Integer" 1 public String whatAmI(E e) { 3 //.getClass() returns the runtime class of an object //.equals() determines whether two objects are equivalent //by calling a new static instance of a wrapper object we can analyze //it's class type and compare it to the variable passed in if(e.getClass().equals(new Integer(1).getClass()) { return "Integer"; }else{ return "Who knows!"; Given a word, use a stack to reverse the word and return a new string with the original word in reverse order. You cannot use the reverse string methods in the String class. Examples: reverseword("hello") -> "olleh" reverseword("hallo") -> "ollah" i public String reverseWord(String word) Stack character> stack = new Stack ;
Computers and Technology
1 answer:
irga5000 [103]3 years ago
5 0

Answer:

Java Code given below with appropriate comments for better understanding

Explanation:

1.

public String whatAmI(E e) {

//.getClass() returns the runtime class of an object

//.equals() determines whether two objects are equivalent

//by calling a new static instance of a wrapper object we can analyze

//it's class type and compare it to the variable passed in

if(e.getClass().equals(new Integer(1).getClass())) {

return "Integer";

}

else if(e.getClass().equals(new String("1").getClass())) {

return "String";

}

else if(e.getClass().equals(new Double(1.0).getClass())) {

return "Double";

}

else {

return "Who knows!";

}

}

2.

public String reverseWord(String word) {

   Stack<Character> stack = new Stack<Character>();

   for (int i = 0; i < word.length(); i++) {

       stack.push(word.charAt(i));

   }

   String result = "";

   while (!stack.isEmpty()) {

       result += stack.pop();

   }

   return result;

}

You might be interested in
Convert 578.2 into hexadecimal​
Digiron [165]

Answer:

242.33333333

Explanation:

578.2

578÷16 -> 36 R 2

36 ÷16 -> 2 R 4

242.

.2 x 16 -> 3.2 F 3

.2 x 16 -> 3.2 F 3

.2 x 16 -> 3.2 F 3

.2 x 16 -> 3.2 F 3

.2 x 16 -> 3.2 F 3

.2 x 16 -> 3.2 F 3

.2 x 16 -> 3.2 F 3

.2 x 16 -> 3.2 F 3

.33333333

242.3333333

4 0
3 years ago
Information is best described as
Viefleur [7K]

Answer: Option B

Explanation: Information can be defined as the presentation of scattered data in a sequential manner to make it more meaningful and understanding.

Information is the exchange of intelligence, thus, it has to be organized and processed from its raw form.

From the above explanation we can conclude that the right option is B.

7 0
3 years ago
What is the ethical danger of using agents in negotiation?
Mariulka [41]
Information sharing, divergent interests, conflicting interests
6 0
3 years ago
How did Bill Gates benefit from free enterprise? Need a paragraph please. Will give the branliest!!
olchik [2.2K]

Answer:

Bill Gates used his skills and brains to build a business. In conclusion, Bill Gates was very successful with his industry thanks to free enterprise. He, along with his employees and friends, created and almost perfected the software known as Microsoft. The free enterprise system provides the right to private enterprise, which allowed him to choose his own business and to run it without governmental influence. Because he could create his own business and design his own products, Gates was able to specialize in technology.

Explanation:

8 0
3 years ago
How should your fingers rest upon the home row keys?
xxTIMURxx [149]

Answer:

Your left index finger should rest on the "f" key which can be found easily by using your touching senses because there is a bump on the "f" , and the "j" Key your right index finger should rest on the "j" Key, Your thumbs can rest on the space bar

7 0
2 years ago
Other questions:
  • In the game of economics, which player has the role of providing goods and services
    10·1 answer
  • GUI stands for "___ user interface."
    9·2 answers
  • The___provides access to the internet; may also be internal
    11·1 answer
  • This problem has been solved!
    8·1 answer
  • Before its final commercial release, a(n) ________ version of software may be offered to certain test sites or to interested use
    6·1 answer
  • What factor(s) should be considered when determining whether a business is too far based on the query and the user location? Sel
    10·1 answer
  • Define a new class Fighter that inherits from Spaceship. Add a variable property weapon that defaults to an empty string and a v
    14·1 answer
  • when files on storage are scattered throughout different disks or different parts of a disk, what is it called
    10·1 answer
  • Write the function powersOf3ToN(n) that takes a possibly-negative float or int n, and returns a list of the positive powers of 3
    10·1 answer
  • Range paramters - for loop<br> question in picture
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!