30-Section-Handout

30-Section-Handout - CS106A Handout 30 May 9th, 2011 Spring...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
CS106A Handout 30 Spring 2011 May 9 th , 2011 Section Handout Lab Problem 1: Exam Statistics Write a program that prompts an instructor to input the grades for the 40 students in her class, populates an array of type double and then outputs the mean of the exam and a histogram of the exam scores. The histogram should bucket exams into the ranges 0–9, 10–19, 20–29, and so forth, up to the range containing only the value 100. If, for example, the professor enters the data shown in the right margin, your program should then be able to generate the following output: I’ve given you a program that prompts the user for 40 scores (actually, I use a RandomGenerator to generate them—sneaky!) and prints the mean. It doesn’t require any arrays for that part at all. You’re to extend the program by introducing an array to manage the running histogram and then print that part out as well.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Lab Problem 2: Keith Numbers A Keith number is a number that appears in a Fibonacci-like series with initial terms based on its own digits. For example, 197 is a Keith number, and here’s proof: 1, 9, 7, 17, 33, 57, 107, 197 When asking whether or not 197 is a Keith number, you launch a sequence with its (in this case, three) digits, and extend the sequence so that each one beyond the first three is equal to the sum of the three that precede it. 1, 9, and 7 are the initial numbers.
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 05/28/2011 for the course CS 106A taught by Professor Sahami,m during the Spring '08 term at Stanford.

Page1 / 4

30-Section-Handout - CS106A Handout 30 May 9th, 2011 Spring...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online