Your programs will have 3 levels of documentation. Give your program an appropriate name.
1. Write a calculator. Your user will be able to choose the following operators, +, -, *, /, exponents, modulus. Your program will exit if the user types quit. Note: the program must continuously run.
2. Write a program that will calculate the average for a teachers class. The program will be able to handle as many students as the user indicates are in the class. The program will then be passed one A, B, C, D, F letter grades per student. The program will track how many students are passing and failing. The class average will also be displayed. A = 80, B = 70, C = 60 , D = 50 F = 40.
3. The factorial of a positive number is the product of all positive integers less than or equal to the number. For example 5 factorial is equal to 5 * 4 * 3 * 2 * 1 = 120. Write a program that reads a positive integer and displays its factorial. DO NOT USE THE BUILT IN FACTORIAL() in the MATH LIBRARY.
4. The "Necklace Problem". The necklace problem begins with two single digit numbers. The next number is obtained by adding the first two numbers together and saving only the ones-digit. This process is repeated until the "necklace" closes by returning to the original two numbers. For example, if the starting numbers are 1 and 8, twelve steps are required to close the "necklace".
EXAMPLE 1, 8 -> 1 8 9 7 6 3 9 2 1 3 4 7 1 8 <- 14 Steps
Your program will show the starting number, the ending number, the amount of steps, and the entire "necklace".
5. "Hailstone Numbers". An interesting unsolved mathematical problem is called "Hailstone Numbers". This series of numbers is produced by taking an initial integer, and if the number is even, dividing it by 2. If the initial number is odd, multiply it by 3 and add 1. This process is then repeated. For example:, an initial value of 10 produces: 10, 5,16,8,4,2,1,4,2,1,4,2,1,...
An initial value of 23 produces:
23,70,35,106,53,160,80,40,20,10,5,16,8,4,2,1,4,2,1,...
Notice that both numbers eventually reach the cycle 4,2,1,4,2,1,...
Write a program, with a MENU option that answer the following questions:
a) Take ANY integer from the user as INPUT and provide the hailstone sequence for that number. You can stop the hailstone at 4,2,1 OR 4,2,1, 4,2,1 whatever you want is fine.
b) Do all numbers from 1 to 200 eventually reach this cycle? This is a simulation that NEEDS NO INPUT FROM THE USER. It will test each number from 1 - 200, and OUTPUT the hailstone sequence for that number.
c) Which number from 1 - 200 takes the longest to finish its hailstone sequence? What is the longest hailstone sequence generated given 1 - 200 as input?
Summative Evaluation
If you can't see the document, please read: You Do Not Need Permission To View Any Documents.