
public class Confiture {
	final private String fruit;
	private int proportion;
	private int cal;
	final static int sucre = 387;

	Confiture (String fruit, int proportion, int cal) {
		this.fruit = fruit; 
		this.proportion = proportion; 
		this.cal = cal;
	}

	Confiture (String fruit, int cal){
		this.fruit = fruit;
		this.proportion = 50;
		this.cal = cal;
	}

	String description() {
		return "Confiture de "
				+ this.fruit
				+ ", "
				+ this.proportion
				+ "% de fruit, "
				+ this.cal
				+ " calories aux 100 grammes.";
	}

	int calories(int gram) {
		return (gram * this.cal) / 100;
	}

	public boolean egal(Confiture conf) {
		return this.fruit.equals(conf.fruit)
				&& this.proportion == conf.proportion
				&& this.cal == conf.cal;
	}

	public int getCal() {
		return this.cal;
	}

	public void setCal(int x) {
		this.cal = x;
	}
	
	public String getFruit() {
		return this.fruit;
	}

	public void setprop(int p) {
		if(0 <= p && p <= 100)
			this.proportion = p;
		else
			System.out.println(p + " is not between 0 and 100.");
	}

}
