degree of difficulty: 3

Implement a Java-main-method that prints out the multiplication table for all numbers from 1 to 10. Use the tabulator character '\t' to align the values. The output of your method should be as follows:

1 2 3 4 5 6 7 8 9 10 2 4 6 8 10 12 14 16 18 20 3 6 9 12 15 18 21 24 27 30 4 8 12 16 20 24 28 32 36 40 5 10 15 20 25 30 35 40 45 50 6 12 18 24 30 36 42 48 54 60 7 14 21 28 35 42 49 56 63 70 8 16 24 32 40 48 56 64 72 80 9 18 27 36 45 54 63 72 81 90 10 20 30 40 50 60 70 80 90 100

degree of difficulty: 3

Implement a Java-method with three local int variables a, b, and c that sorts these three values in ascending order by comparing and exchanging their values. At the end of the program a <= b <= c must hold.

You can solve this exercises with three if in minimum. Test your method with all six permutation of three different numbers.

degree of difficulty: 3

The maximum points you can get in the written exam to my lecture is 120. At 60 points you have passed the exam (grade 4.0). For every additional 5 points the next better grade. Because of juridictional problems, the grade 4.3 does not exist (it is 4,7, too, in that case). It is possible to get 0.5 points for your solutions in the exam. The following table shows the mapping between points and their grades:

grade | points |

5.0 | 0 - 49.5 |

4.7 | 50 - 59.5 |

4.0 | 60 - 64.5 |

3.7 | 65 - 69.5 |

3.3 | 70 - 74.5 |

3.0 | 75 - 79.5 |

2.7 | 80 - 84.5 |

2.3 | 85 - 89.5 |

2.0 | 90 - 94.5 |

1.7 | 95 - 99.5 |

1.3 | 100 - 104.5 |

1.0 | 105 - 120 |

Implement a Java-function that returns the grade for the points reached in the exam and prints out the grade for all points from 0 to 120 (in steps of 0.5).

degree of difficulty: 2

Implement a Java-method that prints out the day of the week for a given day (1..31), month (1..12) and year.

The day of the week of dates between March 1900 and February 2100 can be calculated as follows:

First, you have to calculate the total number of days from 1900/1/1 to the given date (see below, for details). Secondly, you divide this number by 7 with integer remainder: this now is the day of the week, with 0 as sunday, 1 as monday, etc.

To calculate the total number of days you have to implement the following steps:

- Subtract 1900 from the given year and multiply the result by 365
- Add the missing leaps years by adding (year - 1900) / 4.
- If the year itself is a leap year and the month is January or February, you have to subtract 1 from the previous result.
- Now add the all days of the year up to the given one to the result (in case of february always 28, because the additional day for a leap year already have been added).

Here some dates with the day of the week for testing your Java programm:

- Easter Sunday: 1916/3/23, 2007/4/8, 2010/4/4
- Ash Wednesday: 2006/3/1, 2007/2/21, 2010/2/17

degree of difficulty 2

A foolproof winning strategy for roulette is to always bet on the same color: If you loose your wager, then you simply double the bet to compensate the loss. The probability for red (or black) is 50% (we ignore the existence of zero).

Implement a Java method, that calculates how much money you approximatly need for playing 1 000 000 times with 1 Euro as the first bet.

Use the expression Math.random() < 0.5 for checking the probability.

How much money do you approximatly need, without loosing it during gambling.

Extend your Java method, such that it calculates from a given seed money the number of rounds you need to play to loose all your money.

degree of difficulty 3

A number of bytes given as a int value should be printed out with at most three digits before the decimal comma. The ouput for four different values:

123 Byte are 123.0 Byte 15323 Byte are 15.323 KByte 15323000 Byte are 15.323 MByte 1532300001 Byte are 1.532300001 GByte

Do not use iterations (only if-else).