UNIVERSITY OF THE FREE STATE MAIN & QWA-QWA CAMPUS RIS 124 DEPARTMENT: COMPUTER SCIENCE AND INFORMATICS CONTACT NUMBER:

Size: px
Start display at page:

Download "UNIVERSITY OF THE FREE STATE MAIN & QWA-QWA CAMPUS RIS 124 DEPARTMENT: COMPUTER SCIENCE AND INFORMATICS CONTACT NUMBER:"

Transcription

1 UNIVERSITY OF THE FREE STATE MAIN & QWA-QWA CAMPUS RIS 124 DEPARTMENT: COMPUTER SCIENCE AND INFORMATICS CONTACT NUMBER: EXAMINATION: Main End-of-year Examination 2013 PAPER 1 ASSESSORS: Prof. P.J. Blignaut & Mr. F. Radebe MODERATOR: Dr. L. de Wet TIME: 4 hours MARKS: 170 (+ 4 bonus marks) Answer the following questions by developing the solutions in C#. Make sure that you enter your name, student number and question number for every class in a comment block at the top of the code window. You will not get marks if you do it, but you will lose 3 marks for every question if you don t do it. You might even get zero for the entire test if you don t do it! Make sure that you give appropriate names to all controls and variables. Create the following folder on the T-drive in the format Studentnumber_Surname, e.g _Blignaut This is an open-book test. You may use the text book Be Sharp with C# but no other sources, written or electronic, will be allowed. Question 1 Consider the following character string: "John Michel is sick, and his teacher, Margaret Green, sends his sister, Nancy Michel, to find some medicine from doctor Hubert Ashton." 1.1 Develop a console application to replace all occurrences of "Michel" with "Black", "Green" with "Brown" and "Ashton" with "White". Your program must be generic in the sense that a user must be able to enter any sentence and ask for replacement of any word(s) with other(s). Note that there may be any number of words to be replaced. 1.2 Display the total number of replacements. For the example above, there are 4 replacements. [20]

2 2 Question 2 You will be provided with a tab-separated text file with the minimum and maximum temperatures of each day of January. Write a console application to display the smallest minimum temperature along with the day on which it occurred as in the example. Hint: The hex value for in the UTF table is B0. [20] Question 3 You will be provided with an Access database, Plants.accdb, with the common names and scientific names of plants. Write a console application that will allow the user to enter a common name or any part thereof and then display the common names and scientific names in two columns as in the example. The user must be allowed to enter more plant names if he/she wants. [20] Question 4 Consider the scenario of a physician s diary. There are two types of appointments, namely consultations and operations. 4.1 Develop the classes Develop an abstract class CAppointment. (12) - Make provision for read-only properties for the date and time of the appointment and the name of the patient. - The constructor must initialise the above-mentioned properties. - Add an abstract method, Details(), that will return a string with all details of the appointment Develop a class COperation that is a CAppointment. (13) - Add a read-only property for the procedure to be done. A typical procedure would be Remove appendix or Remove tonsils. - The constructor must assign the above-mentioned property. - Override the Details method of the base class with a method that returns a string with all details of the appointment: Date/Time, Patient and Procedure. Normally, there would have been other sub-classes as well, but for the purposes of the examination you don t have to develop them.

3 4.2 Implement the class structure in a Windows Forms application as in the screen print below The form has a list box, property grid and five buttons. (4) Write the code for the Close button. (1) Disable the New consultation button since you are not going to implement it for this examination. (1) Declare a generic list of CAppointment, lstappointments, as a private data member of the form. Instantiate this list in the form s constructor. Remember to add the necessary namespaces to the application. (4) Develop a new form that will be used as a dialog box to enter a new operation to the diary. See the example below. - Add a DateTimePicker and two text boxes for the data and time of the operation, the patient name and the procedure to be executed to the form. Make sure that you give appropriate names to all controls. (3) - Add two buttons to the form to close it with the appropriate DialogResult property. (2) Add read-only properties for the date and time of the operation, the patient name and procedure to the class of the form in (6) Write a public ShowDialog() method for the form in This method should have no parameters and must return a DialogResult value based on the button that was clicked. Call the base.showdialog() method and then assign the values of the respective controls to the appropriate properties (question 4.2.6) prior to return. (8)

4 Write the code for the New Operation button in the main form. When the user clicks the button, the dialog box of question should appear to allow the user to enter the date and time of the operation as well as the name of the patient and the procedure to be executed. Add the new appointment to lstappointments. Add the date and time of the operation to the list box. (9) Write code for the SelectedIndexChanged() event handler of the list box to display all properties of the selected object in the property grid. Note that the property grid will display all properties but only allow edits for properties that are public. (3) Hint: Use the SelectedObject property of the property grid Write a method, SaveAppointments(), to serialize the entire list of appointments to a file Appointments.bin. Call this method from the FormClosing() event handler. (11) Write a method, LoadAppointments(), to deserialize the contents of the file Appointments.bin and put the contents in lstappointments. You should also add the date and time of each appointment in the list to the list box. Call this method from the FormLoad() event handler. (13) Write the code to delete an appointment. Note that the appointment must be removed from the generic list of appointments as well as the list box. Make provision for all possible errors. (6) Write code for the double click event handler of the list box. A message box should be displayed with details about the selected appointment. (4) Write the code for the List button. When the user clicks the button, all appointments (operations and others) with complete details must be displayed in order of date and time. (14) [114]

5 5 MEMORANDUM Question 1 class Program static void Main(string[] args) Console.Write("Original sentence: "); string s = Console.ReadLine(); //string s = "John Michel is sick, and his teacher, Margaret Green, sends his sister, Nancy Michel, to find some medicine from doctor Hubert Ashton."; int n = 0; do Console.Write("String to be replaced: "); string stobereplaced = Console.ReadLine(); Console.Write("String to replace with: "); string sreplacewith = Console.ReadLine(); s = s.replace(stobereplaced, sreplacewith); Console.Write("Another one (Y/N)?... "); string[] Parts = s.split(new string[] sreplacewith, StringSplitOptions.None); n += Parts.Length - 1; while (Console.ReadLine().ToUpper() == "Y"); Console.WriteLine(s); Console.Write("Replacements: " + n.tostring()); Console.Write("\n\nPress any key to exit..."); Console.ReadKey(); //Main

6 6 Question 2 class Program static void Main(string[] args) string[] Days = new string[0]; int[] mintemperatures = new int[0]; int n = 0; using (StreamReader f = new StreamReader("Temperatures.txt")) while (!f.endofstream) n++; string[] Data = f.readline().split('\t'); Array.Resize(ref Days, n); Array.Resize(ref mintemperatures, n); Days[n - 1] = Data[0]; try mintemperatures[n - 1] = int.parse(data[1]); catch int mintemperature = mintemperatures.min(); string minday = Days[minTemperatures.ToList().IndexOf(minTemperature)]; Console.WriteLine("Minimum temperature : " + mintemperature + (char)176 + "C on " + minday); Console.Write("\n\nPress any key to exit..."); Console.ReadKey();

7 7 Question 3 class Program static void Main(string[] args) //Connection string sconnectionstring = "Provider=Microsoft.ACE.OLEDB.12.0;" + "Data Source=Plants.accdb"; OleDbConnection cnplants = new OleDbConnection(sConnectionString); cnplants.open(); bool isanotherone = true; do //User input Console.Clear(); Console.Write("Common name: "); string scommon = Console.ReadLine(); //SQL SELECT string sql = "SELECT CommonName, ScientificName " + "FROM Plants " + "WHERE CommonName LIKE '%" + scommon + "%' " + "ORDER BY CommonName, ScientificName"; //List matches OleDbCommand cmd = new OleDbCommand(sql, cnplants); OleDbDataReader reader = cmd.executereader(); while (reader.read()) Console.WriteLine(reader[0].ToString() + "\t" + reader[1].tostring()); reader.close(); //Another one? Console.Write("\nAnother one ('Y/N')? "); isanotherone = char.toupper(console.readkey().keychar) == 'Y'; while (isanotherone); //Main //class Program

8 8 Question public abstract class CAppointment public DateTime DateTime get; private set; public string Patient get; private set; public CAppointment(DateTime _DateTime, string _Patient) DateTime = _DateTime; Patient = _Patient; //Constructor public abstract string Details(); //class CAppointment public class COperation : Cappointment public string Procedure get; private set; public COperation(DateTime _DateTime, string _Patient, string _Procedure) : base(_datetime, _Patient) Procedure = _Procedure; public override string Details() return "Date/Time: " + this.datetime.tostring("dd MMMM yyyy HH:mm") + "\n" + "Patient: " + this.patient + "\n" + "Procedure: " + this.procedure; //class COperation Form name Control names private void btnclose_click(object sender, EventArgs e) this.close(); btnnewconsultation.enabled = false; using System.Collections.Generic; public partial class CfrmAppointments : Form private List<CAppointment> lstappointments; public CfrmAppointments() InitializeComponent(); lstappointments = new List<CAppointment>(); DateTimePicker, 2 text boxes, properly named Two buttons, properly named with DialogResult properties

9 public DateTime dtoperation get; private set; public string PatientName get; private set; public string Procedure get; private set; public override DialogResult ShowDialog() base.showdialog(); dtoperation = datetimepicker.value; PatientName = txtpatient.text; Procedure = txtprocedure.text; return this.dialogresult; private void btnnewoperation_click(object sender, EventArgs e) CfrmNewOperation frmoperation = new CfrmNewOperation(); if (frmoperation.showdialog() == System.Windows.Forms.DialogResult.OK) COperation Operation = new COperation(frmOperation.dtOperation, frmoperation.patientname, frmoperation.procedure); lstappointments.add(operation); lstbxappointments.items.add(operation.datetime.tostring("dd/mm/yyyy HH:mm")); //btnnewoperation_click private void lstbxappointments_selectedindexchanged(object sender, EventArgs e) int i = lstbxappointments.selectedindex; if (i >= 0) propertygrid.selectedobject = lstappointments[i]; [Serializable] in COperation and Cappointment using System.Runtime.Serialization; using System.Runtime.Serialization.Formatters.Binary; private void CfrmAppointments_FormClosing(object sender, FormClosingEventArgs e) SaveAppointments(); private void SaveAppointments() using (FileStream strm = new FileStream("Appointments.bin", FileMode.Create)) IFormatter formatter = new BinaryFormatter(); formatter.serialize(strm, lstappointments); //SaveAll

10 private void CfrmAppointments_Load(object sender, EventArgs e) LoadAppointments(); private void LoadAppointments() using (FileStream strm = new FileStream("Appointments.bin", FileMode.Open)) IFormatter formatter = new BinaryFormatter(); lstappointments = (List<CAppointment>)formatter.Deserialize(strm); foreach (CAppointment appointment in lstappointments) lstbxappointments.items.add(appointment.datetime.tostring("dd/mm/yyyy HH:mm")); //LoadAppointments private void btndeleteappointment_click(object sender, EventArgs e) int i = lstbxappointments.selectedindex; if (i >= 0) lstbxappointments.items.removeat(i); lstappointments.removeat(i); if (lstbxappointments.items.count > 0) lstbxappointments.selectedindex = 0; private void lstbxappointments_doubleclick(object sender, EventArgs e) int i = lstbxappointments.selectedindex; if (i >= 0) MessageBox.Show(lstAppointments[i].Details(), "Appointment details"); private void btnlistappointments_click(object sender, EventArgs e) string s = "Time\t" + "Patient".PadRight(20) + "\n" + "====\t" + "".PadRight(20, '=') + "\n"; lstappointments = lstappointments.orderby(app => app.datetime).tolist(); foreach (CAppointment appointment in lstappointments) s += appointment.datetime.tostring("hh:mm") + "\t" + appointment.patient.padright(20); if (appointment is COperation) s += ((COperation)appointment).Procedure + "\n"; MessageBox.Show(s);

UNIVERSITY OF THE FREE STATE DEPARTMENT OF COMPUTER SCIENCE AND INFORMATICS RIS 214 MODULE TEST 1

UNIVERSITY OF THE FREE STATE DEPARTMENT OF COMPUTER SCIENCE AND INFORMATICS RIS 214 MODULE TEST 1 UNIVERSITY OF THE FREE STATE DEPARTMENT OF COMPUTER SCIENCE AND INFORMATICS RIS 214 MODULE TEST 1 DATE: 12 March 2014 TIME: 4 hours MARKS: 220 ASSESSORS: Prof. P.J. Blignaut & Mr G.J. Dollman BONUS MARKS:

More information

Answer the following questions on the answer sheet that is provided. The computer must be switched off while you are busy with Section A.

Answer the following questions on the answer sheet that is provided. The computer must be switched off while you are busy with Section A. UNIVERSITY OF THE FREE STATE DEPARTMENT OF COMPUTER SCIENCE AND INFORMATICS RIS 114 DATE: 25 April 2013 TIME: 180 minutes MARKS: 100 ASSESSORS: Prof. P.J. Blignaut & Mr. F. Radebe (+2 bonus marks) MODERATOR:

More information

This is an open-book test. You may use the text book Be Sharp with C# but no other sources, written or electronic, will be allowed.

This is an open-book test. You may use the text book Be Sharp with C# but no other sources, written or electronic, will be allowed. UNIVERSITY OF THE FREE STATE DEPARTMENT OF COMPUTER SCIENCE AND INFORMATICS RIS 124 DATE: 1 September 2014 TIME: 3 hours MARKS: 105 ASSESSORS: Prof. P.J. Blignaut BONUS MARKS: 3 MODERATOR: Dr. L. De Wet

More information

This is an open-book test. You may use the text book Be Sharp with C# but no other sources, written or electronic, will be allowed.

This is an open-book test. You may use the text book Be Sharp with C# but no other sources, written or electronic, will be allowed. UNIVERSITY OF THE FREE STATE DEPARTMENT OF COMPUTER SCIENCE AND INFORMATICS RIS 124 DATE: 5 September 2011 TIME: 3½ hours MARKS: 150 ASSESSORS: Prof. P.J. Blignaut & Mr. M.B. Mase MODERATOR: Dr. A. van

More information

UNIVERSITY OF THE FREE STATE DEPARTMENT OF COMPUTER SCIENCE AND INFORMATICS RIS 114 CLASS TEST 2 and 3 DATE: 4 August 2014 TIME: 180 minutes MARKS: 70

UNIVERSITY OF THE FREE STATE DEPARTMENT OF COMPUTER SCIENCE AND INFORMATICS RIS 114 CLASS TEST 2 and 3 DATE: 4 August 2014 TIME: 180 minutes MARKS: 70 UNIVERSITY OF THE FREE STATE DEPARTMENT OF COMPUTER SCIENCE AND INFORMATICS RIS 114 CLASS TEST 2 and 3 DATE: 4 August 2014 TIME: 180 minutes MARKS: 70 ASSESSOR: Prof. P.J. Blignaut (+1 bonus mark) This

More information

UNIVERSITY OF THE FREE STATE DEPARTMENT OF COMPUTER SCIENCE AND INFORMATICS CSIS1614

UNIVERSITY OF THE FREE STATE DEPARTMENT OF COMPUTER SCIENCE AND INFORMATICS CSIS1614 UNIVERSITY OF THE FREE STATE DEPARTMENT OF COMPUTER SCIENCE AND INFORMATICS CSIS1614 DATE: 7 May 2015 MARKS: 130 ASSESSOR: Prof. P.J. Blignaut (Bonus marks: 5) MODERATOR: Dr. L. de Wet TIME: 180 minutes

More information

UNIVERSITY OF THE FREE STATE DEPARTMENT OF COMPUTER SCIENCE AND INFORMATICS CSIS2614 MODULE TEST 1

UNIVERSITY OF THE FREE STATE DEPARTMENT OF COMPUTER SCIENCE AND INFORMATICS CSIS2614 MODULE TEST 1 UNIVERSITY OF THE FREE STATE DEPARTMENT OF COMPUTER SCIENCE AND INFORMATICS CSIS2614 MODULE TEST 1 DATE: 18 March 2016 MARKS: 165 ASSESSOR: Prof. P.J. Blignaut (Bonus 8) MODERATOR: Dr T. Beelders TIME:

More information

// Program 2 - Extra Credit // CIS // Spring // Due: 3/11/2015. // By: Andrew L. Wright. //Edited by : Ben Spalding

// Program 2 - Extra Credit // CIS // Spring // Due: 3/11/2015. // By: Andrew L. Wright. //Edited by : Ben Spalding // Program 2 - Extra Credit // CIS 200-01 // Spring 2015 // Due: 3/11/2015 // By: Andrew L. Wright //Edited by : Ben Spalding // File: Prog2Form.cs // This class creates the main GUI for Program 2. It

More information

CSIS 1624 CLASS TEST 6

CSIS 1624 CLASS TEST 6 CSIS 1624 CLASS TEST 6 Instructions: Use visual studio 2012/2013 Make sure your work is saved correctly Submit your work as instructed by the demmies. This is an open-book test. You may consult the printed

More information

RIS214. Class Test 3

RIS214. Class Test 3 RIS214 Class Test 3 Use console applications to solve the following problems and employ defensive programming to prevent run-time errors. Every question will be marked as follows: mark = copied? -5 : runs?

More information

UNIVERSITY OF THE FREE STATE MAIN CAMPUS CSIS2614 DEPARTMENT: COMPUTER SCIENCE AND INFORMATICS CONTACT NUMBER:

UNIVERSITY OF THE FREE STATE MAIN CAMPUS CSIS2614 DEPARTMENT: COMPUTER SCIENCE AND INFORMATICS CONTACT NUMBER: UNIVERSITY OF THE FREE STATE MAIN CAMPUS CSIS2614 DEPARTMENT: COMPUTER SCIENCE AND INFORMATICS CONTACT NUMBER: 4012754 EXAMINATION: Additional Half Year Examination 2016 ASSESSORS: Prof. P.J. Blignaut

More information

UNIVERSITY OF THE FREE STATE DEPARTMENT OF COMPUTER SCIENCE AND INFORMATICS CSIS1614. DATE: 5 March 2015 MARKS: 100 SECTION A (36)

UNIVERSITY OF THE FREE STATE DEPARTMENT OF COMPUTER SCIENCE AND INFORMATICS CSIS1614. DATE: 5 March 2015 MARKS: 100 SECTION A (36) UNIVERSITY OF THE FREE STATE DEPARTMENT OF COMPUTER SCIENCE AND INFORMATICS CSIS1614 DATE: 5 March 2015 MARKS: 100 ASSESSOR: Prof. P.J. Blignaut TIME: 180 minutes MODERATOR: Dr. L. de Wet SECTION A (36)

More information

UNIVERSITY OF THE FREE STATE DEPARTMENT OF COMPUTER SCIENCE AND INFORMATICS CSIS 2614 MODULE TEST 2

UNIVERSITY OF THE FREE STATE DEPARTMENT OF COMPUTER SCIENCE AND INFORMATICS CSIS 2614 MODULE TEST 2 UNIVERSITY OF THE FREE STATE DEPARTMENT OF COMPUTER SCIENCE AND INFORMATICS CSIS 2614 MODULE TEST 2 DATE: 13 May 2016 TIME: 3.5 hours MARKS: 112 ASSESSOR: Prof. P.J. Blignaut BONUS MARKS: 5 MODERATOR:

More information

// Precondition: None // Postcondition: The address' name has been set to the // specified value set;

// Precondition: None // Postcondition: The address' name has been set to the // specified value set; // File: Address.cs // This classes stores a typical US address consisting of name, // two address lines, city, state, and 5 digit zip code. using System; using System.Collections.Generic; using System.Linq;

More information

Windows File I/O. Files. Collections of related data stored on external storage media and assigned names so that they can be accessed later

Windows File I/O. Files. Collections of related data stored on external storage media and assigned names so that they can be accessed later Windows File I/O Files Collections of related data stored on external storage media and assigned names so that they can be accessed later Entire collection is a file A file is made up of records One record

More information

Memorandum. 1.1 public enum Days : int { Monday = 1, Tuesday = 2, Wednesday = 3, Thursday = 4, Friday = 5, Saturday = 6, Sunday = 7 }

Memorandum. 1.1 public enum Days : int { Monday = 1, Tuesday = 2, Wednesday = 3, Thursday = 4, Friday = 5, Saturday = 6, Sunday = 7 } Memorandum Question 1 1.1 public enum Days : int Monday = 1, Tuesday = 2, Wednesday = 3, Thursday = 4, Friday = 5, Saturday = 6, Sunday = 7 1.2 class Temps private double[] Values = new double[7]; 1.3

More information

Class Test 5. Create a simple paint program that conforms to the following requirements.

Class Test 5. Create a simple paint program that conforms to the following requirements. Class Test 5 Question 1 Use visual studio 2012 ultimate to create a C# windows forms application. Create a simple paint program that conforms to the following requirements. The control box is disabled

More information

EL-USB-RT API Guide V1.0

EL-USB-RT API Guide V1.0 EL-USB-RT API Guide V1.0 Contents 1 Introduction 2 C++ Sample Dialog Application 3 C++ Sample Observer Pattern Application 4 C# Sample Application 4.1 Capturing USB Device Connect \ Disconnect Events 5

More information

Class Test 4. Question 1. Use notepad to create a console application that displays a stick figure. See figure 1. Question 2

Class Test 4. Question 1. Use notepad to create a console application that displays a stick figure. See figure 1. Question 2 Class Test 4 Marks will be deducted for each of the following: -5 for each class/program that does not contain your name and student number at the top. -2 If program is named anything other than Question1,

More information

UNIVERSITY OF THE FREE STATE DEPARTMENT OF COMPUTER SCIENCE AND INFORMATICS CSIS 2614 MODULE TEST 2

UNIVERSITY OF THE FREE STATE DEPARTMENT OF COMPUTER SCIENCE AND INFORMATICS CSIS 2614 MODULE TEST 2 UNIVERSITY OF THE FREE STATE DEPARTMENT OF COMPUTER SCIENCE AND INFORMATICS CSIS 2614 MODULE TEST 2 DATE: 12 May 2017 TIME: 3 hours MARKS: 110 ASSESSORS: Prof. P. Blignaut & Mr. G. Dollman BONUS MARKS:

More information

You can call the project anything you like I will be calling this one project slide show.

You can call the project anything you like I will be calling this one project slide show. C# Tutorial Load all images from a folder Slide Show In this tutorial we will see how to create a C# slide show where you load everything from a single folder and view them through a timer. This exercise

More information

Class Test 4. Question 1. Use notepad to create a console application that displays a face. See figure 1. Figure 1. Question2

Class Test 4. Question 1. Use notepad to create a console application that displays a face. See figure 1. Figure 1. Question2 Class Test 4 Marks will be deducted for the following: -2 If the program is named anything other than Question1,2 etc. -5 if the program does not contain your name & student number at the top. Question

More information

The first program we write will display a picture on a Windows screen, with buttons to make the picture appear and disappear.

The first program we write will display a picture on a Windows screen, with buttons to make the picture appear and disappear. 4 Programming with C#.NET 1 Camera The first program we write will display a picture on a Windows screen, with buttons to make the picture appear and disappear. Begin by loading Microsoft Visual Studio

More information

IST311 Chapter13.NET Files (Part2)

IST311 Chapter13.NET Files (Part2) IST311 Chapter13.NET Files (Part2) using System; using System.Collections.Generic; using System.ComponentModel; using System.IO; using System.Linq; using System.Net; using System.Net.Sockets; using System.Text;

More information

C# Programming for Developers Course Labs Contents

C# Programming for Developers Course Labs Contents C# Programming for Developers Course Labs Contents C# Programming for Developers...1 Course Labs Contents...1 Introduction to C#...3 Aims...3 Your First C# Program...3 C# The Basics...5 The Aims...5 Declaring

More information

Class Test 10. Question 1. Create a console application using visual studio 2012 ultimate.

Class Test 10. Question 1. Create a console application using visual studio 2012 ultimate. Class Test 10 Question 1 Create a console application using visual studio 2012 ultimate. Figure 1 Use recursion to create a menu, DO NOT use a while, do while or for loop. When any value is entered that

More information

Mainly three tables namely Teacher, Student and Class for small database of a school. are used. The snapshots of all three tables are shown below.

Mainly three tables namely Teacher, Student and Class for small database of a school. are used. The snapshots of all three tables are shown below. APPENDIX 1 TABLE DETAILS Mainly three tables namely Teacher, Student and Class for small database of a school are used. The snapshots of all three tables are shown below. Details of Class table are shown

More information

UNIT-3. Prepared by R.VINODINI 1

UNIT-3. Prepared by R.VINODINI 1 Prepared by R.VINODINI 1 Prepared by R.VINODINI 2 Prepared by R.VINODINI 3 Prepared by R.VINODINI 4 Prepared by R.VINODINI 5 o o o o Prepared by R.VINODINI 6 Prepared by R.VINODINI 7 Prepared by R.VINODINI

More information

Duhok Polytechnic University Amedi Technical Institute/ IT Dept. Halkawt Rajab Hussain

Duhok Polytechnic University Amedi Technical Institute/ IT Dept. Halkawt Rajab Hussain Duhok Polytechnic University Amedi Technical Institute/ IT Dept. By Halkawt Rajab Hussain 2016-04-02 String and files: String declaration and initialization. Strings and Char Arrays: Properties And Methods.

More information

Classes and Objects 3/28/2017. How can multiple methods within a Java class read and write the same variable?

Classes and Objects 3/28/2017. How can multiple methods within a Java class read and write the same variable? Peer Instruction 8 Classes and Objects How can multiple methods within a Java class read and write the same variable? A. Allow one method to reference a local variable of the other B. Declare a variable

More information

XNA 4.0 RPG Tutorials. Part 24. Level Editor Continued

XNA 4.0 RPG Tutorials. Part 24. Level Editor Continued XNA 4.0 RPG Tutorials Part 24 Level Editor Continued I'm writing these tutorials for the new XNA 4.0 framework. The tutorials will make more sense if they are read in order. You can find the list of tutorials

More information

Introduction to C# Applications

Introduction to C# Applications 1 2 3 Introduction to C# Applications OBJECTIVES To write simple C# applications To write statements that input and output data to the screen. To declare and use data of various types. To write decision-making

More information

Duhok Polytechnic University Amedi Technical Institute/ IT Dept. Halkawt Rajab Hussain

Duhok Polytechnic University Amedi Technical Institute/ IT Dept. Halkawt Rajab Hussain Duhok Polytechnic University Amedi Technical Institute/ IT Dept. By Halkawt Rajab Hussain 2016-04-02 Objects and classes: Basics of object and class in C#. Private and public members and protected. Static

More information

05/31/2009. Data Files

05/31/2009. Data Files Data Files Store and retrieve data in files using streams Save the values from a list box and reload for the next program run Check for the end of file Test whether a file exists Display the standard Open

More information

Chapter 11. Data Files The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill

Chapter 11. Data Files The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill Chapter 11 Data Files McGraw-Hill 2010 The McGraw-Hill Companies, Inc. All rights reserved. Chapter Objectives Store and retrieve data in files using streams Save the values from a list box and reload

More information

To start we will be using visual studio Start a new C# windows form application project and name it motivational quotes viewer

To start we will be using visual studio Start a new C# windows form application project and name it motivational quotes viewer C# Tutorial Create a Motivational Quotes Viewer Application in Visual Studio In this tutorial we will create a fun little application for Microsoft Windows using Visual Studio. You can use any version

More information

Quick Guide for the ServoWorks.NET API 2010/7/13

Quick Guide for the ServoWorks.NET API 2010/7/13 Quick Guide for the ServoWorks.NET API 2010/7/13 This document will guide you through creating a simple sample application that jogs axis 1 in a single direction using Soft Servo Systems ServoWorks.NET

More information

Duhok Polytechnic University Amedi Technical Institute/ IT Dept. Halkawt Rajab Hussain

Duhok Polytechnic University Amedi Technical Institute/ IT Dept. Halkawt Rajab Hussain Duhok Polytechnic University Amedi Technical Institute/ IT Dept. By Halkawt Rajab Hussain 2016-04-02 : Structure declaration and initialization. Access to fields of structure. Array of Structs. 11/10/2016

More information

Object Oriented Programming in C#

Object Oriented Programming in C# Introduction to Object Oriented Programming in C# Class and Object 1 You will be able to: Objectives 1. Write a simple class definition in C#. 2. Control access to the methods and data in a class. 3. Create

More information

CALCULATOR APPLICATION

CALCULATOR APPLICATION CALCULATOR APPLICATION Form1.cs using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms;

More information

Lesson11-Inheritance-Abstract-Classes. The GeometricObject case

Lesson11-Inheritance-Abstract-Classes. The GeometricObject case Lesson11-Inheritance-Abstract-Classes The GeometricObject case GeometricObject class public abstract class GeometricObject private string color = "White"; private DateTime datecreated = new DateTime(2017,

More information

Industrial Programming

Industrial Programming Industrial Programming Lecture 6: C# Data Manipulation Industrial Programming 1 The Stream Programming Model File streams can be used to access stored data. A stream is an object that represents a generic

More information

Engr 123 Spring 2018 Notes on Visual Studio

Engr 123 Spring 2018 Notes on Visual Studio Engr 123 Spring 2018 Notes on Visual Studio We will be using Microsoft Visual Studio 2017 for all of the programming assignments in this class. Visual Studio is available on the campus network. For your

More information

Eyes of the Dragon - XNA Part 37 Map Editor Revisited

Eyes of the Dragon - XNA Part 37 Map Editor Revisited Eyes of the Dragon - XNA Part 37 Map Editor Revisited I'm writing these tutorials for the XNA 4.0 framework. Even though Microsoft has ended support for XNA it still runs on all supported operating systems

More information

IST311. Advanced Issues in OOP: Inheritance and Polymorphism

IST311. Advanced Issues in OOP: Inheritance and Polymorphism IST311 Advanced Issues in OOP: Inheritance and Polymorphism IST311/602 Cleveland State University Prof. Victor Matos Adapted from: Introduction to Java Programming: Comprehensive Version, Eighth Edition

More information

Learn C# Errata. 3-9 The Nullable Types The Assignment Operators

Learn C# Errata. 3-9 The Nullable Types The Assignment Operators 1 The following pages show errors from the original edition, published in July 2008, corrected in red. Future editions of this book will be printed with these corrections. We apologize for any inconvenience

More information

Step 1: Start a GUI Project. Start->New Project->Visual C# ->Windows Forms Application. Name: Wack-A-Gopher. Step 2: Add Content

Step 1: Start a GUI Project. Start->New Project->Visual C# ->Windows Forms Application. Name: Wack-A-Gopher. Step 2: Add Content Step 1: Start a GUI Project Start->New Project->Visual C# ->Windows Forms Application Name: Wack-A-Gopher Step 2: Add Content Download the Content folder (content.zip) from Canvas and unzip in a location

More information

In-Class Worksheet #4

In-Class Worksheet #4 CSE 459.24 Programming in C# Richard Kidwell In-Class Worksheet #4 Creating a Windows Forms application with Data Binding You should have Visual Studio 2008 open. 1. Create a new Project either from the

More information

Huw Talliss Data Structures and Variables. Variables

Huw Talliss Data Structures and Variables. Variables Data Structures and Variables Variables The Regex class represents a read-only regular expression. It also contains static methods that allow use of other regular expression classes without explicitly

More information

Programming with Microsoft Visual Basic.NET. Array. What have we learnt in last lesson? What is Array?

Programming with Microsoft Visual Basic.NET. Array. What have we learnt in last lesson? What is Array? What have we learnt in last lesson? Programming with Microsoft Visual Basic.NET Using Toolbar in Windows Form. Using Tab Control to separate information into different tab page Storage hierarchy information

More information

XNA 4.0 RPG Tutorials. Part 25. Level Editor Continued

XNA 4.0 RPG Tutorials. Part 25. Level Editor Continued XNA 4.0 RPG Tutorials Part 25 Level Editor Continued I'm writing these tutorials for the new XNA 4.0 framework. The tutorials will make more sense if they are read in order. You can find the list of tutorials

More information

Appendix A Programkod

Appendix A Programkod Appendix A Programkod ProgramForm.cs using System; using System.Text; using System.Windows.Forms; using System.Net; using System.IO; using System.Text.RegularExpressions; using System.Collections.Generic;

More information

Motivation. Reflection in C# Case study: Implicit Serialisation. Using implicit serialisation. Hans-Wolfgang Loidl

Motivation. Reflection in C# Case study: Implicit Serialisation. Using implicit serialisation. Hans-Wolfgang Loidl Reflection in C# Motivation Hans-Wolfgang Loidl School of Mathematical and Computer Sciences, Heriot-Watt University, Edinburgh Sometimes you want to get access to concepts in C# that

More information

Memorandum public override string string Node while null return public void bool false Node while null null true while public void Node new

Memorandum public override string string Node while null return public void bool false Node while null null true while public void Node new Memorandum 1.1.1 public override string ToString() string s = ""; while (current!= null) s += current.element.tostring() + ", "; current = current.next; return s; //ToString() 1.1.2 public void Sort()

More information

Lab - 1. Solution : 1. // Building a Simple Console Application. class HelloCsharp. static void Main() System.Console.WriteLine ("Hello from C#.

Lab - 1. Solution : 1. // Building a Simple Console Application. class HelloCsharp. static void Main() System.Console.WriteLine (Hello from C#. Lab - 1 Solution : 1 // Building a Simple Console Application class HelloCsharp static void Main() System.Console.WriteLine ("Hello from C#."); Solution: 2 & 3 // Building a WPF Application // Verifying

More information

Silverlight memory board ( Part 2 )

Silverlight memory board ( Part 2 ) Silverlight memory board ( Part 2 ) In the first part this tutorial we created a new Silverlight project and designed the user interface. In this part, we will add some code to the project to make the

More information

Chapter 8 Advanced GUI Features

Chapter 8 Advanced GUI Features 159 Chapter 8 Advanced GUI Features There are many other features we can easily add to a Windows C# application. We must be able to have menus and dialogs along with many other controls. One workhorse

More information

The Open Core Interface SDK has to be installed on your development computer. The SDK can be downloaded at:

The Open Core Interface SDK has to be installed on your development computer. The SDK can be downloaded at: This document describes how to create a simple Windows Forms Application using some Open Core Interface functions in C# with Microsoft Visual Studio Express 2013. 1 Preconditions The Open Core Interface

More information

A Pattern for Storing Structured Data in AutoCAD Entities

A Pattern for Storing Structured Data in AutoCAD Entities A Pattern for Storing Structured Data in AutoCAD Entities Jeffery Geer RCM Technologies CP401-2 Xrecords provide storage of information in AutoCAD entities, but defining that structure can be a cumbersome

More information

Object oriented lab /second year / review/lecturer: yasmin maki

Object oriented lab /second year / review/lecturer: yasmin maki 1) Examples of method (function): Note: the declaration of any method is : method name ( parameters list ).. Method body.. Access modifier : public,protected, private. Return

More information

POLYTECHNIC OF NAMIBIA SCHOOL OF COMPUTING AND INFORMATICS DEPARTMENT OF COMPUTER SCIENCE

POLYTECHNIC OF NAMIBIA SCHOOL OF COMPUTING AND INFORMATICS DEPARTMENT OF COMPUTER SCIENCE /. POLYTECHNIC OF NAMIBIA SCHOOL OF COMPUTING AND INFORMATICS DEPARTMENT OF COMPUTER SCIENCE COUR ENAME: PROGRAMMING 1 COUR ECODE: PRGSlOS NQFLEVEL: 5 DATE: JUNE 20 15 DURATION: 2HOURS MARKS: 100 PAPER:

More information

Start Visual Studio and create a new windows form application under C# programming language. Call this project YouTube Alarm Clock.

Start Visual Studio and create a new windows form application under C# programming language. Call this project YouTube Alarm Clock. C# Tutorial - Create a YouTube Alarm Clock in Visual Studio In this tutorial we will create a simple yet elegant YouTube alarm clock in Visual Studio using C# programming language. The main idea for this

More information

TuneTown Lab Instructions

TuneTown Lab Instructions TuneTown Lab Instructions Purpose: Practice creating a modal dialog. Incidentally, learn to use a list view control. Credit: This program was designed by Jeff Prosise and published in MSDN Magazine. However,

More information

C# Java. C# Types Naming Conventions. Distribution and Integration Technologies. C# C++.NET A C# program is a collection of: C C++ C# Language

C# Java. C# Types Naming Conventions. Distribution and Integration Technologies. C# C++.NET A C# program is a collection of: C C++ C# Language C# Java Distribution and Integration Technologies C# Language C C++ C# C++.NET A C# program is a collection of: Classes Structs Interfaces Delegates Enums (can be grouped in namespaces) One entry point

More information

Distribution and Integration Technologies. C# Language

Distribution and Integration Technologies. C# Language Distribution and Integration Technologies C# Language Classes Structs Interfaces Delegates Enums C# Java C C++ C# C++.NET A C# program is a collection of: (can be grouped in namespaces) One entry point

More information

General Certificate of Education Advanced Subsidiary Examination June 2010

General Certificate of Education Advanced Subsidiary Examination June 2010 General Certificate of Education Advanced Subsidiary Examination June 2010 Computing COMP1/PM/C# Unit 1 Problem Solving, Programming, Data Representation and Practical Exercise Preliminary Material A copy

More information

Hands-On Lab (MBL04) Lab Manual Incorporating COM Objects into Your.NET Compact Framework 2.0 Application

Hands-On Lab (MBL04) Lab Manual Incorporating COM Objects into Your.NET Compact Framework 2.0 Application Hands-On Lab (MBL04) Lab Manual Incorporating COM Objects into Your.NET Compact Framework 2.0 Application Please do not remove this manual from the lab Information in this document is subject to change

More information

Computer measurement and control

Computer measurement and control Computer measurement and control Instructors: András Magyarkuti, Zoltán Kovács-Krausz BME TTK, Department of Physics 2017/2018 spring semester Copyright 2008-2018 András Magyarkuti, Attila Geresdi, András

More information

Department of Networks College of Bardarash Technical Institute DUHOK Polytechnic University Subject: Programming Fundamental by JAVA Course Book

Department of Networks College of Bardarash Technical Institute DUHOK Polytechnic University Subject: Programming Fundamental by JAVA Course Book 1 Department of Networks College of Bardarash Technical Institute DUHOK Polytechnic University Subject: Programming Fundamental by JAVA Course Book Year 1 Lecturer's name: MSc. Sami Hussein Ismael Academic

More information

Teacher Training Solutions

Teacher Training Solutions Teacher Training Solutions Practical 7 Exercise 1 Task 1 class Animal private String name; private String diet; private String location; private double weight; private int age; private String colour; Page

More information

Objectives. Introduce static keyword examine syntax describe common uses

Objectives. Introduce static keyword examine syntax describe common uses Static Objectives Introduce static keyword examine syntax describe common uses 2 Static Static represents something which is part of a type rather than part of an object Two uses of static field method

More information

Inheriting Windows Forms with Visual C#.NET

Inheriting Windows Forms with Visual C#.NET Inheriting Windows Forms with Visual C#.NET Overview In order to understand the power of OOP, consider, for example, form inheritance, a new feature of.net that lets you create a base form that becomes

More information

POLYTECHNIC OF NAMIBIA SCHOOL OF COMPUTING AND INFORMATICS DEPARTMENT OF COMPUTER SCIENCE

POLYTECHNIC OF NAMIBIA SCHOOL OF COMPUTING AND INFORMATICS DEPARTMENT OF COMPUTER SCIENCE POLYTECHNIC OF NAMIBIA SCHOOL OF COMPUTING AND INFORMATICS DEPARTMENT OF COMPUTER SCIENCE COURSE NAME: OBJECT ORIENTED PROGRAMMING COURSE CODE: OOP521S NQF LEVEL: 6 DATE: NOVEMBER 2015 DURATION: 2 HOURS

More information

C# Crash Course Dimitar Minchev

C# Crash Course Dimitar Minchev C# Crash Course Dimitar Minchev BIO Dimitar Minchev PhD of Informatics, Assistant Professor in Faculty of Computer Science and Engineering, Burgas Free University, Bulgaria. Education Bachelor of Informatics,

More information

Final Exam CS 152, Computer Programming Fundamentals May 9, 2014

Final Exam CS 152, Computer Programming Fundamentals May 9, 2014 Final Exam CS 152, Computer Programming Fundamentals May 9, 2014 Name: NetID: Answer all questions in the space provided. Write clearly and legibly, you will not get credit for illegible or incomprehensible

More information

Developing for Mobile Devices Lab (Part 1 of 2)

Developing for Mobile Devices Lab (Part 1 of 2) Developing for Mobile Devices Lab (Part 1 of 2) Overview Through these two lab sessions you will learn how to create mobile applications for Windows Mobile phones and PDAs. As developing for Windows Mobile

More information

Chair of Software Engineering. Java and C# in Depth. Prof. Dr. Bertrand Meyer. Exercise Session 9. Nadia Polikarpova

Chair of Software Engineering. Java and C# in Depth. Prof. Dr. Bertrand Meyer. Exercise Session 9. Nadia Polikarpova Chair of Software Engineering Java and C# in Depth Prof. Dr. Bertrand Meyer Exercise Session 9 Nadia Polikarpova Quiz 1: scrolling a ResultSet (JDBC) How do you assess the following code snippet that iterates

More information

Visual C# 2010 Express

Visual C# 2010 Express Review of C# and XNA What is C#? C# is an object-oriented programming language developed by Microsoft. It is developed within.net environment and designed for Common Language Infrastructure. Visual C#

More information

Hands-On Lab. Introduction to SQL Azure. Lab version: Last updated: 12/15/2010

Hands-On Lab. Introduction to SQL Azure. Lab version: Last updated: 12/15/2010 Hands-On Lab Introduction to SQL Azure Lab version: 2.0.0 Last updated: 12/15/2010 Contents OVERVIEW... 3 EXERCISE 1: PREPARING YOUR SQL AZURE ACCOUNT... 5 Task 1 Retrieving your SQL Azure Server Name...

More information

Chapter 1 Getting Started

Chapter 1 Getting Started Chapter 1 Getting Started The C# class Just like all object oriented programming languages, C# supports the concept of a class. A class is a little like a data structure in that it aggregates different

More information

EEE-425 Programming Languages (2013) 1

EEE-425 Programming Languages (2013) 1 2 Learn about class concepts How to create a class from which objects can be instantiated Learn about instance variables and methods How to declare objects How to organize your classes Learn about public

More information

Chapter 6 Dialogs. Creating a Dialog Style Form

Chapter 6 Dialogs. Creating a Dialog Style Form Chapter 6 Dialogs We all know the importance of dialogs in Windows applications. Dialogs using the.net FCL are very easy to implement if you already know how to use basic controls on forms. A dialog is

More information

Objectives. Introduce the core C# language features class Main types variables basic input and output operators arrays control constructs comments

Objectives. Introduce the core C# language features class Main types variables basic input and output operators arrays control constructs comments Basics Objectives Introduce the core C# language features class Main types variables basic input and output operators arrays control constructs comments 2 Class Keyword class used to define new type specify

More information

CSC 415 ONLINE PHOTOALBUM: THE SEQUEL ASP.NET VERSION

CSC 415 ONLINE PHOTOALBUM: THE SEQUEL ASP.NET VERSION CSC 415 ONLINE PHOTOALBUM: THE SEQUEL ASP.NET VERSION GODFREY MUGANDA In this project, you will convert the Online Photo Album project to run on the ASP.NET platform, using only generic HTTP handlers.

More information

Zhifu Pei CSCI5448 Spring 2011 Prof. Kenneth M. Anderson

Zhifu Pei CSCI5448 Spring 2011 Prof. Kenneth M. Anderson Zhifu Pei CSCI5448 Spring 2011 Prof. Kenneth M. Anderson Introduction History, Characteristics of Java language Java Language Basics Data types, Variables, Operators and Expressions Anatomy of a Java Program

More information

ProcSee.NET API tutorial

ProcSee.NET API tutorial ProcSee.NET API tutorial This tutorial is intended to give the user a hands-on experience on how to develop an external application for ProcSee using the.net API. It is not a tutorial in designing a ProcSee

More information

Getting started 7. Storing values 21. Creating variables 22 Reading input 24 Employing arrays 26 Casting data types 28 Fixing constants 30 Summary 32

Getting started 7. Storing values 21. Creating variables 22 Reading input 24 Employing arrays 26 Casting data types 28 Fixing constants 30 Summary 32 Contents 1 2 3 Contents Getting started 7 Introducing C# 8 Installing Visual Studio 10 Exploring the IDE 12 Starting a Console project 14 Writing your first program 16 Following the rules 18 Summary 20

More information

Equality in.net. Gregory Adam 07/12/2008. This article describes how equality works in.net

Equality in.net. Gregory Adam 07/12/2008. This article describes how equality works in.net Equality in.net Gregory Adam 07/12/2008 This article describes how equality works in.net Introduction How is equality implemented in.net? This is a summary of how it works. Object.Equals() Object.Equals()

More information

The original of this document was developed by the Microsoft special interest group. We made some addons.

The original of this document was developed by the Microsoft special interest group. We made some addons. Naming Conventions for.net / C# Projects Martin Zahn, Akadia AG, 20.03.2003 The original of this document was developed by the Microsoft special interest group. We made some addons. This document explains

More information

Binghamton University. CS-140 Fall Problem Solving. Creating a class from scratch

Binghamton University. CS-140 Fall Problem Solving. Creating a class from scratch Problem Solving Creating a class from scratch 1 Recipe for Writing a Class 1. Write the class boilerplate stuff 2. Declare Fields 3. Write Creator(s) 4. Write accessor methods 5. Write mutator methods

More information

EEE-425 Programming Languages (2013) 1

EEE-425 Programming Languages (2013) 1 2 Learn about class concepts How to create a class from which objects can be instantiated Learn about instance variables and methods How to declare objects How to organize your classes Learn about public

More information

Getter and Setter Methods

Getter and Setter Methods Example 1 namespace ConsoleApplication14 public class Student public int ID; public string Name; public int Passmark = 50; class Program static void Main(string[] args) Student c1 = new Student(); Console.WriteLine("please..enter

More information

Tutorial 5 Completing the Inventory Application Introducing Programming

Tutorial 5 Completing the Inventory Application Introducing Programming 1 Tutorial 5 Completing the Inventory Application Introducing Programming Outline 5.1 Test-Driving the Inventory Application 5.2 Introduction to C# Code 5.3 Inserting an Event Handler 5.4 Performing a

More information

Creating a Role Playing Game with XNA Game Studio Part 50 Items - Part 4b

Creating a Role Playing Game with XNA Game Studio Part 50 Items - Part 4b Creating a Role Playing Game with XNA Game Studio Part 50 Items - Part 4b To follow along with this tutorial you will have to have read the previous tutorials to understand much of what it going on. You

More information

Understanding Events in C#

Understanding Events in C# Understanding Events in C# Introduction Events are one of the core and important concepts of C#.Net Programming environment and frankly speaking sometimes it s hard to understand them without proper explanation

More information

Visual Basic/C# Programming (330)

Visual Basic/C# Programming (330) Page 1 of 12 Visual Basic/C# Programming (330) REGIONAL 2017 Production Portion: Program 1: Calendar Analysis (400 points) TOTAL POINTS (400 points) Judge/Graders: Please double check and verify all scores

More information

MATFOR In Visual C# ANCAD INCORPORATED. TEL: +886(2) FAX: +886(2)

MATFOR In Visual C# ANCAD INCORPORATED. TEL: +886(2) FAX: +886(2) Quick Start t t MATFOR In Visual C# ANCAD INCORPORATED TEL: +886(2) 8923-5411 FAX: +886(2) 2928-9364 support@ancad.com www.ancad.com 2 MATFOR QUICK START Information in this instruction manual is subject

More information

JOURNAL OF OBJECT TECHNOLOGY

JOURNAL OF OBJECT TECHNOLOGY JOURNAL OF OBJECT TECHNOLOGY Online at http://www.jot.fm. Published by ETH Zurich, Chair of Software Engineering JOT, 2009 Vol. 8, No. 1, January-February 2009 EDUCATOR S CORNER A Model-View Implementation

More information

Brian Kiser November Vigilant C# 2.5. Commonwealth of Kentucky Frankfort, Kentucky

Brian Kiser November Vigilant C# 2.5. Commonwealth of Kentucky Frankfort, Kentucky Brian Kiser November 2010 Vigilant C# 2.5 Commonwealth of Kentucky Frankfort, Kentucky Table of Contents 1.0 Work Sample Description Page 3 2.0 Skills Demonstrated 2.1 Software development competency using

More information

Repeating Instructions. C# Programming: From Problem Analysis to Program Design 2nd Edition. David McDonald, Ph.D. Director of Emerging Technologies

Repeating Instructions. C# Programming: From Problem Analysis to Program Design 2nd Edition. David McDonald, Ph.D. Director of Emerging Technologies 6 Repeating Instructions C# Programming: From Problem Analysis to Program Design 2nd Edition David McDonald, Ph.D. Director of Emerging Technologies Chapter Objectives Learn why programs use loops Write

More information