Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Book
- {
- private String name;
- private int price;
- public Book (String name, int price){
- this.name=name;
- this.price=price;
- }
- public String getName(){
- return this.name;
- }
- public int getPrice(){
- return this.price;
- }
- public void setName(String change){
- this.name=change;
- }
- public void setPrice(int newPrice){
- this.price=newPrice;
- }
- //
- public void print(){
- System.out.println(this.name);
- System.out.println(this.price);
- }
- }
- public class House
- {
- private int Rooms;
- private String Address;
- public House(int Rooms, String Address){
- this.Rooms=Rooms;
- this.Address=Address;
- }
- public int Rooms(){
- return this.Rooms;
- }
- public String Address(){
- return this.Address;
- }
- public void setRooms(int setRooms){
- this.Rooms=setRooms;
- }
- public void setAddress(String setAddress){
- this.Address=setAddress;
- }
- }
- public class Shirt
- {
- private String size;
- private int price;
- public Shirt(String size, int price){
- this.size=size;
- this.price=price;
- }
- public int discount(int discount){
- this.price-=discount;
- return this.price;
- }
- // print command
- public void print(){
- System.out.println(this.price);
- System.out.println(this.size);
- }
- public String toString(){
- return ("The size is " + this.size + " and the price is " + this.price + ".");
- }
- public int priceup(int priceup){
- this.price+=priceup;
- return this.price;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement