|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
||||||
|
||||||
|
Help with restaurant program (Inheritance related)
I am trying to make a program which is a restaurant ordering system. But cannot get it to compile.
here are the java files I am using. drink.java Quote:
food.java Quote:
Orders.java Quote:
restaurant.java Quote:
|
|
#2
|
|||
|
|||
|
It would help if you said what the compiler errors were, as "import cs1.*;" means we can't test compile it ourselves.
|
|
#3
|
|||
|
|||
|
Code:
public class Drink extends Order
{
private int ID;
private int name;
public Drink(int ID , String Name)
{
I don't know if this would be a problem, but after looking at this quickly.... since Java is case-sensitive, it might be a problem that "Name" is capitalized in the "public Drink" line but it's just "name" when you initialize it at first.... so maybe... Code:
public class Drink extends Order
{
private int ID;
private String name;
public Drink(int ID , String name)
would work.... Note that I also made "name" a string when it's initialized, instead of an int. But hey, I'm a tooootal noooob. I hope this helps though ^_^ |
|
#4
|
|||
|
|||
|
tictactactics ir right. Also:
public class Orders { private String command; public Orders(String command) { this.Orders = newOrder(); } } Also there is no member (attribute) on the Orders class named Orders to assign the newOrder() result to. These errors were certainly caught by the compiler and the reasons for compilation failure given. |
![]() |
| Viewing: Dev Articles Community Forums > Programming > Java Development > Help with restaurant program (Inheritance related) |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|