f11csc210-hw4

f11csc210-hw4 - CSC 210.03/210.04 Fall 2011...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: CSC 210.03/210.04 Fall 2011 Instructor: Marc Sosnick Homework 4 (15 points) Due: Midnight, Friday, September 23, 2010. Description: (Modified from Liang, p. 108 #3.14) Write a program that prompts the user to enter an integer, and then reports back to the user: 1) if the number is even or odd 2) if the number is divisible by both 5 and 6 or 5 or 6, but not both or neither 5 or 6. The output for each number (the part that the program prints out, not the user input, nor the feedback from the IDE) must be on a single line. See Sample Output below. As with the previous homework, you are to write an algorithm in English for solving the problem before you begin programming, and include it before your code in your submission document. Submission: Submit PDFs containing: 1) Your algorithm (use a word processor or text editor) 2) Your code (including your algorithm as comments) 3) Output of a runs of your program, including user interaction (e.g. data entered from the keyboard). You must use numbers that represent all three of the divisible by 5 and 6 possibilities (divisible by 5 or 6 but not both, divisible by neither 5 nor 6, divisible by 5 or 6), and odd and even numbers. This will require you to capture output from multiple runs. Remember, for credit your program and output must be in a fixed with font such as Courier or Monaco. 1 Sample Output: run: Enter a number: 10 10 is Even, and is divisible by 5 or 6, but not both. BUILD SUCCESSFUL (total time: 2 seconds) run: Enter a number: 30 30 is Even, and is divisible by both 5 and 6. BUILD SUCCESSFUL (total time: 2 seconds) run: Enter a number: 23 23 is Odd, and is not divisible by 5 or 6. BUILD SUCCESSFUL (total time: 3 seconds) Extra Credit (3 points) Important note: Extra credit does not replace the assignment submission requirements above, but is in addition to the submission requirements above. In other words, you must first complete the regular homework assignment, including collecting output for the program. No credit will be given for the assignment if the regular assignment above itself is not submitted. Problem: Do Problem 3.19 in Programming Exercises on Page 108 in Liang. Note: Even though an algorithm is not required to be submitted for the extra credit portion, points will be deducted for a lack of good comments! Extra Credit Submission: 1) Your code 2) Output from a run of your program including user input. You should include input for both valid and invalid triangles. Extra credit code and output must follow the regular homework assignment in the PDF document. 2 ...
View Full Document

This note was uploaded on 10/16/2011 for the course CSC 210 taught by Professor Staff during the Spring '11 term at S.F. State.

Ask a homework question - tutors are online