Presentation is loading. Please wait.

Presentation is loading. Please wait.

Getting Started with Programming

Similar presentations


Presentation on theme: "Getting Started with Programming"— Presentation transcript:

1 Getting Started with Programming
Lecture 1 Getting Started with Programming using Visual Studio

2 What is Software?

3 Implementing a Program is NOT the Hard Part
An aging maintenance man at an engineering plant was forced into retirement as a money-saving measure following extensive modernization of the plant. Soon after leaving, he was called back to help fix some of the equipment that had broken down and was not responding to the trouble-shooting methods being recommended by the newly installed automated control system. The elderly maintenance man walked into a maze of pipes, took out a hammer and gave one of the pipes a sturdy whack. The machinery immediately starting running. The maintenance man sent the plant manager the following invoice: Fee for service $1,000.00 Hitting pipe with hammer $ Knowing which pipe to hit $

4 Software Development Process
Calculate your car’s gas mileage. We need two odometer readings, and the number of gallons of gas used between them. Fill tank Record first odometer reading Drive a while Fill tank and note number of gallons required. Record second odometer reading Divide difference in odometer readings by the number of gallons used. Live demo in Class What types of things should we test?

5 Structured Procedural Programming
In a structured program, the computer controls the sequence of operations. When the program needs input from the user, a message is displayed and the program will wait for the user to respond. Otherwise the program moves through the program step-by-step until the intended results are ready to be displayed to the user or stored for later use. Structured procedural programs can be implemented as console applications.

6 Object-Oriented Programming
In this course we are going to side-step a lot of the “hoopla” associated with object-oriented programming. As stated in the (Doyle) textbook, The concept behind object-oriented programming (OOP) is the applications can be organized around objects rather than processes. While there is a lot of other aspects of OOP, they are more about the theory than the practice of writing programs. For our purposes we note that the graphical elements in a graphical user interface (GUI) program such as buttons, textboxes, counters, sliders, menus, etc...are objects. We will write software that performs specific functions whenever the user interacts with these objects. These functions and methods are known as event-handlers. The sequence of operations in a GUI application are controlled by the user rather than the computer.

7 We want (need) to see the File Extensions

8 Building a Console Application

9

10

11 Building a Windows Forms Application
For the class desktop computers we will need to change the working directory... Using the Desktop will make it easier for us to find the project.

12 Building a Hello World Program in Visual Studio C#

13

14 C# Visual Studio Console Commands
BackgroundColor Gets or Sets the background color of the console. Beep() Plays the sound of a beep through the console speaker. Beep(Int32, Int32) Plays the sound of a beep of a specified frequency and duration through the console speaker. Clear( ) Clears the console buffer and corresponding console window of display information. ForegroundColor Gets or Sets the foreground color of the console. Read( ) Reads the next character from the standard input stream. ReadKey( ) Obtains the next character or function key pressed by the user. The pressed key is displayed in the console window. ReadLine( ) Reads the next line of characters from the standard input stream. ResetColor( ) Sets the foreground and background console colors to their defaults. Write( ) Writes the specified content to the standard output stream. WriteLine( ) Writes the specified content to the standard output stream.

15 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Hello_Console { class Program static void Main(string[] args) Console.BackgroundColor = ConsoleColor.Yellow; Console.ForegroundColor = ConsoleColor.Blue; Console.WriteLine("Hello CSC232"); Console.Beep(); Console.Beep(8000, 200); Console.ReadKey(); }

16 Dragging and Dropping Controls onto a Form

17 Changing the Properties of a Control

18 Adding an Even-Handler to a Control
Double-clicking the “Click Me” button creates code for a click event handler. We add the MessagBox.Show line to the body of this method. Now we are ready to run this program. Click on the green triangle under the Debug menu.

19


Download ppt "Getting Started with Programming"

Similar presentations


Ads by Google