1 / 13

Programming Language Features

Programming Language Features. Syntax Semantics. Syntax Diagram. Syntax Diagram. Syntax Diagram. Syntax Diagram. Syntax Diagram. Syntax Diagram. Syntax Diagram. Syntax Diagram. Syntax Diagram. Drawing Gizmo Example. // Example program with parameters that displays a T

hina
Download Presentation

Programming Language Features

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Programming Language Features • Syntax • Semantics

  2. Syntax Diagram

  3. Syntax Diagram

  4. Syntax Diagram

  5. Syntax Diagram

  6. Syntax Diagram

  7. Syntax Diagram

  8. Syntax Diagram

  9. Syntax Diagram

  10. Syntax Diagram

  11. Drawing Gizmo Example // Example program with parameters that displays a T // The T is drawn by the method drawT public class Driver { private DrawingGizmo pencil; public void drawT() { //Draws a letter T //PRE: Assumes the current position of the pen is the // leftmost postion of the top of the T and the direction // of the pen is 0 degrees //POST: The method leaves the pen at the rightmost // position of the top of the T and the direction of the // pen is 0 degrees pencil.draw(); pencil.turnBy(90); pencil.moveBy(80);

  12. Drawing Gizmo Example //Move the pen to the middle of the top of the T pencil.dontDraw(); pencil.turnBy(-180); pencil.moveBy(40); //Draw the vertical part of the T pencil.draw(); pencil.turnBy(-90); pencil.moveBy(120); //Move pen to the rightmost position of the top of the T //leave the direction of the pen at 0 degrees pencil.dontDraw(); pencil.turnBy(180); pencil.moveBy(120); pencil.turnBy(90); pencil.moveBy(40); pencil.turnBy(-90); }

  13. Drawing Gizmo Example public Driver() { pencil = new DrawingGizmo(); //Move the pen to the left pencil.dontDraw(); pencil.turnBy(-90); pencil.moveBy(80); pencil.turnBy(90); drawT(); } }

More Related