Forum: MySQL Nov 28th, 2008 |
| Replies: 4 Views: 1,027 Hi, I have this problem to solve
My solution is as below:
CREATE DATABASE IF NOT EXISTS my_address_book;
USE my_address_book;
DROP TABLE IF EXISTS person;
CREATE TABLE person( |
Forum: Java Nov 12th, 2008 |
| Replies: 8 Views: 724 How do I do this on the Human class? It's proving hard for me. And remember the "instanceof" part of it |
Forum: Java Nov 12th, 2008 |
| Replies: 8 Views: 724 How about the "instanceof" ? How can I create array of limbs and use the instanceof? |
Forum: Java Nov 12th, 2008 |
| Replies: 8 Views: 724 Hi, I have an assignment that's giving me some problem:
My code for the Human class is as:
import java.util.*;
public abstract class Human extends Mammal
{
int MyAge,Age;
String... |
Forum: Java Nov 10th, 2008 |
| Replies: 5 Views: 470 How do I add more scenarios? does it mean adding another try catch block? |
Forum: Java Nov 10th, 2008 |
| Replies: 5 Views: 470 Hi, I had posted this question before and I did appreciate the response I got. However I still need some little help as:
1.In the addMovieGoers method check that every member of the collection is a... |
Forum: Java Nov 4th, 2008 |
| Replies: 11 Views: 797 look at the method below
public void addMovieGoers(Human h) throws IllegalAgeException
{
Human a = new Adult("Joe",43);
Human b = new Adult("Sue",39);
Human c = new... |
Forum: Java Nov 4th, 2008 |
| Replies: 11 Views: 797 How do I do that, I'm a little green in java and your help so far is appreciated. Can you just show me how to do it? |
Forum: Java Nov 3rd, 2008 |
| Replies: 11 Views: 797 okay, I've modified my Cinema class to look like this
import java.util.*;
public class Cinema
{
float cost;
String Title;
String mrPG="PG";
String mrA="A"; |
Forum: Java Nov 3rd, 2008 |
| Replies: 3 Views: 1,103 Hi, can someone help me modify this code to achieve the following:
Add methods to your Human that return collections of arms and legs. implement these methods by iterating through the collection of... |
Forum: Java Oct 28th, 2008 |
| Replies: 2 Views: 507 Can someone help me modify the code below to do the following:
Ensure that your mammal has a private property which is an collection of limbs and protected methods to add, remove and retrieve the... |
Forum: Java Oct 27th, 2008 |
| Replies: 8 Views: 540 Looking at my code, is this comment true:
You have not instatiated the limbs list, how can you then call its add() method
- You are trying to cast a List into a Limb. this cant work.
and if... |
Forum: Java Oct 27th, 2008 |
| Replies: 8 Views: 540 thanks, i've corrected it.
I have another problem with a List in a class called Mammal. The code is like this:
import java.util.*;
public abstract class Mammal
{
Head head;
char... |
Forum: Java Oct 27th, 2008 |
| Replies: 8 Views: 540 aah! its seems we're not communicating! You are complicating the code further. My question was how to modify this part of my code Child[] children = {new Child("Frank",10), new Child("Lisa",18)};
... |
Forum: Java Oct 27th, 2008 |
| Replies: 8 Views: 540 Hi, I have a small question regarding arrays. I have the class Family below:
import java.util.ArrayList;
import java.util.Collection;
import java.io.*;
public class Family
{
private... |
Forum: Java Oct 27th, 2008 |
| Replies: 3 Views: 396 okay, I've created my exception class as:
public class MyException extends Exception
{
String exception;
public MyException()
{
super();
exception="Unknown"; |
Forum: Java Oct 27th, 2008 |
| Replies: 3 Views: 396 Hi, I have a Cinema class as shown in the code below. However I'm required to create my own exceptions and pass them to the controlling module (here method with scenarios). After an exception occurs... |
Forum: Java Oct 24th, 2008 |
| Replies: 6 Views: 1,777 The rating is to be picked from the Map in MovieRating class, because there are some movies which can oly be watched by Adults or Children of certain age. I hope it's not confusing. |
Forum: Java Oct 24th, 2008 |
| Replies: 6 Views: 1,777 well there's a getMovieGoers method in the Family class that takes a rating as a parameter and returns a collection of all the family members that can watch the movie. This method is to be called in... |
Forum: Java Oct 24th, 2008 |
| Replies: 6 Views: 1,777 MovieRating class
import java.util.*;
public class MovieRating
{
private Map ageMap = new HashMap();
private String movieRating;
public MovieRating() |
Forum: Java Oct 24th, 2008 |
| Replies: 6 Views: 1,777 Hi, I'm trying to use a map in my application. the class MovieRating which contains the map is as below:
import java.util.*;
public class MovieRating
{
private Map ageMap = new... |
Forum: Java Oct 23rd, 2008 |
| Replies: 1 Views: 316 Thank you for your previous help. However I have another question:
I have three classes MovieRating class, Adult class, and Child class.
The Child class and Adult class both have a method... |
Forum: Java Oct 23rd, 2008 |
| Replies: 3 Views: 354 Thanks that's perfect. However is there a way of checking the age also and comparing it to some predefined age inside the if() tag, for example:
if ( test instanceof Adult && age>=minAge)
... |
Forum: Java Oct 23rd, 2008 |
| Replies: 3 Views: 354 Hi, I have a method that checks whether Objects in a Collection are Human and whether they are of certain age. I have three different classes for Human, Adult and Child. the code for the method is... |