Homework 8. 20 points total. Due Oct 24 by 11:59pm. Grading: 10 points for (1), 10 points for (2) Do each of the following problems, leaving the complete .cpp file in your ~/handin/ directory. (1) Copy this file into your handin directory. Type in your answer to the following practice exam question. Given the following code, type in the values each variable takes on as the program funs. Then answer the question below. Code: string s; cout "What is your sycamore id?"; cin >> s; // assume the user typed your sycamore id. int i=0; total = 0; for(i=0; i < s.size(); i++) { if (tolower(s[i]) < 'm') total ++; } cout << i << endl; cout << total << endl; Variable values: s: i: total: Question: Explain what this code does in words. Do not just say something like "There is a cout statment, then there is a for loop..." Explain it in a way that a non-programmer would understand. Your explanation: Hint: You can copy/paste that code into a .cpp file, compile it, and and run it to see what the final values of i and total are. You can add cout statements to see what the values of the variables on different lines. (2) Make a program called addstatistics.cpp. The program should repeatedly ask the user for floating point numbers (store them as double variables) until they type 0 as a number. The program should then output the following: the largest number entered, the smallest number entered, the average of all numbers entered. Note: does the 0 count? Yes, it does count. Hint: Look at averageGrade2.cpp. Your code will not be identical, but it will be similar. Outline: * Variables you'll need + count how many they typed in. + total they typed in. + largest so far. + smallest so far. * What kind of loop to use? while * Inside the loop... + Update those variables * Loop stops when? thing they typed is 0.0 Correct working program so you can see how it works: ~jkinne/public_html/cs151-f2013/code/addstatistics (3) Extra credit Make a program called addprimes.cpp that asks the user for an integer. The program then adds up all the prime numbers that are <= that integer and outputs the result. The program also outputs the sums of the primes that end in each digit, from 0 to 9. Correct working program so you can see how it works: ~jkinne/public_html/cs151-f2013/code/addprimes Hints: * To compute all the primes up to a given number, use the Sieve of Eratosthenes. Look it up on wikipedia. * Use a long int rather than just int to store the sums, so you don't have overflow.