Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

You might need to see this as well. 5) Homework 3 assignment- Due betfore next w

ID: 3739795 • Letter: Y

Question

You might need to see this as well.

5) Homework 3 assignment- Due betfore next week's lass, ie before 200pm Use PhilsPlot to bounce a photon off of a mirror. The angle of incidence (not 0 or 90 degrees) should equal the angle of reflection. Show the photon moving with time. The mirror surface should be horizontal near the bottom of the screen and the photon should start at the upper left, strike the mirror surface at the middle (in the left-right direction) of the screen, and reflect off to the upper right. (Refer to the in-class demonstration.)

Explanation / Answer

Code

#include<graphics.h>

#include<conio.h>

void main()

{

int i,j ;

int gd= DETECT, gm;

//initialize graphics

initgraph(&gd, &gm, "C:/TURBOC3/BGI");

//draw a line

line(0, 320, 640, 320);

//Loop to draw path of photon from (0,0) of the screen on the mirror

for(i=0; i<320; i++)

{

line(0,0,i,i);

delay(10);

}

getch();

//Loop to draw path of the photon after bouncing off from the mirror

j=320;

for(i=320; i<640; i++)

{

line(320,320,i,j);

j--;

delay(10);

}

getch();

closegraph();

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote