我正在做一门课程的作业,我需要全面了解这种方法

这些是属性和构造函数,它是咖啡机的程序,这是 Recipe 类
public class Recipe {
private String name;
private int price;
private int amtCoffee;
private int amtMilk;
private int amtSugar;
private int amtChocolate;
/**
* Creates a default recipe for the coffee maker.
*/
public Recipe() {
this.name = "";
this.price = 0;
this.amtCoffee = 0;
this.amtMilk = 0;
this.amtSugar = 0;
this.amtChocolate = 0;
}
Run Code Online (Sandbox Code Playgroud)
我用过
/*
* setPrice test
*/
@Test
public void testSetPrice_1() throws RecipeException {
r1.setPrice("25");
r1.setPrice("0");
}
/*
* setPrice test
*/ …Run Code Online (Sandbox Code Playgroud)