Advertisement
Guest User

Untitled

a guest
Nov 24th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.50 KB | None | 0 0
  1. package AI164.Tunon;
  2.  
  3. public class Item{
  4.     private String name;
  5.     private double price;
  6.  
  7.     public Item(String name, double price) {
  8.         this.name = name;
  9.         this.price = price;
  10.     }
  11.  
  12.     public String getName (){
  13.         return this.name;
  14.     }
  15.  
  16.     public  double getPrice(){
  17.         return this.price;
  18.     }
  19.  
  20.     public double changePrice(double percent){
  21.         if (percent <= 0)
  22.         return 0;
  23.         else
  24.             return this.price * percent;
  25.     }
  26.  
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement