共有 0 个贴子
没有任何数据可供显示
开源项目社区 | 当前位置 : |
|
www.trustie.net/open_source_projects | 主页 > 开源项目社区 > bread-machine-controller |
bread-machine-controller
|
0 | 0 | 0 |
贡献者 | 讨论 | 代码提交 |
Write a program to control a bread machine. You should ask the user to specify:
The type of bread (white or sweet), 2. The size of the loaf (normal or double), and
3. The manner of baking (automatic or manual).
The following table details the time chart for the machine for each bread type. Since we don’t really have a bread machine to control, you should instead display an output line for each step of the process. If the loaf size is double, increase the baking time by 50%. If baking is manual, stop after the loaf-shaping cycle and instruct the user to remove the dough for manual baking. Operation White Bread Sweet Bread -------------------------- -------------------------- -------------------------- Primary kneading 15 minutes 20 minutes Primary rising 60 minutes 60 minutes Secondary kneading 18 minutes 32 minutes Loaf shaping 2 seconds 2 seconds Final rising 80 minutes 80 minutes Baking 45 minutes 35 minutes Cooling 40 minutes 40 minutes Output: White Bread Now Baking ... Primary kneading (15 minutes) Primary rising (60 minutes) etc. Procedure You will need 2 classes: a control class (named BreadControl) and an object class (named BreadMachine). Initially, the control class should include the class definition and the main method definition (just the signatures, braces, and class and method comments). The object class should “represent” a bread machine. Begin with the class definition and definitions for any methods that might appear obvious (although this may change as you work through this). 2. Working top down, develop the algorithms that you will need to accomplish this program. You should work this out in externally to the java program (in pseudocode, for example). Determine the major tasks first. Then work out the subtasks that each will need to accomplish. There should be multiple methods in the object class. (Some should be public, and others should be private.) For example, each step of the bread making process should be in its own method. As you work, think about the variables, variable types, constants, and object references you will need to make this work. Declare these variables, constants, and references at the beginning of the object class. If you are including constants, declare them together at the end of the declarations section.
3. Create a user-interface for your program. This should be in the control class. (You should not have any System.out.println() statements in your object class). Provide an attractive greeting and then ask the user what type of bread they intend to make, whether they are making a double loaf, and whether they are going to manually bake the bread. These values should be stored in instance (class or global) variables. You should use boolean variables (true/false) to store the double loaf and manual bake values.
4. Once you are certain that your algorithms are correct (desk check this first!), enter it into your java program into the appropriate method(s).