Solved 24-780 Engineering Computation Problem Set 03

$30.00

Original Work ?

Download Details:

  • Name: Assignment-3-myv2yu.zip
  • Type: zip
  • Size: 815.01 KB

Category: Tags: , , You will Instantly receive a download link upon Payment||Click Original Work Button for Custom work

Description

Rate this product

PS3-1 Draw Scotti (30 pts) [ps3-1.cpp]
Start with the base code (ps3-1.cpp) that includes coordinates of Scotti. In each array of integers, head,
body, and scarf, elements [i*2] are X coordinates, and elements[i*2+1] are Y coordinates. Number of
elements for head, body, and scarf are defined as headLen, bodyLen, and scarfLen in the base code.
Your program needs to open a 800×600-pixel wide window, and use GL_LINE_STRIP to draw Scotti.
Head and body need to be black (all RGB components are zero), and scarf needs to be red (only red
component is maximum intensity, blue and green are zero).
Save the C++ program (named ps3-1.cpp) and include it in the Zip file that you submit to the Canvas.
If you write your program correctly, you window will look like:

PS3-2 Drawing a clock (70 pts) [ps3-2.cpp]
In this problem, you write a program that:
(1) Takes hour, minute, and second from the console (you can use std::cin or scanf),
(2) Opens 800×600 graphics window, and
(3) Draws a clock.
The user enters hour and minute separated by a space, not comma or other symbols. Assume that the
user always enter two numbers separated by a space. You do not have to consider a wrong input (eg.
having non-numeric characters, numbers separated by comma).
Your program must have a function called DrawClock that takes two integers as function parameters the
first and second parameters for hour and minute respectively.
The clock must be centered at (400,300). Outer-circle radius is 250 pixels. Shorter tick mark must start
from 230 pixels away from the center and 10 pixels long. Longer tick mark must start from 200 pixels
away from the center and 40 pixels long. Hour-, minute-, and second- hands are 160, 200, and 220
pixels long respectively.
If the user enters “10 23 16” your graphics window must look like the following picture.
Hour- and minute-hands may point to in-between tick marks. Second-hand may point exactly at a tick
mark if you take input as an integer. (You can take input as int or double of your choice.)

Write a C++ program (ps3-2.cpp) and include it in the Zip file that you submit to the Canvas.
250 pixels
160 pixels
200 pixels
200 pixels
40 pixels
230 pixels
10 pixels
220 pixels