VISUAL C++ PROGRAMMING: CONCEPTS AND PROJECTS Chapter 6B Methods (Tutorial)

Slides:



Advertisements
Similar presentations
Chapter 9 Color, Sound and Graphics
Advertisements

ZCE 111 Assignment 4. Q1. Measuring the speeds of a planet orbiting in an ellipse Consider a planet is orbiting along an ellipse with semi-major a=2 and.
Microsoft Visual Basic 2010: Reloaded Fourth Edition Chapter Eight Sub and Function Procedures.
1 © 2010 Pearson Education, Inc. All rights reserved © 2010 Pearson Education, Inc. All rights reserved Chapter 9 Analytic Geometry.
Visual C++ Programming: Concepts and Projects
Department of Physics and Applied Physics , F2010, Lecture 10 Physics I LECTURE 10 3/3/10.
PictureBox, Timer, Resources. Resources An easy and effective way to add pictures (photos, graphics) to your programs Using Resources guarantees that.
CH 12: Gravitation. We have used the gravitational acceleration of an object to determine the weight of that object relative to the Earth. Where does.
ZCE 111 Assignment 3. Q1. Two Projectiles Two projectile are launched. Projectile is launched at location (0,0) at t=0. Projectile 2 is launched at location.
13-3: Radian Measure Radian Measure There are 360º in a circle The circumference of a circle = 2r. So if the radius of a circle were 1, then there a.
Kepler’s Laws Of Planetary Motions. Introduction Kepler’s three laws are empirical - they describe a phenomenon without explaining why it occurs. Kepler.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide 8- 1 Homework, Page 653 Find the vertices and foci of the ellipse.
MrsBillinghurst. net A2 Computing A2 Computing Projects Game Animation in Pascal.
Visual C++ Programming: Concepts and Projects Chapter 6A: Methods (Concepts)
Special Applications: Central Force Motion
Foundation Programming Introduction. Aims This course aims to give students a basic understanding of computer programming. On completing this course students.
Java Programming, 3e Concepts and Techniques Chapter 3 Section 65 – Manipulating Data Using Methods – Java Applet.
Opening for today… Kepler’s Laws of Planetary Motion Objective: Students will explain planetary motion using gravitational laws.
Physics 201: Lecture 24, Pg 1 Chapter 13 The beautiful rings of Saturn consist of countless centimeter-sized ice crystals, all orbiting the planet under.
Kepler’s 1 st Law of Planetary Motion. 1. The orbits of the planets are ellipses, with the Sun at one focus of the ellipse. The Sun is not at the center.
9.1.2 – Applications of Ellipses, Other Information.
Copyright © Cengage Learning. All rights reserved. 10 Parametric Equations and Polar Coordinates.
Slide 5- 1 Copyright © 2006 Pearson Education, Inc. Publishing as Pearson Addison-Wesley.
Programming with Visual C++: Concepts and Projects Chapter 3B: Integral Data (Tutorial)
The PictureBox Control Prefix Prefix – pic Image Property PictureBox Image Property – Changes the image or file that appears inside of the PictureBox SizeMode.
Albireo: The Boy Scout star Chapter 5: Binary stars and stellar masses.
Programming with Visual C++: Concepts and Projects Chapter 2B: Reading, Processing and Displaying Data (Tutorial)
Planetary Orbits Planetary orbits in terms of ellipse geometry. In the figure, ε  e Compute major & minor axes (2a & 2b) as in text. Get (recall k =
Visual C++ Programming: Concepts and Projects Chapter 11B: Pointers (Tutorial)
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide 8- 1.
MS Visual Basic 6 Walter Milner. VB 6 0 Introduction –background to VB, A hello World program 1 Core language 1 –Projects, data types, variables, forms,
Copyright © Cengage Learning. All rights reserved. 9 Topics in Analytic Geometry.
Copyright © Cengage Learning. All rights reserved. 9.2 Ellipses.
17-1 Physics I Class 17 Newton’s Theory of Gravitation.
Visual C++ Programming: Concepts and Projects Chapter 12B: Linked List (Tutorial)
Projectile and Satellite Motion PROJECTILE MOTION We choose to break up Projectile Motion as a combination of vertical free-fall motion and horizontal.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 4 Working with Variables, Constants, Data Types, and Expressions.
Slide Chapter 8 Analytic Geometry in Two and Three Dimensions.
Daily Science Pg.30 Write a formula for finding eccentricity. Assign each measurement a variable letter. If two focus points are 450 km away from one another.
VISUAL C++ PROGRAMMING: CONCEPTS AND PROJECTS Chapter 3B Integral Data (Tutorial)
Programming with Visual C++: Concepts and Projects Chapter 4B: Selection (Tutorial)
Kepler’s Laws of Planetary Motion © David Hoult 2009.
© 2010 Pearson Education, Inc. All rights reserved
Spring 2002 Lecture #21 Dr. Jaehoon Yu 1.Kepler’s Laws 2.The Law of Gravity & The Motion of Planets 3.The Gravitational Field 4.Gravitational.
9.2. Ellipses Definition of Ellipse
Apollo Missions to the Moon Mr. Steve Heck Milford Junior High School 8 th Grade Earth Science This lesson is designed to engage students to inquire and.
Everything you need to know , 5.5, 5.6 Review.
Visual C++ Programming: Concepts and Projects Chapter 10B: Recursion (Tutorial)
VISUAL C++ PROGRAMMING: CONCEPTS AND PROJECTS Chapter 6A Methods (Concepts)
Visual C++ Programming: Concepts and Projects Chapter 10A: Recursion (Concepts)
WARM UP Write the general equation of an exponential function. Name these Greek letters β, θ, Δ, ε What transformation of the pre-image function y = x.
Eccentricity. Definition Degree of ovalness of an orbit around the sun.
10.3 ELLIPSES Write equations of ellipses in standard form and graph ellipses. Use properties of ellipses to model and solve real-life problems. Find eccentricities.
Orbit of Mercury Yeah protractors!. Planetary Orbits - All planets orbit the Sun in an ellipse - Semi-major axis (a) is half of the long axis.
Visual C++ Programming: Concepts and Projects
Drawing Angles in Standard Position
Chapter 13 Reading assignment: Chapter
Orbits and Eccentricity
Kepler’s Laws of Planetary Motion
Circular Motion.
Kepler’s Laws: Physics not optional!
Orbits…the celestial paths of planets
Copyright © Cengage Learning. All rights reserved.
Kepler’s Laws of Planetary Motion
Review for Test1.
Gravitational Fields, Circular Orbits and Kepler
Week 5 Wed. Orbits and Gravity OpenStax Astronomy Ch. 3
THE EARTH, THE MOON & THE SUN
Demana, Waits, Foley, Kennedy
Kepler’s Laws of Planetary Motion
Presentation transcript:

VISUAL C++ PROGRAMMING: CONCEPTS AND PROJECTS Chapter 6B Methods (Tutorial)

Tutorial: Planetary Motion Visual C++ Programming 2  Problem Analysis  Create a program with a planet that orbits around a central sun  Planets orbit in an elliptical path  The program will draw the planet at a new location at regular intervals  To calculate the next position of the planet you need to know the x coordinate of the center of the ellipse The length of the semimajor axis of the ellipse The angle of the planet from the semimajor axis

Visual C++ Programming 3

4

Design Visual C++ Programming 5  Interface sketch  Controls  PictureBox to draw on  Timer control to execute commands at regular intervals  Constants  Center of the ellipse  Length of the semimajor and semiminor axes  Instance variables  Graphics and Drawing objects

Visual C++ Programming 6

7

8

9

10

Design (continued) Visual C++ Programming 11  Algorithm  Algorithm for Timer1_Tick() Refresh the PictureBox Draw the sun Draw the planet Increase the angle

Visual C++ Programming 12

Visual C++ Programming 13

Development Visual C++ Programming 14  Create the interface  Assign an image file to the PictureBox to appear in the background  Important: to make the image appear Download the image Place it in your Project folder (within your Solution folder of the same name) Project6 (Solution folder) Project6 (Project folder) Use the Properties window to assign the image to the PictureBox

Visual C++ Programming 15

Visual C++ Programming 16

Visual C++ Programming 17

Visual C++ Programming 18

Visual C++ Programming 19

Visual C++ Programming 20

Development (continued) Visual C++ Programming 21  Coding  Declare and assign static constants  Declare handles for Graphics object and Drawing objects  Form1_Load() Construct graphics and drawing objects  btnStart_Click() Start the Timer control  btnStop_Click() Stop the Timer control

Visual C++ Programming 22

Visual C++ Programming 23

Visual C++ Programming 24

Visual C++ Programming 25

Development (continued) Visual C++ Programming 26  Coding Timer1_Tick()  Declare local variables  Refresh the pictureBox  Draw the sun  Draw the planet Convert angle from degrees to radians Calculate planet x and y coordinates Draw the planet  Increase angle by 5 degrees

Visual C++ Programming 27

Visual C++ Programming 28

On Your Own Visual C++ Programming 29  Instance methods with return values (Planets version 2)  ConvertToRadians()  Instance methods with value parameters (Planets version 3)  DrawPlanets()  Instance methods with reference parameters (Planets version 4)  SetXY()