0% found this document useful (0 votes)
11 views5 pages

2023 Fall 223 Nmidterm

The CPSC 223N midterm requires students to create a program where a ball moves along a slanted line, turns at a corner, and finishes at a second slanted line, with user-defined coordinates for the start, corner, and finish points. Students must calculate Δx and Δy based on the distance moved and given formulas, and partial credit is available for incomplete submissions. The program is due by 10:00am on October 9, 2023, and must be submitted via email with specific instructions on file attachments.

Uploaded by

ttnn0203
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as ODT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views5 pages

2023 Fall 223 Nmidterm

The CPSC 223N midterm requires students to create a program where a ball moves along a slanted line, turns at a corner, and finishes at a second slanted line, with user-defined coordinates for the start, corner, and finish points. Students must calculate Δx and Δy based on the distance moved and given formulas, and partial credit is available for incomplete submissions. The program is due by 10:00am on October 9, 2023, and must be submitted via email with specific instructions on file attachments.

Uploaded by

ttnn0203
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as ODT, PDF, TXT or read online on Scribd
You are on page 1/ 5

2023 Fall CPSC 223N

Midterm: October 9, 2023 – 8am-10am

The basic idea

In Assignment 2 we learned how to turn right-angle corners. In Assignment 3 we


learned how to move in a straight slanted line. Now we will combine these two
techniques.

Make a program where the ball begins at the start of a slanted line, reaches a
corner, turns, and completes the trip at the end of the second slanted line.
The Ui looks like this.

Ball in Motion by Liz Garcia

Start Finish
The Pause Quit UI
1150 40 100 400 800 700
looks
like
Assignment 3. There are some differences. Here the user must input the
coordinates for 3 points, namely: start, corner and finish.

It is not important how you organize your control panel. You decide where you
want to place the input boxes for the new point. Wherever you choose is ok for
this midterm.

In assignment 2 you have to set new values for Δx and Δy whenever the ball
reached a corner. You will need to do the same thing here: give new values to Δx
and Δy when the ball center reaches the corner.

When the ball reaches the end of the second segment it simply stops and
execution is finished. It is time to click on quit.

End of requirements
Formulas

These formulas were given in a lecture. They are repeated here just in case you
need them.

Let d = distance moved in one tic.

Usually d is computed by division:

d = speed in pix_per_second / frequency of refresh clock.

Let the start point be A = (a1,a2); let the end point be B = (b1,b2).

Let the hypotenuse be H = sqrt{ (b1-a1)2 + (b2-a2)2 }

Then

Δx = (b1-a1) * d / H

and

Δy = (b2-a2) * d / H
Last notes

There is no separation into baseline and challenge.

The program is worth 100 points.

The instructor hopes you are able to re-use your previous class assignments.

Partial credit is available.

If your moving ball will not turn the corner then send me something interesting for
less points.

For example, you could send the ball always to the origin (0,0).

Another partial credit: when the ball reaches the end of the first slanted line send
it straight back to the starting point where it comes to a rest.

If your program will not perform according to the requirements on pages 1 & 2
then make it do something so that your gain some partial credit.
Due date

The due time is 10:00am. The same end time must apply to everyone. It would
be unfair if one individual were allowed to have more time than other students.

When you finish send me your 3 files as attachments to an email directed to


[email protected]. This is the same as submitting your assignments.

Do not send links to your midterm stored in a cloud.

I accept multiple submissions. I will grade the newest of all your program
submissions.

If you wish to include a message to me with your source files, the best thing to do
is to include the message with the source files. Put the message as a comment at
the end of the driver source file.

I like to receive messages, but here is what happens. When I receive your
submitted files I separate the attachments from the email and save the
attachments in a folder with your name on the folder. When I grade your program
a few days later I usually don’t have Outlook open and I can no longer connect
your submitted program with the message in the email.

End of specification document.

You might also like