Created
May 25, 2017 11:46
-
-
Save peter279k/7839a9299ea21357051a5de811a4a8b4 to your computer and use it in GitHub Desktop.
TQC+ JAVA
This file contains 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
class SLuxCar extends Car { | |
public SLuxCar(int cc, String airMode) { | |
this.engine = new Engine(cc).getCost(); | |
this.airCond = new Aircond(airMode).getCost(); | |
this.carMode = "SLuxCar"; | |
} | |
public String expensive(LuxCar lc) { | |
if(lc.price() < this.price()) { | |
return "Yes!!"; | |
} | |
return "No!!"; | |
} | |
} | |
public class JPA06_3 { | |
public static void main(String args[]) { | |
SLuxCar llc = new SLuxCar(2000,"Auto"); | |
System.out.println("SLux cost: " + llc.cost()); | |
System.out.println("SLux price: " + llc.price()); | |
LuxCar lc = new LuxCar(2000,"Auto"); | |
System.out.println("Is llc more expensive than lc? " + llc.expensive(lc)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment