Okay, this is making me mad because we are supposed to do this for an assignment in college, and we haven't even learned this stuff yet. There are abunch of these, but if I can just get some pointers on this one I can figure out the rest. A. Making a pot of coffee and serving it to several people I need to break the task (A) down into several detailed modules, describe the steps in each module, and draw an organizational chart showing how the modules fit together. I was kind of thinking of doing a Top-Down design of the modules, but the teacher wants us to email him the info in notepad. So I'm basically lost on what to do, and I can't get ahold of the teacher until atleast Tuesday because of the whole memorial day vacation
this is a pretty stupid assignment to show programming design paradigms breakdown what a coffee pot does: or look at the features and instructions of one... this is a pretty basic example below timer for boiling timer for dispensing a certain amount variable for pot size (amount of liquid to hold) variable for cup size (amount to dispense) put water in boil water put coffee in brew coffee alert when brewed toggle dispensing action dispense, stop when timer is up or cup size is filled. toggle dispensing action below is a simple prototype for a coffee dispensing machine bool canDispense = false; float pot_size = 1; //1 liter float cup size = .5 // 500 ml void FillWithWater(float amount); bool BoilWater(float time); void AddCoffee(float amount); bool BrewCoffee(float time, int stlye); //style & 1 = low, style & 2 =med, style & 3 = strong <= bitoperations very useful for this. although you could also use switch(case) statements, but the first is more elegant straight c, use can do with java or python tits all supported. void Dispense(float amount);
I always hated assignments like this and thought they were a shitty way to introduce programming. For instance, in this scenario, do you have any coffee to start with? What about a coffee maker? If not, do you know where the store is? Can you assume you have a car if it's far away? Do you need to write a routine or module for driving the car? The list can go on and on. The idea is to get you to break problems down into smaller steps, but how detailed you need to be arbitrarily depends on the professor.
Did the teacher specify how the pot of coffee should be made? You can get off really simple by just jotting down the procedure for using a bog-standard drip-action coffee-maker. Did he also specify if the assignment is in natural language or pseudo-code? What level of detail? Anal retentive or just more essential actions? Simple example pseudo-code/natural language mashup: --- //definitions powerButton = off maxWater = 12 maxCoffee = 24 cups = 4 deciLiterPerCup = 2 gramsPerMeasureSpoon = 4 water = cups * deciLiterPerCup coffee = cups * gramsPerMeasureSpoon //cut off possible excess if (water > maxWater) water = maxWater endif if (coffee > maxCoffee) coffee = maxCoffee endif //prep&clean if (waterChamber <> empty) then empty waterChamber endif if (filterHolder <> empty) then empty filterHolder into bin clean filterHolder endif if (pot <> empty) then empty pot into sink clean pot endif put filter in filterHolder fill filterHolder with coffee fill pot with water fill waterChamber with water from pot put lid on waterChamber put lid on filterHolder put pot on cookPlate put filterholder on pot if (powerCordInOutlet = false) then insert powerCord to outlet endif //cook powerButton = on while (waterChamber <> empty) then wait 1 minute else wait 2 minutes powerButton = off remove lid from filterHolder empty filterHolder into bin clean filterHolder empty pot into thermos clean pot put pot on cookPlate put filterHolder on pot put lid on filterHolder endwhile //done exit --- Ofcourse, with the various procedures (empty, fill, clean, put, wait) you can go into much, much more detail in seperate, and nesting, procedure-calls.