Mac Quick Java Question

RossMc

macrumors 65816
Original poster
Apr 30, 2010
1,157
20
Newcastle, UK
Hi,

Just wondering if someone could answer this for me.

I need to write these three classes going off this UML diagram.



I have wrote them all and the Room & MeetingRoom class's compile fine but on the Bedroom class this line shows up wrong.

Bedroom(int, double, String)
{

}

It says <identifier> expected.
 

RossMc

macrumors 65816
Original poster
Apr 30, 2010
1,157
20
Newcastle, UK
This is the code I have

Room

public class Room
{
int roomNumber;

double rate;

String customer;


Room()
{

}


Room(int n, double t)
{

}

void bookRoom(String cust)
{

}

void clearBooking()
{

}

String getCustomer()
{
return customer;
}

double getRate()
{
return rate;
}

int getRoomNumber()
{
return roomNumber;
}

public String toString()
{
return customer;
}

}
MeetingRoom

public class MeetingRoom extends Room
{
int seatingCapacity;

MeetingRoom(int t, double r, int c)
{

}

int getCapacity()
{
return seatingCapacity;
}

public String toString()
{
return customer;
}

}
Bedroom

public class Bedroom extends Room
{
String roomtype;

Bedroom()
{

}

Bedroom(int, double, String)
{

}


String getType()
{

return roomtype;
}

public String toString()
{

return roomtype;
}



}
 

rxvcgiii

macrumors newbie
Sep 15, 2008
4
0
I believe jmuchrisf is correct. In "Bedroom", you provided the argument types, but no variable names.

Try this instead:

Bedroom(int a, double b, String s)
{

}
 

Similar threads

  • Nermal
13
Replies
13
Views
454
Replies
5
Views
814
  • PinkyMacGodess
2
Replies
2
Views
667
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.