public class book {
	private double basePrice = 0;
	private double vat = 0;
	private double discount = 0;
	private double sellPrice;

	public book() {
		setBasePrice(0);
		setVat(0);
		setDiscount(0);
	}

	public book(double basePrice, double discount, double vat) {
		setBasePrice(basePrice);
		setVat(discount);
		setDiscount(vat);
	}

	public double getBasePrice() {
		return basePrice;
	}

	public void setBasePrice(double basePrice) {
		if (basePrice >= 0)
			this.basePrice = basePrice;
		setSellPrice();
	}

	public double getVat() {
		return vat;
	}

	public void setVat(double vat) {
		if (vat >= 0)
			this.vat = vat;
		setSellPrice();
	}

	public double getDiscount() {
		return discount;
	}

	public void setDiscount(double discount) {
		if (discount >= 0)
			this.discount = discount;
		setSellPrice();
	}

	public double getSellPrice() {
		return sellPrice;
	}

	private void setSellPrice() {
		sellPrice = basePrice * ((100 + (vat - discount)) / 100);
	}

}

It looks OK. What is your problem?

package com.bookPortal.model;

public class Book {
	private double basePrice = 0;
	private int vat = 0;
	private int discount = 0;
	private double sellPrice;

	public Book() {
		setBasePrice(0);
		setVat(0);
		setDiscount(0);
	}

	public Book(double basePrice, int discount, int vat) {
		setBasePrice(basePrice);
		setVat(discount);
		setDiscount(vat);
	}

	public double getBasePrice() {
		return basePrice;
	}

	public void setBasePrice(double basePrice) {
		if (basePrice >= 0)
			this.basePrice = basePrice;
		setSellPrice();
	}

	public int getVat() {
		return vat;
	}

	public void setVat(int vat) {
		if (vat >= 0)
			this.vat = vat;
		setSellPrice();
	}

	public int getDiscount() {
		return discount;
	}

	public void setDiscount(int discount) {
		if (discount >= 0)
			this.discount = discount;
		setSellPrice();
	}

	public double getSellPrice() {
		return sellPrice;
	}

	private void setSellPrice() {
		sellPrice = basePrice * (100 + vat - discount) / 100;
		if (sellPrice < 0)
			sellPrice = 0;
	}

}
package com.bookPortal.modelTest;

import com.bookPortal.model.Book;

import junit.framework.TestCase;

public class BookTest extends TestCase{
	Book b = new Book();
	
	public void testSetBasePrice(){
		b.setBasePrice(10);
		assertEquals(10.0, b.getBasePrice());
	}
	public void testWrongSetBasePrice(){
		b.setBasePrice(-10);
		assertEquals(0.0, b.getBasePrice());
	}
	
	public void testSetVat(){
		b.setVat(10);
		assertEquals(10, b.getVat());
	}
	public void testWrongSetVat(){
		b.setVat(-10);
		assertEquals(0, b.getVat());
	}
	
	public void testSetDiscount(){
		b.setDiscount(10);
		assertEquals(10, b.getDiscount());
	}
	public void testWrongSetDiscount(){
		b.setDiscount(-10);
		assertEquals(0, b.getDiscount());
	}
	
	public void testSetSellPrice(){
		b.setBasePrice(10);
		b.setDiscount(0);
		b.setVat(18);
		assertEquals(11.80, b.getSellPrice());
	}
	public void testWrongSetSellPrice(){
		b.setBasePrice(0);
		b.setDiscount(50);
		b.setVat(18);
		assertEquals(0.0, b.getSellPrice());
	}

}

Tests successfull

setVat(discount); setDiscount(vat);

I am sure that someone, someday will understand what you are trying to tell us

so what a about the price

product owner responsibility: Put into a simple list, typical product owner responsibilities are:

decide on the project vision - who is going to benefit from the project and how;
secure funding;
continuously make decisions on the product priorities - what is more important with the latest information in mind;
continuously make decisions on maximizing the product ROI - make sure the features with the biggest benefit/cost ratio are developed first.

XP Practices:
-Collective ownership
-coding standards
-sustainable pace
-test first
-acceptance tests
-automation
-onsite customer
-continuous integration
-pair programming
-metaphor
-refactoring
-incremental design
-stories
-small releases
-planning game
-informatie workspace

commented: Stop posting meaningless fragments of text. -2

setVat(discount); setDiscount(vat);

so what a about the price

product owner responsibility: Put into a simple list, typical product owner responsibilities are:

decide on the project vision - who is going to benefit from the project and how;
secure funding;
continuously make decisions on the product priorities - what is more important with the latest information in mind;
continuously make decisions on maximizing the product ROI - make sure the features with the biggest benefit/cost ratio are developed first.

XP Practices:
-Collective ownership
-coding standards
-sustainable pace
-test first
-acceptance tests
-automation
-onsite customer
-continuous integration
-pair programming
-metaphor
-refactoring
-incremental design
-stories
-small releases
-planning game
-informatie workspace

What am I thinking right now? You should be able to guess correctly because I have seen the proof of how advanced your website to user mind reading capabilities are.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.