Write a program to compute the sum of a harmonic series, as shown below, where n=50000. Calculate the sum from left-to-right, and then from right-to-left.
Harmonic(n) = 1 + 1/2 + 1/3 + 1/4 + .... + 1/n
Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be:
1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...
By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms.
Write a program that calculates and displays a multiplication table exactly as shown below.
1 2 3 4 5 6 7 8 9
2 4 6 8 10 12 14 16 18
3 6 9 12 15 18 21 24 27
4 8 12 16 20 24 28 32 36
5 10 15 20 25 30 35 40 45
6 12 18 24 30 36 42 48 54
7 14 21 28 35 42 49 56 63
8 16 24 32 40 48 56 64 72
9 18 27 36 45 54 63 72 81
Write a program to create a standard 52 card deck and then deal a random hand to a player. Once a card is dealt then it can't be used again.
Write a program that manages a To-Do List. Each item on the to-do list should have a description and a state (To-Do, In Progress, or Done).
Your program should allow the user to:
- add items to the to-do list
- display all existing items
- display existing items by state (i.e. view only In Progress items)
- delete items
Rewrite your code for the card shuffle to deal a random hand to 4 players. Use objects to represent each players hand.
Write a program that contains on launch at least 3 entries (objects). Each entry should contain a name, address, and phone number.
Your program should allow a user to:
- add entries
- delete entries
- display all entries
BONUS: Add a search function to find a specific entry.
Your task is to write a program to calculate the next generation of Conway's Game of Life, given any starting position. You start with a two dimensional grid of cells, where each cell is either alive or dead. The grid is finite, and no life can exist off the edges. When calculating the next generation of the grid, follow these four rules:
- Any live cell with fewer than two live neighbors dies, as if caused by underpopulation.
- Any live cell with more than three live neighbors dies, as if by overcrowding.
- Any live cell with two or three live neighbors lives on to the next generation.
- Any dead cell with exactly three live neighbors becomes a live cell.