On this page:
Overview
Setup
Submitting
1 Before Submitting
2 Common Problems
3 Files
4 Grade  Scope
HW Tasks

Homework 10

Last updated: Thu, 14 Dec 2023 14:17:27 -0500

Out: Mon Dec 11, 2023, 00:00 EST

Due: Sun Dec 17, 2023, 23:59 EST

Overview

In this assignment, we’ll explore how the ideas we learned in CS450 this semester still work, even when programming in an OO-style!

This hw will be graded as follows:

  • correctness (10 pts)

  • design recipe (25 pts)

  • style (15 pts)

  • README (1 pts)

Total: 51 points

Extra credit:
  • extra shape: easy, e.g., square (2 pts)

  • extra shape: harder, e.g., triangle (any kind) (5 pts)

  • move shapes (10 pts)

Possible Extra Credit: 17 points

Setup

Create a new repository for this assignment by going to the CS450 Fall 2023 GitHub Organization page and clicking "New".

On the "Create a new repository" screen:
  • Name the repository <YOUR ACCOUNT NAME>-hw10 where <YOUR ACCOUNT NAME> is your GitHub account name.

    For example, if my GitHub account is cs450student then I would name my hw10 repository cs450student-hw10.

  • Mark the repository as Private.

  • Check "Add a README file".

  • Add a .gitignore file for "Racket" to automatically ignore temporarily files.

When done click "Create repository".

Starter Code

Here is a hw10 starter repo. It contains the code from lecture 27, which illustrates how to write "OO style" code with structs.

(Note: The code is meant to be used as a guide. Please don’t submit any lecture 27 code as (part of) a solution. It will result in heavy deductions.)

Submitting

1 Before Submitting

Before submitting, note:
  • Do not submit until all code has been thoroughly tested, independent of the autograder (if there is one), and you are reasonably sure the assignment is complete and correct.

    The autograder is not a software development tool so it should not be used as one.

  • If you submit and get an autograder error, this means the code you wrote is not complete and correct and it’s up to you to figure out why.

    The course staff is here and eager to help, of course, but cannot do so without details about what has already been tried. (For example, "why is the autograder giving an error?" is not something we can help with.)

  • The grading criteria (i.e., test suite) is subject to change. This means that the grade on the preliminary autograder test suite (if one is provided) is not the final grade.

2 Common Problems

Common submission problems:

3 Files

A submission must have the following files in the repository root:

Also, the repository must have appropriate commit messages. See How to Write a Git Commit Message if you are unsure how to write a commit message.

4 GradeScope

When ready, submit this assignment to GradeScope using the "GitHub" submission feature with your hw10 repository selected.

Submission link: GradeScope HW10

HW Tasks

For this assignment, create a Racket big-bang program that allows the user to draw shapes onto a canvas. Only rectangles and circles are required, though you may add extra shapes for some extra credit (see Overview above).

Here is an online demo (roughly) illustrating the expected behavior: HW 10 demo.

The Shape code must be written in an object-oriented style, using structs. This means that a Shape data definition should be implemented with a struct whose fields are the required Shape methods (see lecture 27-28 for more details). Further, each method should have a "dispatch" function that accesses the correct field from a Shape instance and calls it with the instance.

Also, there should be a separate data definition for each shape item, and each of these items should have implementations of the required methods, and an alternate constructor where the method arguments are hidden.

Here more detailed specifications for the assignment:

Moving Shapes extra credit:
  • For example, credit implement the ability to move shapes. Specifically, if the "pointer" tool is selected, when the user clicks on the canvas, all shapes at that canvas position should be moved (together). The shapes-to-be-moved should follow the user’s mouse until the user releases the mouse, at which point the shapes stop moving.

As usual: