markvorti.blogg.se

Greenfoot source code
Greenfoot source code











greenfoot source code
  1. #Greenfoot source code how to#
  2. #Greenfoot source code code#

#Greenfoot source code how to#

Specific instructions that describe each stepĬonditions that direct the flow of the program, such as "if-then," "while," or "until."Ģ * How to use a self-checkout lane at a grocery storeĥ * Assumes you have a shopping cart full of groceriesĦ * and no help scanning or bagging unless you specificallyġ0 StepOne SelectItem //Grab an item from cart or basketġ2 Question: Are there any items left to be scanned?ġ3 /* Checks to see if you're all done scanningġ9 StepTwo ScanBarCode //Ring up the item from StepOneĢ2 Keep rotating the item along the x-, y-, and z-axesĢ3 /* Spin it every which way.

greenfoot source code

Your task should include:Īt least three major steps, listed in chronological order

#Greenfoot source code code#

Break that task down into its component parts and write a "program" that resembles the grocery self-checkout code provided to describe your task. Think about one task you perform so often, it is nearly automatic. These are not part of the program but they make it easy to refer to specific commands and instructions within the program. The example code includes line numbers along the left side of the page. You will investigate this notation further next week.

greenfoot source code

These are used to describe processes within your program. The symbols /** and * and */ start and end comments that extend over multiple lines. When /* is used at the beginning of a line, it signifies that the entire line is a comment. means that the rest of the line is a comment Intended for people, not an instruction to the computer. Instructions related to the same task are grouped into blocks of text, and when additional information is useful, comments and explanations are added using specific conventions:Īctions defined by a group of steps have descriptive names, including SelectItem, ScanBarCode, and PayingWithCredit.īlocks of instruction are contained within braces. While it is comprehensive, it is also organized. Consider the pseudo code below that describes the self-checkout procedure. If you haven't used the self-checkout lane at a grocery store before, you act as your own cashier, scanning and weighing your items, bagging them, and paying for them, while being guided by a digitized voice that prompts you to complete each step. Good instructions are mindful of the target audience, and the less you assume the reader already knows about a process, the more useful the instructions are to a wider audience. For example, using the self-checkout lane at a grocery store-a simple task completed by thousands of people every day-requires you to: (1) Select items in your basket (2) Scan the UPC codes (3) Convey the item to the bagging area (4) Bag your groceries (5) Submit payment for your purchases.Ī program is an ordered list of instructions that prepares the computer (or in the case of the grocery example, the shopper and new user of the self-checkout lane) to complete a task. Even tasks that you perform without much thought are surprisingly complex when you stop and consider all of their components. Programming the Familiar Good programmers are able to analyze a task and describe it succinctly, accurately, and unambiguously.













Greenfoot source code