Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Advanced Programming Windows Applications. Create a new Project Select a C# Windows Application.

Similar presentations


Presentation on theme: "1 Advanced Programming Windows Applications. Create a new Project Select a C# Windows Application."— Presentation transcript:

1 1 Advanced Programming Windows Applications

2 Create a new Project Select a C# Windows Application

3 3

4 4

5 5 ToolTips

6 6

7 7

8 8

9 9

10 10

11 11

12 12

13 13

14 14

15 15

16 16

17 17

18 Adding C# Code to a Button 18 private void button1_Click(object sender, EventArgs e) { }

19 19

20 20

21 21

22 22

23 23

24 24

25 25

26 26

27 27

28 28

29 29

30 30

31 31

32 32

33 33

34 Example 34

35 35

36 36

37 Write a code in each button of the flowing windows application that calculates the electricity bill. the price of the electricity rate is 10 for each kilowatt for governmental use, 5 for home use and 20 for commercial use. The command “Clear” removes the old values from the texts in the program 37

38 38 Example Write a program to ask you for the temperature in Fahrenheit and then convert it to Celsius. Given: C= 5/9 (F-32) Write a program to ask you for the temperature in Celsius and then convert it to Fahrenheit.

39 39 Examples Write a program to ask the user for the radius of a circle, and then display its area and circumference.

40 40 Example Display one word to describe the integer value of number as “Positive”, “Negative”, or “Zero”

41 Programming Examples Write a program to ask the user for the width and length of a piece of land and then tell him how many orange trees he can grow on it. Given that each orange tree requires 4 m 2.

42 42 Example Write a program to ask a student for his grades in 3 exams ( each out of 50 ), get their total and inform the student whether he passed or failed the course.

43 43 Example Assume you put 1000 pounds in a projects that returns a profit of about 5% per year. How long will it take for your money to double ? Assume you put 5000 pounds in a projects that returns a profit of about 10% per year. How much money will you have in 5 years

44 44 Example Write a program to display all the numbers divisible by 5 in the range 0 to 5000.

45 Write a program to calculate the total price of a certain purchase. There is a discount and shipping cost: –The discount rate is 15% and the shipping is 10.00 if purchase is over 1000.00. –Otherwise, the discount rate is 5% and the shipping is 7.00 pounds.

46 46 Example Your city classifies a pollution index –less than 35 as “Pleasant”, –35 through 60 as “Unpleasant”, – and above 60 as “Health Hazard.” –Display the correct description of the –pollution index value.

47 47 Example The Air Force has asked you to write a program to label aircrafts as military or civilian. Your program input is the plane’s speed and its estimated length. For planes traveling faster than 1100 km/hr, you will label those shorter than 52 m “military”, and longer as “Civilian”. For planes traveling less than 1100, you will issue an “aircraft unknown” statement.

48 48 Write a program that calculates bills for 66 customers using methods of the Electricity company. There are 3 types of customers: residential (code R), commercial (code C), and Industrial (code I). - For a code R customer, the bill is $10 plus $0.05 for each kilowatt used. - For a code C customer, the bill is $1000 for the first 2000 kilowatt, and $0.005 for each additional kilowatt used. - For a code I customer, the bill is $1000 if he used less than 4000 kilowatt, $2000 if he used between 4000 and 10000 kilowatt, or $3000 if he used more than 10000 kilowatt. The inputs of the program should be the type of customer ( R, C or I) and the kilowatts used. The output should be the amount of money the customer has to pay.

49 Construct C# console application to solve the following problem. A football team plays n games per year in its league. Given n and the scores of all of the games the team played this year (both the team’s score and its opponent’s score for each game), compute the team’s margin of victory in the games that it played (win = 3, tied = 1 and ignore lost). 49

50 Example Write application that generate 10 random numbers and stores them in an array and then finds out how many times each of these numbers occurs in this array 50

51 Find the output of the following Code (10 points): int i, n = 4; float x = 1.0; for (i = 1; i <= n; i++) { x = 1 / x; x = x + 1; Console.WriteLine(i+"\t"+x); } 51


Download ppt "1 Advanced Programming Windows Applications. Create a new Project Select a C# Windows Application."

Similar presentations


Ads by Google