CS 100

Introduction to Computer Science

Lab 6

PERL: loops & subroutines

Due:  May 8 / 9 at midnight

 

 

 

This lab is optional. You can do it for extra credit.

 

 

Task 1: Write a program that takes an integer, N from the keyboard, and prints out a two dimensional N-by-N checkerboard pattern with alternating spaces and asterisks, like the following 4-by-4 pattern.

 

 

* * * *
 * * * *
* * * *
 * * * *

 

 

Task 2: Write a program that takes two integers, M and N from the keyboard, and prints out a two dimensional N-by-N checkerboard pattern and a two dimensional M-by-M checkerboard pattern.

 

 

 

 

How to submit your programs?

 

Please email your programs for the tasks to Jasper Lin by the due date. His email address is jlin@mtholyoke.edu.

Make sure you codes work correctly before you submit them.

 

Grading:

 

 

Task 1

10 points

Task 2 (proper use of subroutines is required)

10 points