Created
December 16, 2011 02:11
-
-
Save takuma7/1484106 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
abstract class Arbeit{ | |
int kingaku=0; | |
abstract void calc(int hour); | |
void hyouji(){ | |
System.out.println("got " + kingaku + " yen."); | |
} | |
} | |
class Convenience extends Arbeit{ | |
void calc(int hour){ | |
System.out.println("worked " + hour + " hour(s) at a convenience store."); | |
kingaku += hour*1000; | |
} | |
} | |
class CDshop extends Arbeit{ | |
void calc(int hour){ | |
System.out.println("worked " + hour + " hour(s) at a CD shop."); | |
kingaku += hour*850; | |
} | |
} | |
class GasStation extends Arbeit{ | |
void calc(int hour){ | |
System.out.println("worked " + hour + " hour(s) at a gas station."); | |
kingaku += hour*1000 + 500; | |
} | |
} | |
class Mondai14_2{ | |
public static void main(String[] args){ | |
GasStation gs = new GasStation(); | |
Convenience cv = new Convenience(); | |
CDshop cd = new CDshop(); | |
gs.calc(3); | |
cv.calc(4); | |
cd.calc(2); | |
cd.hyouji(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment