Wednesday, December 22, 2010

Dell Optiplex 620 Drivers For Windows 7

zischtig


We have to teach the target students and young people a safe and productive use of screen media in general, and Internet chat in particular. First experiences have shown that in this respect there is a great need for action.
Our events for schools and parents are characterized by a strong practical and comprehensive approaches to education.
.... teachers also like to know about the latest developments notice. With a training site, they also learn to respond to the signals and what can be done about the abuse. ....


Vtex Is Help For Pcods Pregnency

Mobile Learning


Did you previously teenagers with a mobile phone or smart phone, could assume that they sell themselves with games, music, text message or phone time. This must not be. Young people can now get to anywhere. Learning wherever, whenever and whatever they want and use waiting time to make sense. Mobile learning can take place anywhere: waiting on a train, bus, ski lift, in the interval, when you finish a work, etc.

Tuesday, December 21, 2010

How Fast Is 4hp Outboard




Winter Welcome
HTML code:
you can find here
copy the entire code below and into the gadget HTML / JavaScript insert

Mothers Sorority Initiation Dresses



winter sky
HTML code:
you'll see ; here
copy the entire code below and into the gadget HTML / JavaScript insert

Wednesday, December 15, 2010

Samsung Litescribe Writemaster Driver

Dynamic Memory Management in C (PR: 5A, 5B)

Implement a simple dynamic memory management, which operates on the principle shown in the following sketch.

This will enable memory management, memory to allocate in any order and re-release. See also Dynamic memory management
Write contains a module heap for memory management itself, which has the following functions (exported):
  • halloc void * (size_t size); size to request memory size
  • hfree void (void * p); to release the memory pointed to by the pointers p .

Create spends another version of the module heap that each call to halloc (hfree) or () the entire memory in readable form on stderr, so that the allocating of can see blocks of memory (the size of the heap should be given more be small !). Write your
a module which tests your memory management by requesting memory, and discover evidence of the allocated memory and then free the memory in different versions.
do this, create a list of test cases and describe the results of the tests (which dumps you get with the above version of the module).
examples of test cases:
n. review: allocate a string of length HEAPSIZE - sizeof (heap_t) fill the string with a loud 'A' and output of the string. OK
n +1. review: Releasing the memory test from n . is OK

For each test Indicate whether the test was successful. If a test was not successful, then determine why and if necessary to resolve the error. If you change something in the program, they must all tests are done again!
Write a suitable Makefile , which allows you to create an alternative version of the normal heap and the test version of heap!
Organize in small groups and try to draw together the various functions and to program. What help facilities such as the need halloc () ?
Expand the storage management to a "Garbage Collection", the free memory areas, the succession are summarized.
Create a suitable directory structure and use CVS .
Replace the module with other groups (that would be easy, since the interfaces are always the same (see above)
levy.
Name the project 5AD- name -heap or 5BD - name -heap and you'll check it further
answer the following questions (the answers must be in the file heap.txt be stored):
  1. What happens when a string of length n . allocated and a string of length n stores?
  2. What happens when a string of length n allocated and a string of length n + 1 stores ?
  3. you allocate a string of length 11 and save 0123456789 and type the string again. Then you allocate a string of length 20 and give out the string. What happened? (The memory requirements and the release must take place immediately after the other).
  4. What storage requirements require more memory - 10 strings of length 100 or 100 strings of length 10? Explain your answer.
  5. How could you in the module heap Ensure that for a call to hfree (p); actually p parameter points to a with halloc () allocated memory area?
heap.txt must also contain the list of test cases with their results.
Type an expression of the prepared questions from!

Tuesday, December 14, 2010

Softlens Toric Vs Purevision Toric

netzmat.ch


As part of the network Lucerne schools (schools for the future) there is a sub-network "computers in primary schools. There are experiences and exchanged information and an Internet platform with educational materials and updated ideas.
http://www.netzmat.ch

Friday, December 10, 2010

Ladies Showing Breast In Saree

notebooks without operating system

The development in the IT environment continues rapidly. Google has announced its first notebook Google Chrome. The notebook comes from pretty much without an operating system that connects so easy when you start with the Internet and only uses web-based application programs.

While it is in the IT scene many announcements too early and not all expectations are met: Cloud Computing, Web 2.0, Netbooks, Chrome and now iPad show notebook that both the data and the programs more move into the net. Especially for schools up and running quickly and low-maintenance mobile devices such as laptops or Chrome iPad interesting developments. All trends have in common is that a large bandwidth in the future for the IT infrastructure in schools is crucial.

Why Is My Dog's Nose Got Pink Spots

Create chart (POS1: 2AHIF, 2CHIF)

Create a Python program to represent data in a chart. The data come from a text file with lines with date and value. For example:
 
11/10/2010 10/09/2010 70 36 50

10/11/2010 11/11/2010 01/12/2010 30 70

The x-axis is to date are plotted on the y-axis the respective value.

Select a suitable scale. The first date is to be the zero point on the x-axis.
Use the turtle graphics ( from turtle import * ). Help for turtle graphics can be found in a python console with:
 import turtle 
help (turtle)

to get appropriate test data, write a test data generator, which has 3 parameters on the command line:
  1. Name the file
  2. start date
  3. number of records
The dates you generate so that, in addition, beginning at the starting date, always a random number of days 1-31 should be. The values should be random integers between 0 and 100 (inclusive).

Name the project 2x-name-python diagram , the test data generator testdaten.py and chart diagramm.py .

Friday, December 3, 2010

Manual Actionstar Vc-211a Usb

root calculation (POS1: 1BHIF)

can be the root of a number given by this formula

n x = (x-1 n + a / x n-1 ) / 2

It begins with a and x 0 equal to the number from which you want to pull the root set, and calculated 1 x . Then you calculate x 2 etc. differ until the two last values only low (eg, the difference is less Is 0.0000001).

Write a function root (speed accuracy,) which calculated by the above method the root.

Create a program wurzel.py that prints a table of the roots of the numbers 1 to 20 at the accuracies 0.01, 0.0001 and 0.0000001:
 1: 1.0000000 1.0000000 1.0000000 
2:
1.4142157 1.4142136 1.4142136 3 1.7320508 1.7320508
1.7320508 4 2.0000001 2.0000000 2.0000000
5:
2.2360689 2.2360680 2.2360680 6 2.4494944 2.4494897 2.4494897
7:
2.6457670 2.6457513 2.6457513 8 2.8284271 2.8284271 2.8284271
9: 3.0000000 3.0000000 3.0000000
10: 3.1622777 3.1622777 3.1622777
11: 3.3166248 3.3166248 3.3166248
12: 3.4641017 3.4641016 3.4641016
13: 3.6055514 3.6055513 3.6055513
14: 3.7416576 3.7416574 3.7416574
15: 3.8729837 3.8729833 3.8729833
16: 4.0000006 4.0000000 4.0000000
17: 4.1231067 4.1231056 4.1231056
18: 4.2426425 4.2426407
4.2426407 19: 4.3589018 4.3588989 4.3588989
20: 4.4721402 4.4721360 4.4721360

Brazilian Wax Pittsburgh Pa Prices

model solution to exercises for Python from 12.01.2010 (POS1: 1BHIF)

sure that by the terms of three lengths of a triangle is given.
two sides must always be longer than the third. You have to check this for all the possibilities, for example
a = 3, b = 4, c = 1
true though, since a + b> c (7> 1) and b + c> a (4> 3), but not a + c> b (4 == 4) !
The solution uses a loop.
 ist_dreieck def (a, b, c): 
"" "returns True if defined by a, b and c is a valid triangle
" "" i = 3

while i> 0: if a +
b \u0026lt;= c:
return False # no triangle
a, b, c = b, c, a
i = i - 1 return True

One could of course also the problem by logical combination of tests solve:
 ist_dreieck def (a, b, c): 
"" "returns True if a, b and c is a valid triangle defined
" ""
if a +> b c and b + c> , a and c + a> b:
ret = True else
:
ret = False return ret

Or even this:
 ist_dreieck def (a, b, c): 
"" "returns True if by a, b and c is a valid triangle defined
"" "
return a +> b c and b + c> a and c + a> b
The second task is to examine whether two pages and an angle of a square is given. The two sides must be the same length (and greater than 0) and the angle 90 °:
 ist_quadrat def (a, b, w): 
"" "returns True, if defined by a and b and the angle w is a square
"" is "
square = False
if a> 0: if a == b
:
if w == 90:
square = True # else
not applicable because the variable already initialized with square is false.
return
square Or get shorter with logical equation:
 ist_quadrat def (a, b, w): 
"" "returns True if by a and b and the angle w "
return a == b and w == 90 and a> 0

The leap year examination could take place as follows:

def ist_schaltjahr (year):
" a 
square is defined "delivered" " true if the given year is a leap year. Since 1582, the end is
Gregorian calendar, applicable to the following rule for the leap year
determination:
In all years, the year is divisible by four, the 29th
February, a leap day this year and it is a leap year.
An exception, however, the full century in 1700,
1800, 1900, etc., even secular years mentioned. Of these, only get those
a leap, that year is divisible by 400.
Every fourth year is thus a secular leap year.
For all years \u0026lt;= 1582 the function to False, because since the
leap year is not defined, otherwise the above rule applies "" "
if year \u0026lt;= 1582.
leap year = False elif
year% 400 == 0 :
leap year = True elif
year% 100 == 0:
leap year = False elif
year% 4 == 0:
leap year = True
else
leap year leap year = False return

years to 1582 can not be leap years, since the Gregorian calendar was first defined in 1582. To test the leap year test, a few words, but first the test function that checks a couple of dates, of which we know they are not a leap year, and numbers, which is well known that they are leap years:
 def test_ist_schaltjahr (): 
for the year in (1000, 1580, 1581, 1582, 1900, 1999, 2003): assert not
ist_schaltjahr (year)
for the year in (1996, 2000, 2004):
ist_schaltjahr assert (year)
print ("ist_schaltjahr ok ")
The statement assert is used for programmers and to check the condition, which follows close behind, thought. For example:
 assert 3 \u0026lt;4 
The condition is true, therefore, continues to run the program. If the condition is FALSE, the program is terminated with an error message:
>>> assert 3> 4 
Traceback (most recent call last): File
"", line 1, assert in
3> 4
AssertionError
addition, a text can be specified as an error message:
>>> assert 3> 4, "3 is not larger than 4" 
Traceback (most recent call last): File
"", line 1, in
assert 3> 4, "3 is not larger than 4"
AssertionError: 3 is not greater than 4
Applied to the above test function, this means that whenever not ist_schaltjahr (year) assert the function ist_schaltjahr (year) the value False Leifers must and if assert ist_schaltjahr (year) stands True be geleifert, so the resulting program is not canceled. The next point for the year in (1000, 1580, 1581, 1582, 1900, 1999, 2003): line. The variable year get in turn the values 1000, 1580, 1581, 1582, 1900, 1999, 2003 and the indented block of code (one line) runs. This is the for-loop, which is explained in the book in Chapter 7 also. The function test_ist_schaltjahr () reviewed so first a few years that have not a leap year and a few leap years. The Fibonacci numbers can be determined as follows:
 def fib (n): 
"" "returns to the Fibonacci number n. The numbers are defined as follows:
fib (0) -> 0
fib (1) -> 1
fib (2) -> 1
fib (3) -> 2
fib (4) -> 3
fib (5) -> 5
fib (6) -> 8
...
fib (10) -> 55
...
fib (15) -> 610 "" "f = 0


a = 0 b = 1

i = 0 while i \u0026lt;n: f = a + b

b, a = a, f
f + i = return 1

For n = 0 and n = 1 pre-defined the (initial) values. fib (0) = 0 and fib (1) = 1 . then the rule is that the nth Fibonacci number is the sum of the two predecessors, is therefore fib (n - 1) + Fib (n - 2) (See also Wikipedia: Fibonacci sequence ). The variable f always has the value of the current Fibonacci number and is therefore initialized with 0. The variables a and b always have the value of the two predecessors. You can see the light when you print (...) insert statements, and can thereby indicate the end of the calculation:
 def fib (n): 
"" "returns the Fibonacci number to n." ""

f = 0 a = 0 b = 1


i = 0 while i \u0026lt;n: f = a + b

print (i, ": f =" f "a =" a, " b = ", b) # test output
b, a = a, f = f + i
return 1


print (fib (10))
there .. then from the following:
 0: f = 1 a = 0 b = 1 
1: f = 1 a = 1 b = 0
2: f = 2 a = 1 b = 1
3: f = 3 a = 2 b = 1
4: f = 5 a = 3 b = 2
5: f = 8 a = 5 b = 3
6: f = 13 a = 8 b = 5
7: f = 21 a = 13 b = 8
8: f = 34 a = 21 b = 13
9: f = 55 a b = 34 = 21 55

The output of a table by using the function fib () is simple (or at least somewhat complicated, because to get the brackets): def
 fibtab (s): 
"" "creates a table of Fibonacci numbers are up as inclusive n.
fibtab (10) from the following:
[0, 1, 1, 2, 3, 5, 8]
fibtab or (100):
[0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]
Note
print to use as line break, "" when, so
print (value, end = ',')
except . of course, the last value, here is "]" demanded
"" "i = 0

print ("[", end =" ")
f = fib (i)
while f \u0026lt;= n:
print ( f, end = "") i + = 1

f = fib (i)
n if f>:
print ("]")
else
print ("," end = "")
We must ensure that first "[" without line break is issued. The function print (...) has an optional parameter end that specifies what is to be issued at the end. By default, the "\\ n" , which causes a line break. Substituting the value end = "" , then an empty string, so nothing is printed. In the loop, you must consider is whether you get to the end and in this case "]" (With word wrap) outputs. Normally, a comma is output without line (last line). Note n, the parameter n here indicates the limit of the Fibonacci numbers and which number (as in fib (n) ). The solution, for example, the sum of multiples of 3 and 5 is less than a maximum:
 def sum_3_5 (max). 
"" "
frame sum of multiples of 3 and 5 is less than max
provides example sum_3_5 (10) 23 because
the multiples of 3 \u0026lt;10 are
3 + 6 + 9 = 18
the multiples of 5 \u0026lt;10 are

5 18 + 5 = 23
sum_3_5 (20) returns 78, because
3 + 6 +9 + 12 +15 +18 = 63
(15 is already included in the list above!) 5 + 10 = 15 +
sum_3_5 (25) returns 143, because
3 + 6 +9 + 12 + 18 + 21 +24 = 93 (multiples of 5 are lower)
5 + 10 + 15 + 20 = 50
sum_3_5 (100) returns in 2318 (without proof)
"" "sum =
0
i = 0
while i \u0026lt;max:
if i% 5 == 0: sum + = i

elif i% 3 == 0: sum + = i

i + = 1 return sum

The control variable i will always be counted on to sum if it is divisible by 5, or if it is divisible by 3. The operator calculates % the rest of the division. If the remainder is 0, then the first number is divisible by the second. The example to find the next smaller or the same square can be solved with a tasting method:
 def minquad (number): 
"" "find the next smaller or equal integer, a
is square numerical examples.
minquad (16 ) -> 16 (because 4 * 4 = 16 \u0026lt;= 16)
minquad (24) -> 24 (because 4 * 4 = 16 \u0026lt;= 14)
minquad (25) -> 25 (because 5 * 5 = 25 \u0026lt;= 25)
minquad (26) -> 25 (because 5 * 5 = 25 \u0026lt;= 26)
"" "i = 0

mq = 0
while i ** 2 \u0026lt;= number.
mq = i ** 2
i + = 1 return mq

i mean i ** 2 2 You could of course also i * i write. This function simply checks all the squares successively, until one was found, which is larger than the given number. The value before (the variable mq) is of course the result, because the most Value was valid for the condition. Of course it's faster and easier, if you look at a formula reflects:
 from math import sqrt 
from math import floor
def minquad (number):
"" "find the next smaller or equal integer, a
is square. Examples:
minquad (16) -> 16 (because 4 * 4 = 16 \u0026lt;= 16)
minquad (24) -> 16 (because 4 * 4 = 16 \u0026lt;= 24)
minquad (25) - > 25 (because 5 * 5 = 25 \u0026lt;= 25)
minquad (26) -> 25 (because 5 * 5 = 25 \u0026lt;= 26)
"" "
return int (floor (sqrt (number))) ** 2
The function floor (x) provides the nearest integer to x (for positive numbers'll cut off the fractional function of the given number). Eg
>>> from math import floor 
>>> floor (3.14)

3>>> floor (3)

3>>> floor (- 3.14) -4

If one squares the nearest whole number of the root, you get the desired result. The Turtle could draw triangle function to look like and do not need further be explained:
 def triangle (a, w): 
"" "draws an equilateral triangle of side a, rotated by
the angle w. w = 0 means that one side is horizional w = means 90
. that the triangle is rotated to the left by 90 °, ie a page
is vertical.
The triangle should be drawn right next to the selected point.
"" "#
assume Turtle looks up (and starting)
right (90 - w)
PenDown ()
for i in range (3):
forward (a)
left (120)
penup ()
left (90 - w)
To a triangle to a to allow certain position, in addition, the function SETPOS (x, y) which the turtle to change the position x is, y used:
 dreieck_an_pos def (a, w, x, y): 
"" " draws a triangle using the triangle function (a, w) at the
position x, y. "" "
penup ()
SETPOS (x, y)
triangle (a, w)
Apart from the Turtle features You can test the functions http://codepad.org directly on the site . There you can also try some other programming languages. The Python version is unfortunately not up to date, so it could be that some but not direct how it works. These simple examples work fine.
Here to minquad (number) to see :

Thursday, December 2, 2010

Calculation Of Melting Temperature In Pcr

date in C even tinkered

date calculations are always a source of great tedious, error-prone parts of the program. Especially in languages that do not support such date operations. They are also always suitable to practice programming. Here the model solution to a simple calendar program in C, where much of the date functions are self-knitted. Have fun!
use:
are no parameters are simply the current month Marking \u0026lt;2> for today and : 8: as a marker for Austrian holidays. Then the list of holidays will be issued.
 $ / cal 
December 2010

Monday 6 Tuesday 7 13 20 27 14 21 28

Wednesday 1. 8: 15 22 29
Thursday < 2> 9 16 23 30 10 17
Friday 3: 24:: 31:
Saturday 4 11 18: 25:
Sunday: 5:: 12:: 19:: 26:

5.12. 2. Advent
8.12. Immaculate Conception
12.12. 3. Advent
19.12. 4. Advent
24.12. Christmas Eve
25.12. Christmas Day
26.12. Boxing
31.12. New Year :-)

Here comes the Source ...

 / 
* * File: cal.c

* * Purpose: * ...
calendar program for a given month.
* with / without argc / argv

* * Author: Harald Haberstroh

* * Algorithm:

* * History: * 2003-10-15 2002-09-29
, Holidays + arguments from main () *
2004-11-05, List of holidays
* /

/*--------------------------- includes ------ ------------------------*/
# include # include \u0026lt;stdio.h>
\u0026lt;string.h>
# include # include \u0026lt;stdlib.h>
\u0026lt;assert.h>
# include \u0026lt;time.h>

/*------------------- -------- defines -------------------------------*/
# define DAY 3 / week * of 01/01/1582 * / # define
Monday 0 Tuesday 1

# define # define # define
Wednesday 2 Thursday 3 Friday 4

# define # define # define
Saturday 5 Sunday 6

/*----- --------------------------- ---------------------- typedefs ---*/

/*--------------------------- globals ------------- ------------------*/

enum {NO = 0,
NEW YEAR,
HL3KOENIGE,
ASH WEDNESDAY
PALM SUNDAY,
GOOD FRIDAY,
EASTER SUNDAY,
EASTER MONDAY
STATE HOLIDAY,
MOTHER,
WHIT SUNDAY,
WHIT MONDAY
TRINITY SUNDAY,
CORPUS CHRISTI,
Assumption,
NATIONAL,
Reformation,
ALL SAINTS,
ALLERSEELEN,
MARIAEMPFAENGNIS,
ADVENT1,
ADVENT2,
ADVENT3,
ADVENT4,
CHRISTMAS EVE,
Christiani
STEFANI,
NEW
};

/*----------------- --------- prototypes -----------------------------*/
void print holidays (int year, int month);
int day month (int year, int month);
int sunday (int year, month int, int tag);
void tag2datum (int tagzahl, int * year, int * month, int * tag); Easter
void (int year, int * month, int * tag);
holiday int (int year, int month, int day);
anzProMonat int (int year, int month);
void PrintCal ( int start, int num, int day, int month, int year);
int leap year (int year);
Anzahl_Tage int (int year, int month, int day);

/*-------- --------------------- ---------------------------- main ----*/
int main (int argc, char * argv [])
{Int
day, day, month, year, start;
struct tm * time;
time_t sec;

if (argc == 2 & & strcmp (argv [1], "-i") == 0) {
/ * interactive * / printf
("Year"); scanf ("% d", & year);
printf ("month"); scanf ("% d", & month);
printf ("day (0 for no particular)> "); scanf ("% d ", & tag);
if (tag == 0) {

tag = 1;
if (1 <= monat && monat <= 12 &&
1582 < jahr && jahr < 3000)
{
Anzahl_Tage days = ( Year Month, 1);
start = (day + week)% 7;
PrintCal (start, anzProMonat (year, month), 0, month, year);
return 0;}


else {fprintf
( stderr, "month between 1 and 12 years between"
's 1583 and 2999 ");
return 2;}


} if (1 <= monat && monat <= 12 &&
1582 < jahr && jahr < 3000 &&
a <= tag && tag <= anzProMonat(jahr,monat))
{
Anzahl_Tage days = (year month, 1 );
start = (day + week)% 7;
PrintCal (start, anzProMonat (year, month), day, month, year);
return 0;}

else {

fprintf (stderr, "month between 1 and 12 years between"
"in 1583 and 2999 \\ n"
[day between 1 and Number for this month] \\ n ");
return 2;}


} else if (argc == 3) / * Month and year * / {

month = atoi (argv [1]);
year = atoi (argv [2 ]);
tag = 1;
if (1 <= monat && monat <= 12 &&
1582 < jahr && jahr < 3000)
{
Anzahl_Tage days = (year, month, 1);
start = (days WEEKDAY +)% 7;
PrintCal (start, anzProMonat (year, month), 0 month, year);
return 0;}

else {

fprintf (stderr, "month between 1 and 12 years between"
"in 1583 and 2999 \\ n");
return 2;}


} else if (argc == 4) / * all day * / {

month = atoi (argv [2]);
year = atoi (argv [3]);
tag = atoi (argv [1]);
if (1 <= monat && monat <= 12 &&
1582 < jahr && jahr < 3000 &&
a <= tag && tag <= anzProMonat(jahr,monat))
{
Anzahl_Tage days = (year, month, 1); start
= (DAY + days)% 7;
PrintCal (start, anzProMonat (year, month), day, month, year);
return 0;}

else

{fprintf (stderr, "Monthly 1-12 per year between "
" in 1583 and 2999 \\ n "
[day between 1 and Number for this month] \\ n");
return 2;}


} else if (argc == 1) / * current month * / {

time (& sec);
time = localtime (& sec);
tag = time-> tm_mday;
month = time-> tm_mon + 1;
year = time-> tm_year + 1900;
Anzahl_Tage days = (year month, 1);
start = (DAY + days)% 7;
PrintCal (start, anzProMonat (year , month), day, month, year);
return 0;}

else

{fprintf (stderr, "Usage: \\ n% s [[day] month year] \\ n", argv [0]);
return 1;}

}

/*-------------------------- functions ----------- -------------------*/
/ ** * Calendar spend
start ... Week of the 1st This month
* vol ... Number of days this month
* Today ... Day's date, 0 if in a month other month
* ... Month (1 .12)

* year * / void
PrintCal (int start, int num, int day, int month, int year) {

char * days [] = {"Monday", "Tuesday", "Wednesday", "Thursday",
"Friday", "Saturday, Sunday};
char * months [] = {" January "," February "" March "," April ",
" May " , "June" "July", "August",
"September", "October", "November" "December"};
int i;
int tag;

printf ("% s% d \\ n \\", [month-1] for months, year);
for (i = 0; < 7; i++)

{printf ("% 10s", days [i]);
for (tag = i + 1 - start; tag < anz + 7 + start; tag += 7)
if (tag == today & & holidays (year month, day)
& & day> = 1 & & tag <= anz)
printf ("[% 2d]", tag);
else if (day == today & & day> = 1 & & tag <= anz)
printf ("<%2d>, day);
else if (holiday (year, month, day) & & day> = 1 & & tag <= anz)
printf ("% 2d " , tag);
else if (tag> = 1 & & tag <= anz)
printf ("% 3d", tag);
else
printf ("");
printf ("\\ n");
}
printf ("\\ n ");
print holidays (year, month);
}

/ *
* Function leap year
*
* Purpose: Returns 1 if specified year is a leap year
*
* Algorithm:
* from 1582 the following rule applies to Leap years:
* If the year is divisible by 400 or
* is the year number is divisible by 4 but not by 100 then
* is the year a leap year

* * Parameters: * IN
: Year
* OUT:

* * Return value: 1 ... Leap year
* 0 ...
otherwise * / int
leap year (int year) {

if (year% 400 == 0) return 1
;
else if (year% 100 == 0) return 0
;
else if (year% 4 = = 0)
return 1;
else
return 0;
}

int anzProMonat (int year, int month)
{
switch (month)
{
case 2:
return 28 + leap year (year);
break ;
case 4:
case 6: case 9
:
case 11: return
30;
break;
default:
return 31;}



} / * * Function
Anzahl_Tage

* * Purpose: Determines the number of days from 1.1 .1582

* * Algorithm: *
day + number of days for months + Number of days for years

* * Parameters: * IN
: year, month, day
* OUT:

* * Return value: number of days from 01/01/1582
* / int
Anzahl_Tage (int year, int month, int day) {

int j;
int m, int
day = day / * day of month * /

/ *
* days for years to calculate
* /
for (j = 1582; j < Jahr; j++ )
days + = 365 + leap year (j);

/ *
* days for months Calculate
* /
for (m = 1, m < Monat; m++ )
switch (m)
{
case 2:
case 6::
case 9:

days + = 28 + leap year (year);
case 4;
break case 11:
days + = 30;
break;
default:
days + = 31;}

return ( days);}


/ ** Determines holiday.
* @ param year * @ param month

* @ param tag * @ return number
of the holiday, 0 otherwise
* / int
holiday (int year, int month, int day) {tagzahl

int, j, m , t;
Easter (year, & m, & t);
tagzahl = Anzahl_Tage (year, m, t);

if (& & month == m tag == t) / * Easter * /
return EASTER SUNDAY;
tag2datum (tagzahl + 1, & j, & m, & t);
if (month == m & & tag == t) / * Easter * / return
Easter Monday;
tag2datum (tagzahl - 46, & j, & m, & t);
if (& month == m & tag == t) / * Ash Wednesday * /
return ASH WEDNESDAY;
tag2datum (tagzahl - 7, & j, & m, & t );
if (month == m & & tag == t) / * Palm Sunday * /
return PALM SUNDAY;
tag2datum (tagzahl - 2, & j, & m, & t);
if (month == & m & tag == t ) / * Good Friday * / return
GOOD FRIDAY;
tag2datum (tagzahl + 49, & j, & m, & t);
if (month == m & & tag == t) / * Whitsunday * /
return Whitsunday;
tag2datum (tagzahl + 50, & j, & m, & t);
if (month == & & m tag == t) / * Whit Monday * /
return Whit Monday;
tag2datum (tagzahl + 56, & j, & m, & t);
if (month == & & m tag == t) / * Trinity Sunday * /
return Trinity Sunday;
tag2datum (tagzahl + 60, & j, & m, & t);
if (month == m & & tag == t) / * Corpus Christi * / return
CORPUS CHRISTI,

if (month == 1 & & tag == 1) / * Year * /
return YEAR;
if (month == 1 & & day == 6) / * Holy 3 Kings * / return
HL3KOENIGE;
if (month = returnType = 5 & & tag == 1) / * National Day * /
STATE HOLIDAY;
tag2datum (Sunday (year, 5, 13), & j, & m, & t);
if (month == 5 & & tag == t) / Mother * FIXME * / return
MOTHER;
if (month == 8 & & tag == 15) / * Assumption * / return
MARIA ASCENSION;
if (month == 10 & & tag == 26) / * National * / return
NATIONAL;
if (month == 10 & & tag == 31) / * * Reformation /
return Reformation;
if (month == 11 & & tag == 1) / * All Saints * /
return ALL SAINTS;
if (month == 11 & & tag == 2) / * All Selenium * /
return ALLERSEELEN;
if (month == 11)
{
if ( Sunday (year, 12, 24) == Anzahl_Tage (year, 12, 24)) =
tagzahl Sunday (year, 12, 24) - 21;
else
tagzahl = Sunday (year, 12, 24) - 28;
tag2datum (tagzahl, & j, & m, & t);
if (tag == t & & m == 11) / * 1 Advent * / return
ADVENT1;

} if (month == 12) {

if (tag == 8) / * return * Maria Emfängnis /
MARIAEMPFAENGNIS;

if (Sunday (year, 12, 24) = = Anzahl_Tage (year, 12, 24))
tagzahl = Sunday (year, 12, 24) - 21;
else
tagzahl = Sunday (year, 12, 24) - 28;
tag2datum (tagzahl, & j, & m, & t );
if (tag == t && m == 12) /* 1. Advent */
return ADVENT1;
tag2datum(tagzahl+7, &j, &m, &t);
if (tag == t) /* 2. Advent */
return ADVENT2;
tag2datum(tagzahl+14, &j, &m, &t);
if (tag == t) /* 3. Advent */
return ADVENT3;
tag2datum(tagzahl+21, &j, &m, &t);
if (tag == t) /* 4. Advent */
return ADVENT4;
if (tag == 24) /* Hl. Evening * / return
CHRISTMAS EVE;
if (tag == 25) / * Christiani * / return
Christiani;
if (tag == 26) / * Boxing * / return
STEFANI;
if (tag == 31) / * New Year :-) * / return
NEW YEAR'S EVE;}


return NO / * No holiday * /}


void easter (int year, int * month, int * tag) {

int a = year% 19;
int b = year / 100;
int c = year% 100;
int d = b / 4;
int e = b% 4;
int f = (B + 8) / 25;
int g = (b - f + 1) / 3;
int h = (19 * a + b - d - g + 15)% 30;
int i = c / 4 ;
int k = c% 4;
int l = (32 + 2 * e + 2 * i-h-k)% 7;
int m = (a + 11 + 22 * h * l) / 451;
int p = (h + l - 7 * m + 114)% 31;

* month = (h + l - 7 * m + 114) / 31;
tag = * p + 1;}

void tag2datum ( tagzahl int, int * year, int * month, int * tag) {

/ *

* year * / * year =
calculate 1582;
while (tagzahl> 365 + leap year (* year ))
{
tagzahl -= 365 + leap year (* year);
(* year) + +;
}
/ *
* Monthly
* /
for (* month = 1; tagzahl> day month (* year, * month) (month *) + +) -=
tagzahl days month (* year, * month);
/ *

* day * / * tag =
tagzahl;}


int sunday (int year, int month, int day) {

int tagzahl Anzahl_Tage = (year, month, day);
int wt = (THURSDAY tagzahl +)% 7;
if (wt == Sunday) / * already Sunday * / return tagzahl
; return else

tagzahl + (SUNDAY - wt);
}
int day month (int year, int month)
{
switch (month)
{
case 2:
return 28 + leap year (year);
break;
case 4:
case 6: case 9
:
case 11: return
30;
break;
default:
return 31;}



} / ** Give a list of public holidays off.
* @ param year * @ param month
IN OUT
* / void print
holidays (int year, int month) {

int i;
char * ref = "";
for (i = 1; i <= tagemonat(jahr, monat); i++)

{bez = "";
switch (holiday (year, month, i)) {

case YEAR:
bez = "New Year"; break
;
case HL3KOENIGE:
bez break
;; = "Three Kings"
case ASH WEDNESDAY:
bez = "Ash Wednesday";
break;
case PALM SUNDAY:
bez = "Palm Sunday";
break;
case GOOD FRIDAY:
bez = "Good Friday";
break ;
case EASTER SUNDAY:
bez = "Ostersonntag"
break;
case Ostermontag:
without = "Ostermontag"
break;
case STAATSFEIERTAG:
without = "Staatsfeiertag"
break;
case Muttertag:
without = "Muttertag"
break;
case PFINGSTSONNTAG:
without = "Pfingstsonntag"
break;
case PFINGSTMONTAG:
without = "Pfingstmontag"
break;
case DREIFALTIGKEITSSONNTAG:
without = "Dreifaltigkeitssonntag"
break;
case FRONLEICHNAM:
without = "Fronleichnam"
break;
case MARIAHIMMELFAHRT:
without = "Maria Himmelfahrt"
break;
case NATIONALFEIERTAG:
without = "Nationalfeiertag"
break;
case REFORMATIONSTAG:
without = "Reformationstag "
break;
case Allerheiligen:
without =" Allerheiligen "
break;
case Allerseelen:
without =" Allerseelen "
break;
case MARIAEMPFAENGNIS:
without =" Maria Empfängnis "
break;
case ADVENT1:
without = "1 Advent"
break;
case ADVENT2:
without = "2 Advent"
break;
case ADVENT3:
without = "3 Advent"
break ;
case ADVENT4:
without = "4 Advent"
break;
case HEILIGABEND:
without = "Heiligabend"
break;
case Christie
without = "Christtag"
break;
case STEFANI:
no = "Stefanitag"
break;
case NEW:
bez = "New Year :-)";
break;}

if (strlen (bez)> 0)
printf ("% 2d% d.% s \\ n ", i, month, mar. );}

}

Wednesday, December 1, 2010

Berger Enamel Color Catalog

exercises for Python (POS1: 1BHIF)

Complete the following function definitions, and write appropriate test calls.

 ist_dreieck def (a, b, c): 
"" "returns True if defined by a, b and c is a valid triangle
" "" return True


ist_quadrat def (a, b, w) :
"" "returns True if a and b and the angle w is a
Square is defined "" "return True


def ist_schaltjahr (year):
" "" returns True if the given year is a leap year. Since 1582, the end is
Gregorian calendar, applicable to the following
rule for leap year determination:
In all years, the year is divisible by four, the 29th
February, a leap day and so this year is
leap year.
An exception, however, the full century in 1700,
1800, 1900, etc., also called secular years. Of these, only get those
a leap, that year is divisible by 400 is
. Every fourth year is thus a secular leap year. .
For all years \u0026lt;= 1582, the function returns False, because since the
leap year is not defined, otherwise apply the above rule "" "
return False

def fib (n):
" "" returns the Fibonacci number for n . The numbers are defined as follows:
fib (0) -> 0
fib (1) -> 1
fib (2) -> 1
fib (3) -> 2
fib (4) -> , 3
fib (5) -> 5
fib (6) -> 8
...
fib (10) -> 55
...
fib (15) -> 610 "" "return 1


def fibtab (s):
" "" creates a table of Fibonacci numbers are up as inclusive n.
fibtab (10) from the following:
[0, 1, 1, 2 , 3, 5, 8]
or fibtab (100):
[0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]
Note
use as line break, "in print, so
print (value, end = ',')
except of course the last value, here is"] "is required.
"" "
print (" [0, 1, 1, 2, 3, 5, 8] ") def

sum_3_5 (max):
" ""
frame sum of multiples of 3 and 5 is less than max.
provides example sum_3_5 (10) 23 because
the multiples of 3 \u0026lt;10 are
3 + 6 + 9 = 18
the multiples of 5 \u0026lt;10 are
5
18 + 5 = 23
sum_3_5 (20) yields 78, because
3 + 6 +9 + 12 +15 +18 = 63
(15 is already included in the list above!) 5 + 10 = 15 +
sum_3_5 (25) returns 143, because
3 + 6 +9 + 12 + 18 + 21 +24 = 93 (multiples of 5 are lower)
5 + 10 + 15 + 20 = 50 +
sum_3_5 (100) returns in 2318 (without proof)
"" "Return
23

def minquad (number):
" "" find the next smaller or equal integer, a
is square. Examples:
minquad (16) -> 16 (because 4 * 4 = 16 \u0026lt;= 16)
minquad (24) -> 16 (because 4 * 4 = 16 \u0026lt;= 24)
minquad (25) - > 25 (because 5 * 5 = 25 \u0026lt;= 25)
minquad (26) -> 25 (because 5 * 5 = 25 \u0026lt;= 26) return
"" "
number

def triangle (a, w):
"" "draws an equilateral triangle of side a, rotated by
the angle w. w = 0 means that one side is horizional.
w = 90 means that the triangle is rotated to the left by 90 °, ie
one side is vertical.
The triangle will be right next to the selected point
drawn.
"" "pass


dreieck_an_pos def (a, w, x, y):
" "" draw a triangle using the triangle function (a, w) at the
position x, y. "" "pass

Here is an example usage follows for the leap year:
 def test_ist_schaltjahr (): 
for the year in (1000, 1581, 1582, 1900, 1999, 2003): assert not
ist_schaltjahr (year)
for the year in (1996, 2000, 2004):
ist_schaltjahr assert (year)
print ("ist_schaltjahr ok")
If ist_schaltjahr () be implemented properly, would be " ist_schaltjahr ok" output. Otherwise, the program at one of the assert statements are terminated. assert is used as a programmer to examine conditions that indicate if they are not met, a programming error. As a condition of all is the right of the assert, are the True ("everything ok") or False supplies. The test calls for all functions should
 def main (): You will add together as 
"" "Hauptprogamm to test all functions" ""
test_ist_dreieck ()
test_ist_quadrat ()
test_ist_schaltjahr (test_fib)
()
test_sum_3_5 ()
test_minquad ()
test_dreieck ()
test_dreieck_an_pos () main
This () be also called only (no indentation):
 main () 
If you run the program, it provides output when it works (in spirit ) like this:
 ist_dreieck ok ok 
ist_quadrat
ist_schaltjahr ok
fib ok
sum_3_5 ok ok
minquad
test_dreieck The functions () and test_dreieck_an_pos () bring a drawing of the following type (depending on views):
Here there were the calls: def
 test_dreieck (): 
reset ()
triangular (60, 0)
triangular (60, 90)
triangular (60, -60) def

test_dreieck_an_pos ():
dreieck_an_pos (70, 0, 50, 50)
dreieck_an_pos (70, 180, -50, -50)
So it's "visual inspection" is needed.