CIS 111 Repetition

Objectives

  • Design simple algorithms using repetition
  • Create flowcharts that represent algorithms, especially repetition
  • Create programs that implement algorithms

Overview

For each of the programming projects listed, write a flowchart and a Python program to solve the problem. Turn in the flowchart and source code for each problem. The flowcharts must be neat and professional, drawn with either a flowcharting template or a computer application. The source code listings for these programs, and all others due in this course, must include comments at the beginning of the source code which contain your name, the course, the date, and the assignment number. It is considered cheating to copy work. Problems may be discussed, but not copied.

Both programs must calculate the value that is output at the end. Just printing a hardcoded number in the source code indicates that your program has no real functionality. Make sure that your programs are displaying the value of a variable that has been used to store calculations. If you don't know what that means, then ask.

Program #1 (of 2)

(20 pts) Write a program that sums up all the multiples of 7 from 0 through 1000 using a loop (of course the last number added up would not be 1000 since 1000 is not a multiple of 7). Example output:

The total of all multiples of 7 from 0 to 1000 is 71071

Program #2 (of 2)

(20 pts) Write a program that keeps reading integers from the user until the number -1 is entered. Then print out the count of the numbers entered and their sum. See the sample input/output below for details. Notice that the message changes after the first number is entered. You are required to use a "priming read" for this program.

Please enter an integer (-1 to stop): ? 3 Please enter another integer (-1 to stop): ? 6 Please enter another integer (-1 to stop): ? 7 Please enter another integer (-1 to stop): ? -1 The sum of the 3 numbers you entered is 16

Rubric

  1. Problem #1 is worth 20 points:
    • 8 points for a correct, professional (not hand-drawn) flowchart
    • 10 points for correct operation and I/O that matches the sample
    • 2 points for proper documentation comments and correctly following coding conventions (indentation, naming rules, etc.)
  2. Problem #2 is worth 20 points:
    • 8 points for a correct, professional (not hand-drawn) flowchart
    • 10 points for correct operation and I/O that matches the sample
    • 2 points for proper documentation comments and for correctly following coding conventions (indentation, naming rules, etc.)