Skip to content

Instantly share code, notes, and snippets.

@peter279k
Created May 25, 2017 11:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save peter279k/7839a9299ea21357051a5de811a4a8b4 to your computer and use it in GitHub Desktop.
Save peter279k/7839a9299ea21357051a5de811a4a8b4 to your computer and use it in GitHub Desktop.
TQC+ JAVA
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