Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Service Oriented- this is providing a service to the user when need for
example when an USB device is plugged into the system and it does the
work for you or when you receive an email. They often appear in the
background and have no user interface to use but all have the ability to be
stopped and started at the users will. Programs like Bluetooth and
Autodesk functions are constantly using your memory for background
programs.
Trigger functions- trigger functions are called when an event takes place
e.g. button click, they are used to identify which event handler should be
run after a trigger has taken place. For example after a button has been
clicked they tell the system to run Private void btnNext click (object
sender, eventArgs) which is the event handler.
Events- these are the actions that cause the code to be called. Events
can come from the user or often from other sources e.g. timer, computer
boot up etc. example on a form: mouse clicks; keyboard press (up/down).
Simplicity of programming
A lot of the code for the GUI is generated automatically, when the
programmer drags and drops controls onto the form
The overall problem can be broken down into the events that are to be
recognised so the programmer can be broken down into the events that
are to be recognised so the programmer can concentrate on writing code
for that event handler e.g./ private void btncalculateclick (object sender,
EventArgs e)
The programmer can double click the button and the code is placed
`behind` the button. The IDE automatically generates the event handler
stub. This saves on syntax errors and makes the coding process much
simpler.
Task 2 (M1)
Clicking an icon
Moving an icon
Dragging a window
Resizing a window
Dragging and dropping a selected item
Clicking on a menu item
Minimizing or maximising a window
The OS has also to deal with the effect of the user interaction e.g. rightclick on the desktop the OS will show a floating menu.
If the user double clicks on a file to open it, the OS will firstly open the
application that the file is associated with e.g. myWork.doc open MS word
Resizing a window/minimising/Maximising
The OS handles keyboard events many of which it will pass to the running
application such as word while others are handled by the OS ctrl+ Alt+ del
4. In addition the operating system has a list of free disk space for the
hard drive, do it is able to keep track of all the disk blocks which are
not in use by any file.
Task 3
Evaluate the suitability of event driven programs for nongraphical applications
e.g. Industrial systems
Air conditioning
When the user presses a button or turns a dial to the desired temperature
that is an event. Then sensors detect the current temperature which is
also an event.
Smoke Alarm
The sensor constantly monitors (takes reading every few milliseconds)
(time driven-event)
If smoke is detected the alarm is activated which is an event.
If the alarm is on and no smoke is detected, it will switch of which is an
event and by testing the alarm the user pushes the test button alarm
sounds which is also an event
Burglar Alarm
Contact switches (contact is broken when door or window is open) Light
beams (PIR) (EVENT).When the light beam is broken (event) a signal can
be sent wirelessly to the central panel. When the light beam is broken
(event) a signal can be sent wirelessly to the central panel. Alarm can
then be sounded which contacts the security company. Once the security
company are aware of the situation they then contact the home owner.
Once that happens the user enters a code to switch the alarm of.
Washing Machine
When the user clothes in the machine they close the door and then they
select a washing programme (cycle). Then the machine opens a water
inlet valve and when enough water has entered (based on weight) the
valves closes.
The water heated and the temperature sensor checks the temperature
and switches off the heater. The wash cycle is activated. The display
shows the time remaining.
Elevator
When user presses a button to call the elevator either up or down that is
an event or when the elevator arrives at a floor when the doors open also
an event. If the user enters the lift and selects a floor the button will light
up to show which floor has been selected or when the doors close it is an
event but will not close if blocked. When the elevator moves to the next
floor and it will only stop if it has been called or a user has selected that
floor which is an event. If the elevator is stuck and someone presses the
alarm for help it will alert someone at the desk.
Conclusion
Non graphical application can be events such as embedded systems
which can be smoke alarms, elevators and washing machines have events
that are not graphical and require event driven programs to control them.
Event driven programming is suitable for non-graphical applications. This
can be from a push or a button or turning a dial to change the
Task 4
Explain the main features of the following programming languages
C#, VBA, ColdFusion
Task 5
Login
Variable Name
Data Type
Staff Array
Array of strings
Scope
(local or global)
Global
Login Count
Integer
global
Variable
Name
Data Type
Order total
double
Scope
(local or
global)
global
Burger cost
double
local
Topping cost
double
local
Drink cost
Double
local
User for
Holding staff
login names
Counting the
number of times
the user has
tried to login
User
for
Keeps the
total cost of a
customers
order
Keeps the
total cost of
the burgers
Keep the total
cost of the
toppings
Keeps track of
the total cost
of drinks
Login Form
Ask user to enter their username exists
Search the staff array to find if the username exits
If found:
Tell User login was successful
Close Login form
Go to Menu form
User selects drink coke sprite, Diet coke, Fanta (only one)
User selects place order.
If (2oz selected)
Burger cost = x.xx
Print burger size and xx` on receipt
Else if (4oz selected)
Burger cost= x.xx
Print burger size and xx` on receipt
Else if (8oz)
Burger cost x.xx
Print burger size and xx` on receipt
If(onions selected)
ToppingCost += 0.80
elseIf(cheese selected)
ToppingCost += 0.80
elseIf(coleslaw selected)
ToppingCost += 0.80
If(Coke selected)
drinkCost = 1.20
elseIf(diet Coke selected)
DrinkCost = 1.20
If(drink selected)
drinkCost = 1.20
elseIf(sprite selected)
DrinkCost = 1.20
If(drink selected)
drinkCost = 1.20
elseIf(fanta selected)
DrinkCost = 1.20