Lab 6: Piano Practice

Table of Contents


  • Get you ready for the week's lessons.
  • Introduce or review the following concepts:
    • abstraction
    • logical operators (review)
    • loop (review)
    • loop variable (review)
    • arrays (the BIG topic)
    • array elements
    • Strings as array elements

Academic Honesty

Read the Scholastic Honesty Policy and Quest and Lab Integrity policies of the syllabus. Here are some clarifications for this particular lab:

  • This is a solo lab that you must complete individually.
  • You may discuss the code with other students for this lab.
  • You must type all the code yourself and not copy from another student.

Lab Specifications

  1. Make sure you have completed the exercises from lesson 5 and lesson 6 as they are submitted as part of this lab.
  2. Complete the Chapter 5 exercises in CodeLab. These are review exercises and you have all the information needed to complete them. If you have questions, please contact the instructor for help.
  3. Scan the textbook chapter 6 to get an overview of the material.
  4. Complete the in-chapter exercises 6.1 through 6.25 that are listed throughout chapter 6 with the following notes and hints:
    1. If needed, download the starting files from: Book scenarios.
    2. Exercise 6.9 should look like Code 6.5 of the textbook.
    3. In exercise 6.10, change the act() and play() methods to use the two new variables you added in Exercise 6.9.
    4. Exercise 6.18 and 6.21 are optional.
    5. For exercise 6.22, add two more parameters to the Key constructor:
      public Key(String keyName, String soundFile, upImage, downImage)

      The two new parameters will need data types and names and must be assigned to two instance variables for the image names.

  5. Follow the exercise steps exactly and read the textbook as you progress through the chapter to enhance your understanding.

    For those exercises steps that have a text answer, open the Scenario Information (Scenario > Scenario Information) and type the exercise number and answer after the existing Scenario Information. For example, here are my answers to the first few exercises:

    Exercises with Text Answers
    6.1: The Piano is the world and Key is keys on the piano.
    6.8: Both piano keys are pressed when pressing the "g" key. We need different piano keys assigned to each keyboard key.
    (answers needed for 6.1, 6.8, 6.15, 6.16, 6.17)
  6. Add the following to the top of the Scenario Information with the "VERSION or DATE" and "AUTHORS" fields filled in:
    PURPOSE OF PROJECT: Book tutorial chapter 6
    VERSION or DATE: 1.0  The date completed
    AUTHORS: Your name here
  7. Upload the completed scenario files to Canvas as explained in the section of this document: Deliverables.

Grading Criteria

The instructor will evaluate your lab using the following criteria. Thus you should check your lab against these criteria to maximize your XP.

Lesson Exercises (from Class)

  • 2: All lesson exercises attempted and turned in
  • 1: Some lesson exercises not completed and turned in or other problems found
  • 0: No lesson exercises turned in or wrong folder name

Tutorial Lab (Textbook)

  • 4: Demonstrates mastery of the lab exercise:
    • Applies concepts from the lessons appropriately
    • Follows the steps exactly
    • Exercises perform correctly
  • 3: Has all the major functionality expected:
    • Demonstrates many techniques from the lesson
    • May deviate from the specified steps in some way
    • Implementation seems more complicated than necessary.
  • 2: Has much of the functionality expected:
    • Demonstrates some techniques from the lesson
    • Deviates from the specified steps in some way
    • Implementation seems excessively complicated.
  • 1: Serious functional problems but shows some effort and understanding:
    • Follows at least 1/2 of the of the specified steps
    • Has a major error (detected by the browser) or many minor errors
    • Demonstrates few techniques from the lesson
  • 0: Not turned in or wrong folder name

CodeLab Exercises

Number completed correctly / number exercises * 8 and rounded up to the nearest integer.

Maximum XP: 14


The CodeLab due today is submitted automatically, but other lab work must be submitted as described below.

  1. On your computer, locate the folders for the two scenarios:
    1. scroller (from lessons 5 and 6)
    2. piano (from the textbook chapter 4)
  2. Create a zip file named containing both folders. Submit the zip file(s) to the Lab 6: Piano Practice slot of Canvas.

Please do not add any extra characters to the above folder names. Also, do not put any spaces or special characters like #, : or $ in zip file or folder names. Your crafted code must work as submitted. Remember to test and double check your files before and after submitting them. If you make a mistake, you can resubmit up to the deadline but must resubmit all your lab files.

Last Updated: March 08 2020 @01:52:07