Skip to content

code-differently/core-js-algos-hellaLoops01a

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

Lab: Pair Programming with "Ping Pong" Method

Objective: To practice using for loops in JavaScript to create various geometric shapes in the console while employing pair programming techniques, specifically the "Ping Pong" method.


Introduction to Pair Programming:

Pair programming is a collaborative coding practice where two programmers work together at one workstation. It is an effective way to share knowledge, improve code quality, and enhance team communication.

Roles:

  1. Driver: The person who writes the code.
  2. Navigator: The person who reviews each line of code as it is typed, considers the overall direction, and provides insights on how to proceed.

"Ping Pong" Method:

In the "Ping Pong" approach, partners regularly switch roles. One partner writes a test, the other partner makes the test pass by writing code, and then they switch roles for the next test. For this lab, you’ll adapt this method for creating shapes:

  1. Partner A writes the for loop structure without filling in the logic.
  2. Partner B completes the logic to make the shape work.
  3. Switch roles for the next shape.

Instructions:

Work in pairs to create the following shapes in your JavaScript console using for loops. After completing a shape, switch roles for the next one.

1. Line

  • Description: Create a horizontal line made of asterisks.

  • Expected Output: (for a line of length 5)

    *****
    

2. Square

  • Description: Create a square made of asterisks.

  • Expected Output: (for a 4x4 square)

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

3. Rectangle

  • Description: Create a rectangle made of asterisks.

  • Expected Output: (for a 5x3 rectangle)

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

4. Right-Angled Triangle

  • Description: Create a right-angled triangle.

  • Expected Output: (for a height of 4)

    *
    **
    ***
    ****
    

5. Upside-Down Triangle

  • Description: Create an inverted right-angled triangle.

  • Expected Output: (for a height of 4)

    ****
    ***
    **
    *
    

6. Diamond

  • Description: Create a diamond shape.

  • Expected Output: (for a width of 5)

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

Submission:

  • Submit a JavaScript file with your code.
  • Include comments in your code to indicate which partner wrote each section.
  • Include a brief reflection on the pair programming experience.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published