Docstoc

Tasks

Document Sample
Tasks Powered By Docstoc
					Toll system task T1: fare calculation strategies

Introduce different fare calculation strategies as follows. You must use the
strategy design pattern that encapsulates an algorithm within a subclass.

1. flat calculation strategy – sum up the nominal cost of each roadsection that
         makes up a journey (current algorithm)

2. variable calculation – sum up the different nominal costs multiplied by a
         factor. This factor is calculated as follows:
 - eco classification: factor
         low emissions is 0.8, factor medium emissions 1, factor high emissions
         1.2
 - vehicle is towed: factor 0.3 eco classification should be
         disregarded
 - vehicle has a trailer attached: factor 1.2, eco
         classification still holds E.g. a vehicle with high emission and a trailer
         attaches pays per road section:
 the nominal cost X 1.2 X 1.2. 

advanced calculation – analogous to the variable calculation, however extra
charges / discounts apply for peak / low hours.
 - peak hours are working
days from 07:00am till 10:00am and from 16:00pm till 19:00pm. All other
periods are considered as low hours. Public holidays are not considered.
 -
peak hours should be multiplied by an additional factor of 1.2
 - the peak / low
hour is determined using the Journey startingTime property.

Description of strategy pattern:




Sample uses of java.util.Calendar method:

       Calendar c = new Calendar();
       //get the current month
       c.get(Calendar.MONTH);
       //get the current minut
       c.get(Calendar.MINUTE);
       //etc.
Task: upload data to data center

The information on the vehicle road section information as well as the current
charge should be uploaded to the main data center. This should happen after
each road recognition as well as charge calculation. The actual
communication between the vehicle and the data center should not be
implemented. A simulated output to the console is sufficient.

A new crosscutting theme must be created (analogous to the
realtimedatadisplay theme).
Pacemaker task T3: heart rate model

Currently pulse analysis is performed using a very naïve formula. Whenever
the pulse falls below 40 the pulse is adjusted to the ideal pulse. The heart rate
should be monitored using a more complex formula involving patient age, sex,
resting heart rate and athletic condition (fit/normal). These extra properties
should be added to the design. The exact values are uploaded using the data
acquisition functionality. These properties may be integrated together with
other relevant properties (e.g. smoothingFactor, idealPulse).

The analysis first calculates the maximum heart rate according to the
following formulas:


- male:

      220-age (normal)
      205 – age/2 (fit)

- female:

  •   226-age (normal)
  •   211 – age/2 (fit)
The heart rate should be adjusted in the following cases:

1. heart rate goes below resting heart rate - adjust to the resting heart rate

2. heart rate goes above 80% of the maximum heart rate - do not modify the
       heart rate


3. heart rate drops faster than the smoothing factor – set the heart rate to the
       previous rate – smoothing factor
heart rate raises faster than the smoothing factor – set the heart rate to the
previous rate + smoothing factor
Pacemaker task T4: logging

Log the pulse and temperature values for ALL heart monitors (HeartMonitor,
HeartMonitorB and HeartMonitorC) whenever a new value is sensed. Modify
the existing fault tolerance aspect theme to log.

Actual writing to a file should be implemented. Here is a quick reference for
PrintWriter, which should be enough:



PrintWriter
public PrintWriter(String fileName)
                 throws FileNotFoundException
Creates a new PrintWriter, without automatic line flushing, with the specified
file name. This convenience constructor creates the necessary
intermediate OutputStreamWriter, which will encode characters using
the default charset for this instance of the Java virtual machine.

Parameters:
fileName - The name of the file to use as the destination of this writer. If the
file exists then it will be truncated to zero size; otherwise, a new file will be
created. The output will be written to the file and is buffered.
println
public void println(String x)
Print a String and then terminate the line. This method behaves as though it
invokes print(String) and then println().
Parameters:
x - the String value to be printed

				
DOCUMENT INFO
Shared By:
Categories:
Tags:
Stats:
views:5
posted:12/1/2011
language:English
pages:4