Assignment 1


Write a program that reads an integer between 0 and 10000 and then calculates and displays (from the integer that has been read):

Example 1 : if the number 2468 is input then your program should generate the following output:

Example 2 : if the number 5070 is input then your program should generate the following output:

In addition to the correct output, as specified above, a complete assignment will include your code in the style described and demonstrated in the textbook with header documentation (your name, your student number, assignment number, program name, date written, problem statement, input, output, algorithm, major variables, assumptions, and program limitations) and inline documentation. It will also include a demonstration of the output produced by your program (from Visual Studio or Hercules ).


Criterion and Weight (E)xcellent (3/3) (S)atisfactory (2/3) (P)oor (1/3) (U)nacceptable (0/3)
Header Documentation (1)
  • all fields meaningfully completed
  • most fields meaningfully completed
  • missing assumptions (eg: input should be positive)
  • insufficient (eg: missing problem statement, algorithm, etc.)
  • few fields, if any, completed
Inline Documentation (1)
  • comments add to understanding whole program without repeating code
  • comments add to understanding most of program without repeating code
  • just writing the word “calculations” instead of explaining what is being calculated and how
  • more examples than logic descriptions
  • Comments add to understanding some of program mostly without repeating code
  • Comments, if any, do not add to understanding of the code
Code (1)
  • meets requirements. Clear, easy to read, follows style guides
  • meets most requirements. Readable, follows style guides
  • unnecessary use of extra parentheses makes code less readable
  • repetitive use of “if” statements for each condition
  • the program works normally for some or all inputs that are out of range
  • misunderstanding of = and ==
  • Meets some requirements. Mostly follows style guides
  • incorrect use of basic syntax so that code may not compile
  • using the word "or" instead of the logical operator OR (||)
  • Meets few requirements. Does not follow style guides.
Output (1)
  • Meets requirements. Output nicely formatted.
  • Meets most requirements. Output nicely formatted.
  • Meets some requirements.
  • Meets few requirements, poorly formatted
Effort (1)
  • Excellent
  • Satisfactory
  • Poor
  • Unacceptable


By the due date, upload 2 files: