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, 21.06.2019 20:40
Convert and simplify the following sentences to conjunctive normal form (cnf): (a) (p → (q → r)) → (p → (r → q)) (b) (p ∧ q) → (¬p ↔ q) (c) ((p → q) ∧ ¬q) → ¬p
Answers: 3
question
Computers and Technology, 22.06.2019 09:00
Meenu wants to create a high quality drawing in a variety of colours. which device should she use for the same?
Answers: 1
question
Computers and Technology, 22.06.2019 19:20
Amedian in the road will be marked with a white sign that has a black arrow going to the left of the median. true false
Answers: 1
question
Computers and Technology, 22.06.2019 22:50
Assume the existence of a bankaccount class. define a derived class, savingsaccount that contains two instance variables: the first a double, named interestrate, and the second an integer named interesttype. the value of the interesttype variable can be 1 for simple interest and 2 for compound interest. there is also a constructor that accepts two parameters: a double that is used to initialize the interestrate variable, and a string that you may assume will contain either "simple", or "compound", and which should be used to initialize the interesttype variable appropriately. there should also be a pair of functions getinterestrate and getinteresttype that return the values of the corresponding data members (as double and int respectively).
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
Biology, 02.04.2021 19:40
question
Mathematics, 02.04.2021 19:40
Questions on the website: 13722363