Advertisement
porteno

Car

Dec 7th, 2019
553
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. public class Car {
  2. private String licenseNum;
  3. private boolean hadAccident;
  4. private int price;
  5.  
  6. public Car(String licenseNum, boolean hadAccident, int price) {
  7. this.licenseNum = licenseNum;
  8. this.hadAccident = hadAccident;
  9. this.price = price;
  10. }
  11. //answer - question 4.1
  12. public boolean range(int min, int max){
  13. return this.price >= min && this.price <= max;
  14. }
  15.  
  16. public String getLicenseNum() {
  17. return licenseNum;
  18. }
  19.  
  20. public void setLicenseNum(String licenseNum) {
  21. this.licenseNum = licenseNum;
  22. }
  23.  
  24. public boolean hadAccident() {
  25. return hadAccident;
  26. }
  27.  
  28. public void setHadAccident(boolean hadAccident) {
  29. this.hadAccident = hadAccident;
  30. }
  31.  
  32. public int getPrice() {
  33. return price;
  34. }
  35.  
  36. public void setPrice(int price) {
  37. this.price = price;
  38. }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement