Problem Set One.e10a.2017.pdf - Computer Science E-10a Introduction to Computer Science Using Java I Starting From Scratch Part A 54 points total plus 5

Problem Set One.e10a.2017.pdf - Computer Science E-10a...

This preview shows page 1 - 4 out of 11 pages.

Computer Science E-10a: Introduction to Computer Science Using Java, I Starting From Scratch Part A: 54 points total, plus 5 points of “extra credit” 1. (6 points) Create a new Scratch project. Change the standard cat sprite into a “fish” (one of the standard sprites that comes with the Scratch software) and then construct the following two Scratch scripts for that sprite. Save this project as fishDrawing.yourLASTname.sb2 Run the program by clicking the green flag. What happens when you move your mouse around on the stage while the program is running? While the program is executing, you should occasionally press the space key and watch what happens. The color will not change that perceptibly unless you hold down the spacebar for a while. The color range is 0-200. Now add some code to this project so that every time you press the letter “C” on the keyboard the stage will entirely get erased before the sprite starts drawing again. Dr. H. H. Leitner
Image of page 1
Computer Science E-10a: Introduction to Computer Science Using Java, I 2. (13 points) Create a new Scratch project, and construct the following program. Before executing this project, try and predict what will happen. Caution: There are *two* "set pen color to" blocks: you want to use the second one that takes numbers for input. Now modify this program so it can produce output that looks like this: Dr. H. H. Leitner
Image of page 2
Computer Science E-10a: Introduction to Computer Science Using Java, I Page 11 If you look carefully at this figure, the simple square shape that the original program would draw just once is now being drawn six times (each one rotated a bit more than the previous one), so we get a circular overall shape. The modification you need to make should be really simple: it will consist of adding a repeat loop which will enclose the existing repeat loop (in other words, you’ll end up with a repeat loop inside of another one). In addition, you will need to add a “turn” command. Here is what the modified program would produce if we simply increase the number of repetitions in the new repeat loop and correspondingly decrease the number of degrees that the sprite rotates before drawing another square: (Hint: the number of repetitions multiplied by the number of degrees the sprite turns before the next repetition should equal 360 in order to accomplish the overall circular shape.) Save this project as rotatingSquares.yourLASTname.sb2 .
Image of page 3
Image of page 4

You've reached the end of your free preview.

Want to read all 11 pages?

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes