Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ai152.velichko;
- /**
- * Created by User on 24.09.2016.
- */
- public class Item {
- private String name;
- private float price;
- Item(String name, float price) {
- if ( price < 0 ){
- this.price = 0;
- } else {
- this.price = price;
- }
- this.name = name;
- }
- public void raiseItemPrice(float percent) {
- price = price + price * percent / 100;
- }
- public void cutItemPrice(float percent) {
- price = price - price * percent / 100;
- if (percent>100){
- price = 0;
- }
- }
- public float getPrice (){
- return price;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement