Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Book {
- String name;
- String writer;
- int year;
- double price;
- public Book(String name, String writer, int year, double price) {
- super();
- this.name = name;
- this.writer = writer;
- this.year = year;
- this.price = price;
- }
- public String getName() {
- return name;
- }
- public void setName(String name) {
- this.name = name;
- }
- public String getWriter() {
- return writer;
- }
- public void setWriter(String writer) {
- this.writer = writer;
- }
- public int getYear() {
- return year;
- }
- public void setYear(int year) {
- this.year = year;
- }
- public double getPrice() {
- return price;
- }
- public void setPrice(double price) {
- this.price = price;
- }
- public boolean newBook(int year) {
- if(year - this.year <= 3)
- return true;
- else
- return false;
- }
- public double newPrice(double percent) {
- return (double) (this.price += this.price*percent/100);
- }
- }
Add Comment
Please, Sign In to add comment