Midterm: Question 1 (35%) (30 minutes) Write an assembly program to draw a rectangle. – (5%) Show a message to ask for information of the rectangle – (5%)

Slides:



Advertisements
Similar presentations
BGI graphics library And Visual Studio.
Advertisements

Laboratory Study II October, Java Programming Assignment  Write a program to calculate and output the distance traveled by a car on a tank of.
LAB SESSION 7 Graphical user interface Applet fundamentals Methods in applets Execution of an applet Graphics class.
Revision.
CS1 Lesson 3 Expressions and Interactivity CS1 -- John Cole1.
1 Objectives Understand streamed input and output.
Mrs. Chapman. Tabs (Block Categories) Commands Available to use Script Area where you type your code Sprite Stage All sprites in this project.
CS Sept Your first C++ program… Boilerplate // Cannon, demo program #include using namespace std; int main() {// program goes here… return.
Arrays Programming COMP102 Prog. Fundamentals I: Arrays / Slide 2 Arrays l An array is a collection of data elements that are of the same type (e.g.,
Copyright © 2012 Pearson Education, Inc. Chapter 3: Expressions and Interactivity.
1 9/29/06CS150 Introduction to Computer Science 1 Loops Section Page 255.
Searching Arrays. COMP104 Lecture 22 / Slide 2 Unordered Linear Search * Search an unordered array of integers for a value and return its index if the.
1 11/27/06CS150 Introduction to Computer Science 1 Searching Arrays.
Logo Lesson 3 TBE 540 Fall 2004 Farah Fisher. Prerequisites for Lesson 3 Before beginning this lesson, the student must be able to… Use simple Logo commands.
Function tax and buy_one double tax (double price, double tr) { return price*tr; } double buy_one() { double p; cout > p;
Practice for Midterm 1. Practice problems These slides have six programming problems for in-class practice There are an additional seven programming problems.
Mr. Wortzman. Tabs (Block Categories) Available Blocks Script Area Sprite Stage All sprites in this project.
C++ Basics CSci 107. A C++ program //include headers; these are modules that include functions that you may use in your //program; we will almost always.
Programming is instructing a computer to perform a task for you with the help of a programming language.
Checkerboard Examples Top Down Design. The Problem On a checkerboard where locations are numbered similar to java coordinates, draw a rectangle using.
Input and Output in Console Mode UNIVERSITY OF THE PUNJAB (GUJRANWALA CAMPUS) ADNAN BABAR MT14028 CR
30S Applied Math Mr. Knight – Killarney School Slide 1 Unit: Linear Programming Lesson 3: Solving Systems Using Graphmatica Solving Systems Using Graphmatica.
Today in CS161 Lecture #4 Solving Problems with Computers Walk through the Tic Tac Toe Algorithm Getting ready for Creating Programs Turn the Inches to.
AutoCAD Basics The AutoCAD Interface Draw Tool Palette Pull-down Menus
Modifying objects Operators and Expressions JPC and JWD © 2002 McGraw-Hill, Inc.
Chapter 3 Expressions and Interactivity Department of Computer Science Missouri State Univeristy.
Today in CS161 Lecture #9**go to Blackboard ** Practicing… Review from Shackelford Reading If statements Loops Begin writing Programs Using if statements.
Value and Reference Parameters. CSCE 1062 Outline  Summary of value parameters  Summary of reference parameters  Argument/Parameter list correspondence.
Programming for Artists ART 315 Dr. J. R. Parker Art/Digital Media Lab Lec 10 Fall 2010.
Quiz. Quiz One Type your name, ID and address in the.asm file. MUST DO or ZERO SCORE. Change q1 to yourStudentID_q1. You were working as a programming.
Quiz. Quiz Two Type your name, ID and address in the.asm file. MUST DO or ZERO SCORE. Change q1 to yourStudentID_q1. You were working as a programming.
Java course. Assignment #2, due: Feb. 27, (20) (a) Tell the difference between the abstract class and the interface. (b) Tell the difference between.
Lecture 4 Looping. Building on the foundation Now that we know a little about  cout  cin  math operators  boolean operators  making decisions using.
Graphic Basics in C ATS 315. The Graphics Window Will look something like this.
Algorithms Writing instructions in the order they should execute.
C++ Programming, Namiq Sultan1 Chapter 3 Expressions and Interactivity Namiq Sultan University of Duhok Department of Electrical and Computer Engineerin.
Expressions and Interactivity. 3.1 The cin Object.
Lecture 4 Function example. Example1 int max (int a, int b) { int c; if (a > b) c = a; else c = b; return (c); } void main ( ) {int x, y; cin>>x>>y; cout.
1 CS161 Introduction to Computer Science Topic #8.
Intro to Inventor. 1. Create a new part. Go to upper left corner of screen to I-Pro/New, Part.
Homework #2: Functions and Arrays By J. H. Wang Mar. 24, 2014.
1 Getting Started with C++ Part 2 Linux. 2 Getting Started on Linux Now we will look at Linux. See how to copy files between Windows and Linux Compile.
Lecture 5: Expressions and Interactivity Professor: Dr. Miguel Alonso Jr. Fall 2008 CGS2423/COP1220.
Assembly Language Makeup Miterm Lecturer: Sai-Keung Wong National Chiao Tung University Rename the template folder name to: YourStudentID_YourName. If.
Quiz. Quiz Three Type your name, ID and address in the.asm file. MUST DO. If not, you will receive a score of zero. Change the folder name to yourStudentID_q3.
Int fact (int n) { If (n == 0) return 1; else return n * fact (n – 1); } 5 void main () { Int Sum; : Sum = fact (5); : } Factorial Program Using Recursion.
VG101 RECITATION 5 By TAs. CONTENTS How to read Vg101Class.h Samples about graphics About assignment 5 Array.
Basic Graphics 03/03/16 & 03/07/16 Imagine! Java: Programming Concepts in Context by Frank M. Carrano, (c) Pearson Education - Prentice Hall, 2010.
1 Generating Random Numbers Textbook ch.6, pg
Recitations Sep 8-9 u conditionals: if-else statement u boolean expressions u classes and instances.
House Design Using Google Sketchup You will create a four room house containing a living room, bedroom, bathroom, and kitchen.
Today in CS161 Lecture #7 Learn about… If and else statements Rewrite our First Program Using if and else statements Create new Graphics Demos Using if.
Looping I (while statement). CSCE 1062 Outline  Looping/repetition construct  while statement (section 5.1)
Surface Area I can calculate the surface area of a prism Direction:
Surface Area Tutorial Read and answer the questions on each slide.
Basic concepts of C++ Presented by Prof. Satyajit De
Intermediate Programming using C++ Functions part 2
First text statement positioned here at guide intersection
Basic Graphics Drawing Shapes 1.
4.14 GUI and Graphics Case Study: Creating Simple Drawings (Cont.)
Screen output // Definition and use of variables
1.
Today in CS161 Week #5 **weekly visit D2L** Practicing…
الوحدة الرابعة البرمجة وصياغة حل المسائل البرمجة وأهميتها أهداف الدرس الأول مفهوم البرمجة. الفرق بين المبرمج ومستخدم البرنامج. الحاجة إلى البرامج.
Balancing Chemical Equations
Let’s Write a Graphics Program
Today in CS161 Week #5 **go to Blackboard ** Practicing…
Surface Area of Rectangle Prisms
C++ Basics CSci 107. A C++ program //include headers; these are modules that include functions that you may use in your //program; we will almost always.
Balancing Chemical Equations
Presentation transcript:

Midterm: Question 1 (35%) (30 minutes) Write an assembly program to draw a rectangle. – (5%) Show a message to ask for information of the rectangle – (5%) Read the width, height and coordinates of the upper left corner of the rectangle. – (5%) Draw the boundary (width = 1) of the rectangle with green color. – (5%) Fill the center with yellow color. – (5%) Press ‘q’ to quit the program and clear the screen. – (5%) Show your student ID at the end of the program. – (5%) Explain how you implement the program. – Example: Enter the information of the rectangle Width : 7 Height : 5 Upper left corner X coordinate: 5 Upper left corner Y coordinate: 10 (0, 0)X Y

Midterm: Question 2 (35%) (1.5 hours) The following is a program “P” written in C++. Assume no overflow. Write an assembly to perform what “P” does. (20%) void main () { unsigned int a[100]; int n; cout << “Please enter a number:” << endl; cin >> n; //ask for input for ( int i = 0; i < n; ++i ) { a[i] = rand() % n; // random generator cout << “a[i]:” << a[i] << endl; sum = evaluate( a[i] ) ; cout << “The result is:” << sum << endl; } for ( int i = 0; i < n; ++i ) cout << a[i] << “ “ << endl; } int evaluate( unsigned int m ) { If ( m ==0 ) return m; else return m*computeSum(m-1); } int computeSum ( unsigned int m ) { If ( m ==0 ) return m+1; else return m*m+computeSum( m-1 ); } Please enter a number: 3 a[0]: 1 The result is: 1 a[1]: 0 The result is: 0 a[2]: 2 The result is: (10%)(5%)

Midterm: Question 3 (30%) Estimated time: One hour Write a program to move two characters horizontally. The screen dimension is 80x24 (width x height). The colors of the two characters are red and green, respectively. Initially: – (2%) the two characters are at (39, 12) and (38, 12). – (5%) the red character moves to the left side. – (2%) the green character moves to the right side. - (5%) If they hit the boundary of the window, reverse their movement direction. - (5%) If they hit each other, reverse their movement direction. The movement of each character has a delay. - (5%) Can be continue. - (2%) Press key ‘q’ to quit the program at any time and clear the screen. - (2%) Show your student ID at the end of the program. -(2%) Explain how you implement the program. Example: Enter the movement delay of the red character (ms): 500 Enter the movement delay of the green character (ms): 250 Snapshots direction