Asee peer logo

Effective Teaching Of Programming Concepts Using Low Resolution (Character) Graphics

Download Paper |

Conference

2006 Annual Conference & Exposition

Location

Chicago, Illinois

Publication Date

June 18, 2006

Start Date

June 18, 2006

End Date

June 21, 2006

ISSN

2153-5965

Conference Session

Emerging Trends in Engineering Education Poster Session

Page Count

7

Page Numbers

11.518.1 - 11.518.7

DOI

10.18260/1-2--1168

Permanent URL

https://peer.asee.org/1168

Download Count

415

Paper Authors

biography

Tamisra Sanyal University of Cincinnati

visit author page

Tamisra H. Sanyal holds the position of Assistant Professor in the Department of Information Technology, College of Applied Science, University of Cincinnati. Prior to joining his present position he held teaching positions in Penn State Altoona College and in Monroe Community College (Rochester, NY). He has taught introductory and advanced programming courses in a variety of high level languages as well as courses in Data Structures, Networking, Computer applications, Unix, Discrete Mathematics, Linear Algebra, and Physics. He is interested in working to improve CS/IT teaching and learning and has published in this area.

visit author page

Download Paper |

Abstract
NOTE: The first page of text has been automatically extracted and included below in lieu of an abstract

Effective Teaching of Programming Concepts using Low Resolution (Character) Graphics Introduction

For novice students of Computer Programming, the difference between Floating point numbers and Integers (and consequent difference between arithmetic operations on them) appears to be a difficult concept to grasp. In popular languages such as C++ or Java, this difficulty is made more acute by the fact that the same symbol is used for both floating point division and integer division.1 Without a proper grasp of the difference between these two fundamentally different kinds of numbers, students would also find it difficult to understand that floating point results should not be compared for equality. I was therefore interested in finding a way to reinforce these concepts soon after the students were initially exposed to them.

Nested Loops and Character Graphics

Drawing some simple shapes like rectangles or triangles in a text window can be an interesting application of nested loops and introductory programming textbooks often include such examples.2 Drawing shapes like a circle is usually not considered unless a high resolution graphic window is to be the output device. I felt that a programming exercise to draw a circle using a text window can be useful because: • The exercise can be considered as soon as the students are exposed to the concepts of nested loops, • Knowledge of a graphics package is not required, • The exercise involves significant problem solving activity.

To use this exercise for reinforcing the concepts mentioned in the introduction, we would first consider drawing a filled circle, and then consider drawing a circle in outline. The failure of the program to work in the second case provides the basis for a classroom discussion on the differences between floating point and integer arithmetic.

Problem Solution

We consider the output device (a printer using a fixed pitch font or a text window) to be capable of displaying a certain number of rows of characters. For example, a standard text window may have 25 rows of 80 characters each. The top left position of this grid has coordinate (1, 1). In this case, (40, 13) is the coordinate of the center of the screen (not using the column position 80). The (column, row) positions are translated to (x, y) coordinates relative to the center of the output window using characters per inch (CPI) and lines per inch (LPI) values for the particular output device. To draw a filled circle, all character positions satisfying x2 + y2 < r2 display a non-blank character whereas the rest display the space character. The essential nested loop is given in the following figure. Note that most of the named constant values are determined by the output device characteristics. The only input provided is the radius of the circle to be drawn (r).

Sanyal, T. (2006, June), Effective Teaching Of Programming Concepts Using Low Resolution (Character) Graphics Paper presented at 2006 Annual Conference & Exposition, Chicago, Illinois. 10.18260/1-2--1168

ASEE holds the copyright on this document. It may be read by the public free of charge. Authors may archive their work on personal websites or in institutional repositories with the following citation: © 2006 American Society for Engineering Education. Other scholars may excerpt or quote from these materials with the same citation. When excerpting or quoting from Conference Proceedings, authors should, in addition to noting the ASEE copyright, list all the original authors and their institutions and name the host city of the conference. - Last updated April 1, 2015