Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

COMP 1500 Fall 2022

Assignment 2

Question 1: C1500 Programming

For this question, you will write C1500 programs, using the C1500 emulator.                You will hand in script files for your programs. To produce the files, do the following:

1.   Write your programs using the C1500 emulator page. You should include comments on each instruction of your programs, giving a brief explanation of its purpose.

2.   Use the Rename button to rename the tab. Include your name, and the program in the renamed tab (e.g. StewDentProg1).

3.   Use the Export button to export your program to a file. For example, the above           named tab will produce a file named StewDentProg1.c15 when exported. This will be saved to your usual folder for downloads.

Program 1: Divisibility Checker [3 marks]

Write a C1500 program that will check if your student number is divisible by your age.        Load your student number and your age into memory, then perform the math necessary to determine if your student number is divisible by your age. Finally, output the quotient if     your student number is divisible, or the remainder if it is not. Make sure to include your      student number.

Program 2: how many? [7 marks]

Write a C1500 program that will accept as input a series of numbers from user and count how many numbers is entered. Also, count how many of the numbers are even numbers. This program will keep accepting numbers until a value of 0 is input. This requires your   program to perform looping until zero is entered by user. Once the zero value is entered, output the number of numbers entered and the number of even numbers entered.

Question 2: SNAP! Programming

For this question, you will write SNAP! programs. To hand in your answers, you will use the Export project… command to save your scripts as XML files. Include the answers to BOTH    questions in the same project.

Program 1: My8PointStar block [6 marks]

Make a new Command block called My8PointStar, which will draw a 8-Ponit-Star. Make this new block under the Pen blocks.

The new block will accept 3 parameters; the first two are the x- and y-coordinates of one top point of the star, the third is the size sides and the fourth is the size (i.e. the length of one line). Shown here are how the new block should appear, and the result of using it.

 

Your new block must use a loop instead of repeated sequences of move and turn blocks.

Program 2: draw a Grid of Stars [9 marks]

Use your My8PonitStar draw a grid of stars like the one shown. (The sprite was moved off the visible part of the stage, but you don't have to do that.) Your grid should fill a large portion of the stage.

To draw the grid, you certainly need to work with loops to draw rows (or columns). No mark would be awarded, if loops are not used in your script.

Create a script to draw the grid. You may choose to make it into a block, but it can also simply be a script that is contained in the Scripting area and may be run by clicking on it. You can make the star any size you wish, but there should at least be 16 stars in the grid and the grid must completely fill in the stage and stars do not cross the edges of the stage.