subject
Computers and Technology, 05.07.2021 19:30 bunnles

Code in Java: 1) Assume there is a class named Animal with an attribute named name of type String and a get method named getName. Assume there are two objects a1 and a2 of type Animal already declared and their names are already set. Write a java expression that checks if the names of the Animal objects a1 and a2 are equal.
2) Assume there is a class named Car with an attribute named model of type String and a get method named getModel. Assume there is an object c1 of type Car already declared and its model already set. Write a java statement that sets the variable ch of type char ( already declared) to the third character of the c1's model.
3) Assume there is a class Lamp having a private attribute named status of type boolean. Write a method named whatIsStatus for the Lamp class that accepts a Lamp object as its parameter and returns a text value based on the status of the passed object as follows:
if the status is true return "ON" , if the status is false return "OFF" , otherwise return "ERROR".

ansver
Answers: 3

Another question on Computers and Technology

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 17:30
When making changes to optimize part of a processor, it is often the case that speeding up one type of instruction comes at the cost of slowing down something else. for example, if we put in a complicated fast floating-point unit, that takes space, and something might have to be moved farther away from the middle to accommodate it, adding an extra cycle in delay to reach that unit. the basic amdahl's law equation does not take into account this trade-off. a. if the new fast floating-point unit speeds up floating-point operations by, on average, 2ă—, and floating-point operations take 20% of the original program's execution time, what is the overall speedup (ignoring the penalty to any other instructions)? b. now assume that speeding up the floating-point unit slowed down data cache accesses, resulting in a 1.5ă— slowdown (or 2/3 speedup). data cache accesses consume 10% of the execution time. what is the overall speedup now? c. after implementing the new floating-point operations, what percentage of execution time is spent on floating-point operations? what percentage is spent on data cache accesses?
Answers: 2
question
Computers and Technology, 25.06.2019 01:00
Regular maintenance is a key component of automotive lift safety.
Answers: 1
question
Computers and Technology, 25.06.2019 04:50
Your program should prompt the user for the dimensions of the two squares matrices, making sure that the user input is greater than or equal to 4.[ yes, an example would be a4x4matrix]2.if the above is not met, prompt the user for a new value.3.now generate random integernumbers to fill both matrices.4.display these two matrices on the screen.5.multiply the two matrices and display the result on the scre
Answers: 2
You know the right answer?
Code in Java: 1) Assume there is a class named Animal with an attribute named name of type String a...
Questions
question
Mathematics, 18.10.2019 23:30
question
English, 18.10.2019 23:30
Questions on the website: 13722361