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, 22.06.2019 17:00
Which of the following is not contained on the slide show toolbar? a. next button b. slide button c. close button d. pen tool
Answers: 1
question
Computers and Technology, 22.06.2019 19:50
Write a car class having two private member variables called tank and speed. write public methods called pumpgas and gofast. the method pumpgas gets an integer for gas that must be pumped. that value needs to be added to tank (no more than 20 gallons). it must return the amount of gas that is purchased ($4 per gallon). the method gofast should increase the speed by 5 each time it is called.write a constructor for the above class that initialized both variables to zero.write a tostring to display both the tank and speed when the car is printed.modify the car class to implement the interface comparable and an interface called carinter having the public methods in carinter.write the main program to create an array of size 5 of type car. create 5 car objects having each location of the array to refer to one of the cars. test the pumpgas, gofast, equals method on the array items. write an enhanced loop to print all the car values (using a tostring written last time).write a generic method to find the minimum of four items. pass int, double, char, string and car objects to test this method.
Answers: 1
question
Computers and Technology, 22.06.2019 22:30
What is the most popular genre of video games?
Answers: 1
question
Computers and Technology, 24.06.2019 10:10
Which view in a presentation program displays a split window showing the slide in the upper half and a blank space in the lower half?
Answers: 1
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, 23.02.2021 19:20
question
Mathematics, 23.02.2021 19:20
question
Mathematics, 23.02.2021 19:20
question
Mathematics, 23.02.2021 19:20
question
Mathematics, 23.02.2021 19:20
Questions on the website: 13722360