File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes EJB and other Java EE Technologies and the fly likes Unsolved Programming Problem. Need Help. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Unsolved Programming Problem. Need Help." Watch "Unsolved Programming Problem. Need Help." New topic

Unsolved Programming Problem. Need Help.

mama mia

Joined: Jan 29, 2004
Posts: 1
Hello, All.
I'm working with inheritance. And, I'm having problem establishing an array that will hold all the entries I need. I don't know if I need to create a new object to hold the various types within the array. Or, create a different array for each type (variable). The more I work on the problem, the more confused I become. Can anyone please put me on the right path? I need to know if I am completely over doing this assignment that follows (this just the driver program):
import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.*;
public class PetRecordDemo
public static int ans;
public static int index;
public static Cat[] record = new Cat[3];//Array object to hold cat information
public static void main(String[] args)
PetRecord pet = new PetRecord();
Cat usersPet = new Cat();
System.out.println("This program collects basic pet information for Cats.\n");
System.out.println("My records on your Cat are inaccurate.");
System.out.println("Here is what they currently say:\n");
System.out.println("\nPlease enter the information for three Cats.");
for (index = 0; index < 3; index++)
record[index] = new Cat();
System.out.println("Please enter the correct name for cat number " + (index + 1) + ":");
String correctName = SavitchIn.readLine();
System.out.println("\nPlease enter the correct cat age:");
int correctAge = SavitchIn.readLineInt();
System.out.println("\nPlease enter the correct cat weight:");
double correctWeight = SavitchIn.readLineDouble();
System.out.println("\nPlease enter the correct cat breed: ");
String correctBreed = SavitchIn.readLine();
System.out.println("\nPlease enter whether the cat has CLAWS or NO CLAWS.");
System.out.println("Enter 1 for CLAWS, 2 for NO CLAWS.");
ans = SavitchIn.readLineInt();
usersPet.set(correctName, correctAge, correctWeight, correctBreed, usersPet.getClaw());
//for(index = 0; index < 3; index++)
//if(pet.getAge() > 3)
//}//end of for statement
System.out.println("\nMy updated records now say:");
System.out.println(" ");
Thank you.
Billybob Marshall
Ranch Hand

Joined: Jan 27, 2004
Posts: 202
I probably speak for most when I say you're being too non-specific, basically wanting someone to review your code and design for you (for free as well). Probably ain't gonna happen.
I agree. Here's the link:
subject: Unsolved Programming Problem. Need Help.
It's not a secret anymore!