Advertisement
Guest User

fdhfgdhtghf

a guest
Nov 23rd, 2017
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 KB | None | 0 0
  1. import java.util.Scanner;
  2. public class Book
  3. {
  4. private String name;
  5. private int price;
  6. public Book (String name, int price){
  7. this.name=name;
  8. this.price=price;
  9. }
  10. public String getName(){
  11. return this.name;
  12. }
  13. public int getPrice(){
  14. return this.price;
  15. }
  16. public void setName(String change){
  17. this.name=change;
  18. }
  19. public void setPrice(int newPrice){
  20. this.price=newPrice;
  21. }
  22. //
  23. public void print(){
  24. System.out.println(this.name);
  25. System.out.println(this.price);
  26. }
  27. }
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39. public class House
  40. {
  41. private int Rooms;
  42. private String Address;
  43. public House(int Rooms, String Address){
  44. this.Rooms=Rooms;
  45. this.Address=Address;
  46. }
  47. public int Rooms(){
  48. return this.Rooms;
  49.  
  50. }
  51. public String Address(){
  52. return this.Address;
  53. }
  54. public void setRooms(int setRooms){
  55. this.Rooms=setRooms;
  56. }
  57. public void setAddress(String setAddress){
  58. this.Address=setAddress;
  59. }
  60. }
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. public class Shirt
  71. {
  72. private String size;
  73. private int price;
  74.  
  75. public Shirt(String size, int price){
  76. this.size=size;
  77. this.price=price;
  78. }
  79. public int discount(int discount){
  80. this.price-=discount;
  81. return this.price;
  82. }
  83. // print command
  84. public void print(){
  85. System.out.println(this.price);
  86. System.out.println(this.size);
  87. }
  88. public String toString(){
  89. return ("The size is " + this.size + " and the price is " + this.price + ".");
  90. }
  91. public int priceup(int priceup){
  92. this.price+=priceup;
  93. return this.price;
  94. }
  95. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement