Presentation is loading. Please wait.

Presentation is loading. Please wait.

CH1 – A 1 st Program Using C#. Program Set of instructions which tell a computer what to do. Machine Language Basic language computers use to control.

Similar presentations


Presentation on theme: "CH1 – A 1 st Program Using C#. Program Set of instructions which tell a computer what to do. Machine Language Basic language computers use to control."— Presentation transcript:

1 CH1 – A 1 st Program Using C#

2 Program Set of instructions which tell a computer what to do. Machine Language Basic language computers use to control its switches 0 = switch is off 1 = switch is on High-Level Programming Language Uses ‘reasonable’ words as instructions Syntax Language rules

3 Compiler Translates high-level language into machine code Syntax-error Incorrect use of programming language Logic Instructions in the correct order to produce the desired results Debugging Correcting syntax and logic errors

4 Turn to page 39 and answer Review Questions 1 – 3.

5 Object-Oriented Programming (OOP) an approach to designing modular, reusable software systems Variable Computer memory storage location Identifier Variable name Object Contains its own variables, methods Similar to real-world objects (green racing car)

6 Attributes Objects characteristics States Value of an attribute Class Category of objects Instance An individual member of an object Method a collection of statements grouped together to perform an operation. Add a to b = c Racing Automobile Green racing car

7 Class (Automobiles) (attributes, methods) Object (year, make, model, color) (attributes, methods, variables) Instance (Green racing car) Instance (Blue suburban)

8 Encapsulation Packaging an object’s attributes and methods into an undivided entity. Polymorphism Creates methods which act appropriately depending on the context. Inheritance The ability to extend a class so as to create a more specific class. Filling your dog v. filling your car Automobile v. RacingCars

9 Turn to page 39 and answer Review Questions 4 - 7.

10 C# - object-oriented and component-oriented language. Literal String A series of characters which will be used exactly as entered Enclosed within double quotation marks “ “ Label the literal string on the diagram Argument Info a method needs to perform its task. Enclosed within double parentheses ( ) Label the argument on the diagram “Hello, world!” (“Hello, world!”)

11 WriteLine () – a method which displays output and positions the cursor on the next line. Label the method on the diagram Namespace A way to group similar classes. System namespace = holds commonly used classes Label the namespace on the diagram Label the Main method on the diagram Method Header Method name Info about what will pass into and be returned from the method. Label the method header on the diagram

12 Method Body All the instructions executed by the method. Enclosed between double {} Label the method body on the diagram Whitespace Blank lines Label one example of whitespace on the diagram Keyword Predefined/reserved identifier which has special meaning to the compiler. Static – method executed through a class, not by an object Void – method does not return any value Use Table 1-1 on page 13 to label the keyword(s) on the diagram

13 Access Modifier Defines the circumstances about when the method may be used. Private – other classes may not use the method Public – other classes may use the method Label the access modifier(s) body on the diagram Source Code The text of the program you write

14 Turn to page 40 and answer Review Questions 9 – 14 and 17. NEXT Turn to page 41 and answer Exercises 2 and 3.

15 Identifiers MUST Begin with an underscore, @, or a letter Contains only letters or digits Cannot be a C# reserved keyword Programming Standard (see page 14 Table 1-2) Begin with uppercase letter Use uppercase letters to improve readability

16 Turn to page 40 and answer Review Questions 15 - 16. NEXT Turn to page 41 and answer Exercise #1.

17 Line Comments Begin with two forward slashes // Block Comments Begin with a forward slash and an asterisk /* End with and asterisk and a forward slash */ Write comments on the diagram stating something the program is doing

18 ; ‘period’ at the end of each line. Separate the names of namespace, class, object, method

19 1. Open Microsoft Visual C# 20102 Express 2. Click File, New, Project 3. Click Console Application 4. Type the name of the project in the Name barHelloWorld 5. Browse to your W: drive in the Location bar 6. Create a C# folderW:\IntroPgming\C#\ 7. Make sure the location bar has your W: drive and folder name!!! 8. Click OK. 9. Turn to page 30 and enter the code in figure 1-19. (some is already there) Type at least one comment. 1. Click Save. 2. Click Build, Build Solution 3. Click Debug, Start with Debut if there are errors 4. Click Debug, Start without Debug if there are no errors

20 Turn to page 42. Complete exercises 4, 5, 7, 8. Include comments in all programs. NEXT Turn to page 43. Complete the four Debug exercises.


Download ppt "CH1 – A 1 st Program Using C#. Program Set of instructions which tell a computer what to do. Machine Language Basic language computers use to control."

Similar presentations


Ads by Google