first off im taking a java class in school and i was doing fine but its starting to get harder with inheritance and polymorphism < still dont know what that is
when do i know to use private or protected modifier, i always do private but now i learned of protected
the project i am doing is kind of big but ill start with my specific problem
"Write a new class called Upgrade which inherits from Standard with the following characteristics:"
Name
UpgradeRoom
Return Type
Parameter
number – integer
stay – integer
Pre-condition
none
Post-condition
constructs an object of class UpgradeRoom with
roomNumber = number;
roomRate = 170.0;
lengthOfStay = stay;
mimimumStay = 3
^ this is given to tell us how to make a method, he posted the answer as
my question is why does it not say roomRate = 170 its instead rate ...Code :public UpgradeRoom(int number, int stay) { super(number, stay); rate = 170.0; minimumStay = 3; }
also explain the super(number, stay) please i am confused. I am under the impression that super means your using the same number and stay as the main class or something? dont know..
the class UpgradeRoom has only 1 new variable which is
"protected int minimumStay;"
i dont get why its protected!

