Advertisement
Guest User

Untitled

a guest
Mar 21st, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1. public class Building {
  2.  
  3. private String address;
  4. private int floors;
  5. private double buildUpArea;
  6. private double pricePerM2;
  7. static double EURToBGN = 1.95;
  8.  
  9. public Building() {}
  10.  
  11. public Building(String address, int floors, double buildUpArea, double pricePerM2) {
  12. this.address = address;
  13. this.floors = floors;
  14. this.buildUpArea = buildUpArea;
  15. this.pricePerM2 = pricePerM2;
  16. }
  17.  
  18. public double TotalArea(double extraArea){
  19. return buildUpArea+extraArea;
  20. }
  21.  
  22. public double BuildingPriceInBGN(){
  23. return buildUpArea*pricePerM2;
  24. }
  25.  
  26. public double increasePrice(double number){
  27. return BuildingPriceInBGN()+number;
  28. }
  29.  
  30. public double TheMoreExpensiveBuilding(double Building1Price, double Building2Price){
  31. if(Building1Price > Building1Price)
  32. {
  33. return Building1Price;
  34. }
  35. else if(Building1Price < Building2Price)
  36. {
  37. return Building2Price;
  38. }
  39. else
  40. {
  41. System.out.println("The prices of the buildings are the same!");
  42. return Building1Price;
  43. }
  44. }
  45.  
  46. public double BuildingPriceInEUR(){
  47. return BuildingPriceInBGN()*EURToBGN;
  48. }
  49.  
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement