Tuesday
July 29, 2014

Homework Help: Programming

Posted by Rob on Wednesday, October 28, 2009 at 2:17am.

Here is the source code for the Kitty class:
public class Kitty {

String name;
int age;

public Kitty(){
}

public void setName(String n){
name = n;
}

public String getName(){
return name;
}

public void setAge(int a){
age = a;
}

public int getAge(){
return age;
}
}

1) The array myCats is an 8 element array of type Kitty that has already been declared and initialized. Write the expression(s) in the box below that increases the age of the fifth Kitty by one year:

(Remember: the first element of an array is at index position 0).

2)The array myCats is an 8 element array of type Kitty that has already been declared and initialized. Write the expression(s) in the box below that prints to the console the name of the fourth Kitty if its age is strictly greater than the age of the fifth Kitty, and prints the name of the fifth Kitty otherwise:

(Remember: the first element of an array is at index position 0).

Answer this Question

First Name:
School Subject:
Answer:

Related Questions

programming - m trying to create an arraylist that's sorted but I have no idea ...
Programming - The code below shows some of the text for a class called City. Now...
Java Panel Problem - I am supose to draw a grid and center it with a 10 pix ...
computer science - Im trying to create an arraylist that's sorted but I have no ...
shabou - Can someone please make a Binarytree of these methodes in Java?: public...
Java - 1 public class testOperators 2 { 3 public static void main(String[] args...
Java - I need help putting the following trace into pseudocode 1 public class ...
Computer - Question 1 In the code below, there is an ambiguous reference in the ...
Java programming - List all overloading methods (including constructors) in this...
java programming - Provide a class called Letter for authoring a simple letter. ...

Search
Members