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

Size: px
Start display at page:

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

Transcription

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: 4 hours This is a limited open-book test. You may use ONLY the text book by Nakov. No other sources are allowed. Internet access will not be available for the duration of the assessment. You may use the tools available in Visual Studio such as IntelliSense. No mobile computing devices may be active for the duration of the assessment (Mobile phones, tablets, etc). Question 1 (Recursion) (12) If you stand in front of two opposite mirrors of the same size, your image in the first mirror is reflected in the second mirror which is in turn reflected in the first mirror, etc. Given your height and the ratio of reflection (hard code if you want to), use recursion to calculate the size of your image after 10 reflections. [12] 1

2 Question 2 (Operator overloading, Indexers) (111) In a marathon race, a team consists of four athletes. The team prize is awarded by using the combined time of the best three runners in a team. The main method of a program will be given to you. You may not change the code in any way. The output of the program should look as in the example: 2.1 You may not use the DateTime class. Develop your own class Time. (1) Include: - Constructors to accept time as a string in the format HH:mm:ss or as three int parameters for hours, minutes and seconds. (8) - Private data members for hours, minutes and seconds. (2) - An overloaded ToString() method to display a time in the format HH:mm:ss. (4) - The class must inherit from IComparable and implement the following method: (1) public int CompareTo(object t) return this < (Time)t? -1 : this > (Time)t? 1 : 0; //CompareTo - Overloaded operators for +, > and <. Make provision for null instances. ( ) - A static method Sort to sort an array of times in increasing order. Use a recursive selection sort technique as in the following high-level algorithm: (10) Sort(times, from, to) if (from!= to) indexofmax = Get index of largest time in the array times Swap times[to] with times[indexofmax] Sort(times, from, to-1); 2.2 Develop a class CAthlete. (1) - Include properties for the race number, athlete name and race time.(3)use the constructor to assign values for the race number and athlete name. Assign a default race time of 59 hours, 59 minutes and 59 seconds. This is the time that will be used if an athlete does not complete the race. (6) 2.3 Develop a class for CTeam (1) - Include properties for the team name and an array of four athletes. Use the constructor to assign values as necessary. (8) - Include an indexer that will return an individual athlete by his race number. (9) - Include a read-only property to return the combined time of the first three athletes in the team. Use the class Time that you developed earlier. (13) 2.4 Develop a class CTeams with a private list of teams. (5) - Add methods to add a team and return the number of teams. (8) - Add an indexer to return a team by index. (5) - Add a method to sort the teams according to their combined times. You may use Linq. (5) [111] Question 3 (Delegates and events) (50) 2

3 Develop a Windows forms application to simulate a car s instrument panel. Use a separate class for the car with private properties for fuel level, distance travelled, etc. No numeric properties may be public. You may of course have public delegate types and events. (5) - The class must have a private recursive method, HandlePedal, which will change the speed depending on the current pedal status. It should also trigger events when the speed, distance or fuel level changes. These events must be handled in the form class. Make provision for the following minimum set of functionalities: Accelerate if the mouse is down on the + or ++ buttons (foot is pressing down lightly or heavily). (5) Keep the speed on the same level if the button is down on Steady (foot is keeping the pedal in the same place). (5) Decelerate light, firm or sharp if the mouse is on the -, -- or --- buttons (braking light, firm or sharp). (5) Decelerate slowly until the car stops if the mouse is not down on any button (foot is up). (5) Show the speed in the speedometer. (5) Keep track of the fuel. Remember that the consumption is higher (less km per litre) when the car moves faster. (5) Decelerate slowly until the car stops when the fuel is depleted. (5) Keep record of the current fuel and odometer reading if you park the car (go out of the program). Next time, start where you left off. (5+5) NB NB NB: You may never use any timer in the application!!! Marks will only be allocated for correct execution. You will get either 5 or 0 for any one of the above-mentioned functionalities. You will get zero for the entire question if there is a timer anywhere in the program. [50] 3

4 MEMORANDUM Question 1 class Program static int ndepth = 4; const double height = 1.8, ratio = 0.8; static void Main(string[] args) Console.WriteLine(Size(0, height).tostring()); Console.ReadKey(); //Main private static double Size(int n, double height) if (n == ndepth) return height; else return Size(n + 1, ratio * height); //Size //class Program 4

5 Question 2.1 (47) //Partial class for instance methods partial class Time : IComparable //Private data members private int hours, minutes, seconds; //Constructor 1 public Time(string stime) if (stime.length == 8) try hours = int.parse(stime.substring(0, 2)); minutes = int.parse(stime.substring(3, 2)); seconds = int.parse(stime.substring(6, 2)); catch hours = minutes = seconds = 59; //if else hours = minutes = seconds = 59; //Constructor //Constructor 2 public Time(int hours, int minutes, int seconds) this.hours = hours; this.minutes = minutes; this.seconds = seconds; if (hours + minutes + seconds == 0) hours = minutes = seconds = 59; //Time //Convert output to string public override string ToString() return hours.tostring().padleft(2, '0') + ":" + minutes.tostring().padleft(2, '0') + ":" + seconds.tostring().padleft(2, '0'); //ToString //Needed for IComparable public int CompareTo(object t) return this < (Time)t? -1 : this > (Time)t? 1 : 0; //CompareTo //partial class Time 5

6 //Partial class for static methods partial class Time public static Time operator +(Time t1, Time t2) int totalseconds1 = int.maxvalue; if (t1!= null) totalseconds1 = t1.hours * t1.minutes * 60 + t1.seconds; int totalseconds2 = int.maxvalue; if (t2!= null) totalseconds2 = t2.hours * t2.minutes * 60 + t2.seconds; int totalseconds = totalseconds1 + totalseconds2; int hours = totalseconds / 3600; totalseconds = totalseconds - hours * 3600; return new Time(hours, totalseconds / 60, totalseconds % 60); 7 //operator + public static bool operator > (Time t1, Time t2) int totalseconds1 = int.maxvalue; if (t1!= null) totalseconds1 = t1.hours * t1.minutes * 60 + t1.seconds; int totalseconds2 = int.maxvalue; if (t2!= null) totalseconds2 = t2.hours * t2.minutes * 60 + t2.seconds; return totalseconds1 > totalseconds2; x7 //operator > public static bool operator < (Time t1, Time t2) int totalseconds1 = int.maxvalue; if (t1!= null) totalseconds1 = t1.hours * t1.minutes * 60 + t1.seconds; int totalseconds2 = int.maxvalue; if (t2!= null) totalseconds2 = t2.hours * t2.minutes * 60 + t2.seconds; return totalseconds1 < totalseconds2; //operator < public static void Sort(Time[] times, int from, int to) if (from!= to) //Get index of max int indexofmax = 0; Time maxtime = times[indexofmax]; for (int i = 0; i <= to; i++) if (times[i] > times[indexofmax]) indexofmax = i; //Swap Time tmp = times[indexofmax]; times[indexofmax] = times[to]; times[to] = tmp; //Sort smaller array Sort(times, from, to - 1); //Sort //partial class 6

7 Question 2.2 (10) class CAthlete public string RaceNumber get; private set; public string Name get; private set; public Time time get; set; public CAthlete(string RaceNumber, string Name) this.racenumber = RaceNumber; this.name = Name; time = new Time(59, 59, 59); //CAthlete //class CAthlete Question 2.3 (31) class CTeam //Public data members public string Name get; private set; public CAthlete[] Athletes get; set; //Constructor public CTeam(string Name) this.name = Name; Athletes = new CAthlete[4]; Athletes[0] = new CAthlete("0", ""); Athletes[1] = new CAthlete("0", ""); Athletes[2] = new CAthlete("0", ""); Athletes[3] = new CAthlete("0", ""); //Indexer to get athlete public CAthlete this[string RaceNumber] get foreach (CAthlete athlete in Athletes) if (athlete.racenumber == RaceNumber) return athlete; return null; //this //Read-only property for total time of first three athletes public Time TotalTime get Time total = new Time(0, 0, 0); Time[] times = new Time[] Athletes[0].time, Athletes[1].time, Athletes[2].time, Athletes[3].time ; Time.Sort(times, 0, times.length - 1); for (int i = 0; i < 3; i++) total = total + times[i]; return total; //TotalTime //class CTeam 7

8 Question 2.4 (23) class CTeams //Private list of teams private List<CTeam> lstteams; //Constructor public CTeams() lstteams = new List<CTeam>(); //Constructor public void Add(CTeam team) lstteams.add(team); //Add public int Count() return lstteams.count; //Count //Indexer to return team public CTeam this[int i] get return lstteams[i]; //Indexer public void Sort() lstteams = lstteams.orderby(t => t.totaltime).tolist(); //Sort //class CTeams 8

9 Question 3 (50) public enum Pedal Break1, Break2, Break3, Petrol1, Petrol2, Petrol3, None public class CCar : IDisposable //To enable the Dispose event //Private members private int maxspeed; private double fuel; private double fuelcapacity ; private double distanceontank; private Pedal pedal; private CfrmCar frmparent; private bool ison = false; //Delegates public delegate void delspeedchanged(int speed); public delegate void delvaluechanged(double value); public delegate void delonstop(double fuel, double odo); //Events public event delspeedchanged SpeedChanged; public event delvaluechanged DistanceChanged; public event delvaluechanged FuelChanged; public event delonstop OnStop; //Constructor public CCar(CfrmCar frmparent, int maxspeed, double fuelcapacity) this.frmparent = frmparent; this.maxspeed = maxspeed; this.fuelcapacity = fuelcapacity; frmparent.pedaldown += frmparent_pedaldown; fuel = 50; distanceontank = 0; //Constructor public void Dispose() ison = false; frmparent.pedaldown -= frmparent_pedaldown; //Dispose public void Start(double fuel, double odo) this.fuel = fuel; this.distanceontank = odo; ison = true; HandlePedal(0); //First call //Start public void Stop() if (OnStop!= null) OnStop(fuel, distanceontank); ison = false; public void AddFuel(double fuel) this.fuel += fuel; if (this.fuel > fuelcapacity) this.fuel = fuelcapacity; Start(this.fuel, 0); private void frmparent_pedaldown(pedal pedal, bool isdown) this.pedal = isdown? pedal : Pedal.None; //frmparent_pedaldown 9

10 private void HandlePedal(int speed) switch (pedal) case Pedal.Break1: speed -= 2; break; //Light brake case Pedal.Break2: speed -= 4; break; //Firm brake case Pedal.Break3: speed -= 6; break; //Sharp brake case Pedal.Petrol1: speed += 0; break; //Keep constant case Pedal.Petrol2: speed += 2; break; //Steady accelerate case Pedal.Petrol3: speed += 4; break; //Fast accelerate default: speed -= 1; break; //Slow deceleration //switch //Speed if (speed < 0) speed = 0; if (speed > maxspeed) speed = maxspeed; //Distance double distancethisinterval = speed * 0.02; //s = v*t distanceontank += distancethisinterval; //Fuel if (speed > 0) double consumption = speed / 10.0; fuel -= distancethisinterval / consumption; if (fuel < 0) fuel = 0; pedal = Pedal.None; //Trigger events if (SpeedChanged!= null) SpeedChanged(speed); if (DistanceChanged!= null) DistanceChanged(Math.Round(distanceOnTank, 1)); if (FuelChanged!= null) FuelChanged(Math.Round(fuel, 1)); //Ensure that all event handlers are triggered before next execution of this method Application.DoEvents(); //Wait and repeat Thread.Sleep(200); if (ison) HandlePedal(speed); //Recursive call //HandlePedal //class CCar 10

11 public partial class CfrmCar : Form private CCar Car; public delegate void delpedaldown(pedal pedal, bool isdown); public event delpedaldown PedalDown; public CfrmCar() InitializeComponent(); //Constructor private void CfrmCar_Shown(object sender, EventArgs e) trbarspeed.maximum = 200; prbarfuel.maximum = 50; Car = new CCar(this, trbarspeed.maximum, prbarfuel.maximum); Car.SpeedChanged += delegate(int speed) lblspeed.text = speed.tostring(); trbarspeed.value = speed; ; Car.DistanceChanged += delegate(double distanceontank) lbldistanceontank.text = distanceontank.tostring(); ; Car.FuelChanged += delegate(double fuel) lblfuel.backcolor = (fuel < 10)? Color.Red : SystemColors.Control; lblfuel.text = fuel.tostring(); prbarfuel.value = Math.Min((int)fuel, prbarfuel.maximum); ; Car.OnStop += Car_OnStop; double fuel_ = 0, odo = 0; if (File.Exists("FuelOdo.txt")) StreamReader rdr = new StreamReader("FuelOdo.txt"); fuel_ = double.parse(rdr.readline()); odo = double.parse(rdr.readline()); rdr.close(); Car.Start(fuel_, odo); //CfrmCar_Shown private void Car_OnStop(double fuel, double odo) StreamWriter writer = new StreamWriter("FuelOdo.txt"); writer.writeline(fuel); writer.writeline(odo); writer.close(); //Car_OnStop private void CfrmCar_FormClosing(object sender, FormClosingEventArgs e) Car.Stop(); Car.Dispose(); //CfrmCar_FormClosing private void btnaddfuel_click(object sender, EventArgs e) Car.AddFuel(50); 11

12 #region event handlers for pedals 12 x 0.5 = 6 private void btnbreak1_mousedown(object sender, MouseEventArgs e) PedalDown(Pedal.Break1, true); private void btnbreak1_mouseup(object sender, MouseEventArgs e) PedalDown(Pedal.Break1, false); private void btnbreak2_mousedown(object sender, MouseEventArgs e) PedalDown(Pedal.Break2, true); private void btnbreak2_mouseup(object sender, MouseEventArgs e) PedalDown(Pedal.Break2, false); private void btnbreak3_mousedown(object sender, MouseEventArgs e) PedalDown(Pedal.Break3, true); private void btnbreak3_mouseup(object sender, MouseEventArgs e) PedalDown(Pedal.Break3, false); private void btnpetrol1_mousedown(object sender, MouseEventArgs e) PedalDown(Pedal.Petrol1, true); private void btnpetrol1_mouseup(object sender, MouseEventArgs e) PedalDown(Pedal.Petrol1, false); private void btnpetrol2_mousedown(object sender, MouseEventArgs e) PedalDown(Pedal.Petrol2, true); private void btnpetrol2_mouseup(object sender, MouseEventArgs e) PedalDown(Pedal.Petrol2, false); private void btnpetrol3_mousedown(object sender, MouseEventArgs e) PedalDown(Pedal.Petrol3, true); private void btnpetrol3_mouseup(object sender, MouseEventArgs e) PedalDown(Pedal.Petrol3, false); #endregion event handlers for pedals //class 12

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

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

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

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

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

UNIVERSITY OF THE FREE STATE MAIN & QWA-QWA CAMPUS RIS 124 DEPARTMENT: COMPUTER SCIENCE AND INFORMATICS CONTACT NUMBER: UNIVERSITY OF THE FREE STATE MAIN & QWA-QWA CAMPUS RIS 124 DEPARTMENT: COMPUTER SCIENCE AND INFORMATICS CONTACT NUMBER: 4012754 EXAMINATION: Main End-of-year Examination 2013 PAPER 1 ASSESSORS: Prof. P.J.

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

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

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

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

ITI 1120 Lab #9. Slides by: Diana Inkpen, Alan Williams, Daniel Amyot Some original material by Romelia Plesa

ITI 1120 Lab #9. Slides by: Diana Inkpen, Alan Williams, Daniel Amyot Some original material by Romelia Plesa ITI 1120 Lab #9 Slides by: Diana Inkpen, Alan Williams, Daniel Amyot Some original material by Romelia Plesa 1 Objectives Review fundamental concepts Example: the Time class Exercises Modify the Time class

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

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

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

Module Contact: Dr Gavin Cawley, CMP Copyright of the University of East Anglia Version 1

Module Contact: Dr Gavin Cawley, CMP Copyright of the University of East Anglia Version 1 UNIVERSITY OF EAST ANGLIA School of Computing Sciences Main Series UG Examination 2017-18 PROGRAMMING 1 CMP-4008Y Time allowed: 2 hours Answer FOUR questions. All questions carry equal weight. Notes are

More information

Chapter 11: Create Your Own Objects

Chapter 11: Create Your Own Objects Chapter 11: Create Your Own Objects Think Java: How to Think Like a Computer Scientist 5.1.2 by Allen B. Downey Our usual text takes a fairly non-standard departure in this chapter. Instead, please refer

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

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 7. Objectives: Navin Sridhar D 8 54

LAB 7. Objectives: Navin Sridhar D 8 54 LAB 7 Objectives: 1. Learn to create and define constructors. 2. Understand the use and application of constructors & instance variables. 3. Experiment with the various properties of arrays. 4. Learn to

More information

Defining Your Own Classes

Defining Your Own Classes Defining Your Own Classes In C, you are allowed to define a struct and then define variables of that struct. But Java allows you to define your own class. This means not only defining the data structure,

More information

Indexers.

Indexers. Indexers Indexers are special type of class members that provide the mechanism by which an object can be indexed like an array. Main use of indexers is to support the creation of specialized array that

More information

Framework Fundamentals

Framework Fundamentals Questions Framework Fundamentals 1. Which of the following are value types? (Choose all that apply.) A. Decimal B. String C. System.Drawing.Point D. Integer 2. Which is the correct declaration for a nullable

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

CS 113 PRACTICE FINAL

CS 113 PRACTICE FINAL CS 113 PRACTICE FINAL There are 13 questions on this test. The value of each question is: 1-10 multiple choice (4 pt) 11-13 coding problems (20 pt) You may get partial credit for questions 11-13. If you

More information

Chapter 1b Classes and Objects

Chapter 1b Classes and Objects Data Structures for Java William H. Ford William R. Topp Chapter 1b Classes and Objects Bret Ford 2005, Prentice Hall Object-Oriented Programming An object is an entity with data and operations on the

More information

Distributed Systems Recitation 1. Tamim Jabban

Distributed Systems Recitation 1. Tamim Jabban 15-440 Distributed Systems Recitation 1 Tamim Jabban Office Hours Office 1004 Sunday, Tuesday: 9:30-11:59 AM Appointment: send an e-mail Open door policy Java: Object Oriented Programming A programming

More information

ITI Introduction to Computing II

ITI Introduction to Computing II ITI 1121. Introduction to Computing II Marcel Turcotte School of Electrical Engineering and Computer Science Version of January 21, 2013 Abstract Review of object-oriented programming concepts: Implementing

More information

COP 3330 Final Exam Review

COP 3330 Final Exam Review COP 3330 Final Exam Review I. The Basics (Chapters 2, 5, 6) a. comments b. identifiers, reserved words c. white space d. compilers vs. interpreters e. syntax, semantics f. errors i. syntax ii. run-time

More information

MCSA Universal Windows Platform. A Success Guide to Prepare- Programming in C# edusum.com

MCSA Universal Windows Platform. A Success Guide to Prepare- Programming in C# edusum.com 70-483 MCSA Universal Windows Platform A Success Guide to Prepare- Programming in C# edusum.com Table of Contents Introduction to 70-483 Exam on Programming in C#... 2 Microsoft 70-483 Certification Details:...

More information

What is an interface? Why is an interface useful?

What is an interface? Why is an interface useful? IST311 Interfaces IST311 / 602 Cleveland State University Prof. Victor Matos Adapted from: Introduction to Java Programming: Comprehensive Version, Eighth Edition by Y. Daniel Liang 1 What is an interface?

More information

Practice Questions for Final Exam: Advanced Java Concepts + Additional Questions from Earlier Parts of the Course

Practice Questions for Final Exam: Advanced Java Concepts + Additional Questions from Earlier Parts of the Course : Advanced Java Concepts + Additional Questions from Earlier Parts of the Course 1. Given the following hierarchy: class Alpha {... class Beta extends Alpha {... class Gamma extends Beta {... In what order

More information

Name Section Number. CS210 Exam #3 *** PLEASE TURN OFF ALL CELL PHONES*** Practice

Name Section Number. CS210 Exam #3 *** PLEASE TURN OFF ALL CELL PHONES*** Practice Name Section Number CS210 Exam #3 *** PLEASE TURN OFF ALL CELL PHONES*** Practice All Sections Bob Wilson OPEN BOOK / OPEN NOTES: You will have all 90 minutes until the start of the next class period.

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

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

This exam is open book. Each question is worth 3 points.

This exam is open book. Each question is worth 3 points. This exam is open book. Each question is worth 3 points. Page 1 / 15 Page 2 / 15 Page 3 / 12 Page 4 / 18 Page 5 / 15 Page 6 / 9 Page 7 / 12 Page 8 / 6 Total / 100 (maximum is 102) 1. Are you in CS101 or

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

Skinning Manual v1.0. Skinning Example

Skinning Manual v1.0. Skinning Example Skinning Manual v1.0 Introduction Centroid Skinning, available in CNC11 v3.15 r24+ for Mill and Lathe, allows developers to create their own front-end or skin for their application. Skinning allows developers

More information

C# 2008 and.net Programming for Electronic Engineers - Elektor - ISBN

C# 2008 and.net Programming for Electronic Engineers - Elektor - ISBN Contents Contents 5 About the Author 12 Introduction 13 Conventions used in this book 14 1 The Visual Studio C# Environment 15 1.1 Introduction 15 1.2 Obtaining the C# software 15 1.3 The Visual Studio

More information

More Language Features and Windows Forms

More Language Features and Windows Forms More Language Features and Windows Forms C# Programming January 12 Part I Some Language Features Inheritance To extend a class A: class B : A {... } B inherits all instance variables and methods of A Which

More information

10Tec igrid for.net 6.0 What's New in the Release

10Tec igrid for.net 6.0 What's New in the Release What s New in igrid.net 6.0-1- 2018-Feb-15 10Tec igrid for.net 6.0 What's New in the Release Tags used to classify changes: [New] a totally new feature; [Change] a change in a member functionality or interactive

More information

Lecture 06: Classes and Objects

Lecture 06: Classes and Objects Accelerating Information Technology Innovation http://aiti.mit.edu Lecture 06: Classes and Objects AITI Nigeria Summer 2012 University of Lagos. What do we know so far? Primitives: int, float, double,

More information

More Language Features and Windows Forms. Part I. Some Language Features. Inheritance. Inheritance. Inheritance. Inheritance.

More Language Features and Windows Forms. Part I. Some Language Features. Inheritance. Inheritance. Inheritance. Inheritance. More Language Features and Windows Forms C# Programming Part I Some Language Features January 12 To extend a class A: class B : A { B inherits all instance variables and methods of A Which ones it can

More information

Exam Duration: 2hrs and 30min Software Design

Exam Duration: 2hrs and 30min Software Design Exam Duration: 2hrs and 30min. 433-254 Software Design Section A Multiple Choice (This sample paper has less questions than the exam paper The exam paper will have 25 Multiple Choice questions.) 1. Which

More information

Chapter 13: Handling Events

Chapter 13: Handling Events Chapter 13: Handling Events Event Handling Event Occurs when something interesting happens to an object Used to notify a client program when something happens to a class object the program is using Event

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

1 de :02

1 de :02 1 de 6 02-12-2005 18:02!" $%$&&$ ' ( ) ) * +,"* (-)( )(*) ) ). /) %) ( ( -( *)% ) (0 ( " ' * ) *) *)(%* % ) (!%12%! ( ) ( ( )*)3 *) ( *(-)( %. )(( ) *(!() 2 ( (6 &)*7 8 ( 1( -(! ", % ' ( *.() (%) )() (

More information

Overview Describe the structure of a Windows Forms application Introduce deployment over networks

Overview Describe the structure of a Windows Forms application Introduce deployment over networks Windows Forms Overview Describe the structure of a Windows Forms application application entry point forms components and controls Introduce deployment over networks 2 Windows Forms Windows Forms are classes

More information

Computer Science II. OO Programming Classes Scott C Johnson Rochester Institute of Technology

Computer Science II. OO Programming Classes Scott C Johnson Rochester Institute of Technology Computer Science II OO Programming Classes Scott C Johnson Rochester Institute of Technology Outline Object-Oriented (OO) Programming Review Initial Implementation Constructors Other Standard Behaviors

More information

CSCI-142 Exam 1 Review September 25, 2016 Presented by the RIT Computer Science Community

CSCI-142 Exam 1 Review September 25, 2016 Presented by the RIT Computer Science Community CSCI-12 Exam 1 Review September 25, 2016 Presented by the RIT Computer Science Community http://csc.cs.rit.edu 1. Provide a detailed explanation of what the following code does: 1 public boolean checkstring

More information

Introduction to Computer Science II (CSI 1101) Midterm Examination

Introduction to Computer Science II (CSI 1101) Midterm Examination Identification Student name: Introduction to Computer Science II (CSI 1101) Midterm Examination Instructor: Marcel Turcotte February 2003, duration: 2 hours Student number: Section: Instructions 1. This

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

CSIS 10A Assignment 9 Solutions

CSIS 10A Assignment 9 Solutions CSIS 10A Assignment 9 Solutions Read: Chapter 9 Choose and complete any 10 points from the problems below, which are all included in the download file on the website. Use BlueJ to complete the assignment,

More information

Topic 7: Algebraic Data Types

Topic 7: Algebraic Data Types Topic 7: Algebraic Data Types 1 Recommended Exercises and Readings From Haskell: The craft of functional programming (3 rd Ed.) Exercises: 5.5, 5.7, 5.8, 5.10, 5.11, 5.12, 5.14 14.4, 14.5, 14.6 14.9, 14.11,

More information

Enumerated Types. CSE 114, Computer Science 1 Stony Brook University

Enumerated Types. CSE 114, Computer Science 1 Stony Brook University Enumerated Types CSE 114, Computer Science 1 Stony Brook University http://www.cs.stonybrook.edu/~cse114 1 Enumerated Types An enumerated type defines a list of enumerated values Each value is an identifier

More information

Practice Problems: Instance methods

Practice Problems: Instance methods Practice Problems: Instance methods Submit your java files to D2L. Late work will not be acceptable. a. Write a class Person with a constructor that accepts a name and an age as its argument. These values

More information

Lecture 3. Lecture

Lecture 3. Lecture True Object-Oriented programming: Dynamic Objects Static Object-Oriented Programming Reference Variables Eckel: 30-31, 41-46, 107-111, 114-115 Riley: 5.1, 5.2 D0010E Object-Oriented Programming and Design

More information

The C# Programming Language. Overview

The C# Programming Language. Overview The C# Programming Language Overview Microsoft's.NET Framework presents developers with unprecedented opportunities. From web applications to desktop and mobile platform applications - all can be built

More information

Lecture 7 Objects and Classes

Lecture 7 Objects and Classes Lecture 7 Objects and Classes An Introduction to Data Abstraction MIT AITI June 13th, 2005 1 What do we know so far? Primitives: int, double, boolean, String* Variables: Stores values of one type. Arrays:

More information

C# machine model. Programming Language Concepts and Implementation Fall 2011, Lecture 2. Rasmus Ejlers Møgelberg

C# machine model. Programming Language Concepts and Implementation Fall 2011, Lecture 2. Rasmus Ejlers Møgelberg C# machine model Programming Language Concepts and Implementation Fall 2011, Lecture 2 Reference types vs. value types Structs 2-dimensional arrays Overview Method calls: call-by-value vs. call-by-reference

More information

What is the return type of getnameofmonth?

What is the return type of getnameofmonth? 1 What is the return type of getnameofmonth? public class Date { private int month; public int getmonth() { return month; public getnameofmonth() { if (getmonth() == 0) { return "January"; else if (getmonth()

More information

Distributed Systems Recitation 1. Tamim Jabban

Distributed Systems Recitation 1. Tamim Jabban 15-440 Distributed Systems Recitation 1 Tamim Jabban Office Hours Office 1004 Tuesday: 9:30-11:59 AM Thursday: 10:30-11:59 AM Appointment: send an e-mail Open door policy Java: Object Oriented Programming

More information

Homework 5. Yuji Shimojo CMSC 330. Instructor: Prof. Reginald Y. Haseltine

Homework 5. Yuji Shimojo CMSC 330. Instructor: Prof. Reginald Y. Haseltine Homework 5 Yuji Shimojo CMSC 330 Instructor: Prof. Reginald Y. Haseltine July 13, 2013 Question 1 Consider the following Java definition of a mutable string class. class MutableString private char[] chars

More information

Lecture 8 Classes and Objects Part 2. MIT AITI June 15th, 2005

Lecture 8 Classes and Objects Part 2. MIT AITI June 15th, 2005 Lecture 8 Classes and Objects Part 2 MIT AITI June 15th, 2005 1 What is an object? A building (Strathmore university) A desk A laptop A car Data packets through the internet 2 What is an object? Objects

More information

Classes in C# namespace classtest { public class myclass { public myclass() { } } }

Classes in C# namespace classtest { public class myclass { public myclass() { } } } Classes in C# A class is of similar function to our previously used Active X components. The difference between the two is the components are registered with windows and can be shared by different applications,

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

Faculty of Science FINAL EXAMINATION

Faculty of Science FINAL EXAMINATION Faculty of Science FINAL EXAMINATION COMPUTER SCIENCE COMP 250 INTRODUCTION TO COMPUTER SCIENCE Examiner: Prof. Michael Langer April 27, 2010 Associate Examiner: Mr. Joseph Vybihal 9 A.M. 12 P.M. Instructions:

More information

AP Computer Science Chapter 10 Implementing and Using Classes Study Guide

AP Computer Science Chapter 10 Implementing and Using Classes Study Guide AP Computer Science Chapter 10 Implementing and Using Classes Study Guide 1. A class that uses a given class X is called a client of X. 2. Private features of a class can be directly accessed only within

More information

Representing Recursive Relationships Using REP++ TreeView

Representing Recursive Relationships Using REP++ TreeView Representing Recursive Relationships Using REP++ TreeView Author(s): R&D Department Publication date: May 4, 2006 Revision date: May 2010 2010 Consyst SQL Inc. All rights reserved. Representing Recursive

More information

C# s A Doddle. Steve Love. ACCU April 2013

C# s A Doddle. Steve Love. ACCU April 2013 C# s A Doddle Steve Love ACCU April 2013 A run through C# (pronounced See Sharp ) is a simple, modern, object-oriented, and type-safe programming language. C# has its roots in the C family of languages,

More information

Programming Languages and Techniques (CIS120)

Programming Languages and Techniques (CIS120) Programming Languages and Techniques (CIS120) Lecture 26 March 23, 2016 Inheritance and Dynamic Dispatch Chapter 24 Inheritance Example public class { private int x; public () { x = 0; } public void incby(int

More information

Main Game Code. //ok honestly im not sure, if i guess its a class ment for this page called methodtimer that //either uses the timer or set to timer..

Main Game Code. //ok honestly im not sure, if i guess its a class ment for this page called methodtimer that //either uses the timer or set to timer.. using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms;

More information

Review sheet for Final Exam (List of objectives for this course)

Review sheet for Final Exam (List of objectives for this course) Review sheet for Final Exam (List of objectives for this course) Please be sure to see other review sheets for this semester Please be sure to review tests from this semester Week 1 Introduction Chapter

More information

Advanced Computer Programming

Advanced Computer Programming Hazırlayan Yard. Doç. Dr. Mehmet Fidan ARRAYS A group of data with same type stored under one variable. It is assumed that elements in that group are ordered in series. In C# language arrays are has System.Array

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

Introduction to Programming Using Java (98-388)

Introduction to Programming Using Java (98-388) Introduction to Programming Using Java (98-388) Understand Java fundamentals Describe the use of main in a Java application Signature of main, why it is static; how to consume an instance of your own class;

More information

Representative Delegates

Representative Delegates The Inside Track Representative and Reactionary Programming June 2001 I m back from my vacation. It was great, I saw many of the great natural wonders the south and west part of this country has to offer.

More information

Object Oriented Programming is a programming method that combines: Advantage of Object Oriented Programming

Object Oriented Programming is a programming method that combines: Advantage of Object Oriented Programming Overview of OOP Object Oriented Programming is a programming method that combines: a) Data b) Instructions for processing that data into a self-sufficient object that can be used within a program or in

More information

FACULTY OF SCIENCE ACADEMY OF COMPUTER SCIENCE & SOFTWARE ENGINEERING IFM01B1 / IFM1B10 INTRODUCTION TO DATA STRUCTURES (VB)

FACULTY OF SCIENCE ACADEMY OF COMPUTER SCIENCE & SOFTWARE ENGINEERING IFM01B1 / IFM1B10 INTRODUCTION TO DATA STRUCTURES (VB) FACULTY OF SCIENCE ACADEMY OF COMPUTER SCIENCE & SOFTWARE ENGINEERING MODULE CAMPUS IFM01B1 / IFM1B10 INTRODUCTION TO DATA STRUCTURES (VB) APK EXAM NOVEMBER 2014 DATE 2014-11-08 SESSION 08h30 10h30 ASSESSORS

More information

CSCI 136 Written Exam #1 Fundamentals of Computer Science II Spring 2015

CSCI 136 Written Exam #1 Fundamentals of Computer Science II Spring 2015 CSCI 136 Written Exam #1 Fundamentals of Computer Science II Spring 2015 Name: This exam consists of 5 problems on the following 7 pages. You may use your double- sided hand- written 8 ½ x 11 note sheet

More information

Topic 7: Inheritance. Reading: JBD Sections CMPS 12A Winter 2009 UCSC

Topic 7: Inheritance. Reading: JBD Sections CMPS 12A Winter 2009 UCSC Topic 7: Inheritance Reading: JBD Sections 7.1-7.6 1 A Quick Review of Objects and Classes! An object is an abstraction that models some thing or process! Examples of objects:! Students, Teachers, Classes,

More information

9 A Preview of.net 2.0

9 A Preview of.net 2.0 473 9 A Preview of.net 2.0 Microsoft.NET is an evolving system that is continuously improved and extended. In late 2003 Microsoft announced.net 2.0 (codename Whidbey) as a major new version of.net; a beta

More information

EXAMINATIONS 2011 Trimester 2, MID-TERM TEST. COMP103 Introduction to Data Structures and Algorithms SOLUTIONS

EXAMINATIONS 2011 Trimester 2, MID-TERM TEST. COMP103 Introduction to Data Structures and Algorithms SOLUTIONS T E W H A R E W Ā N A N G A O T E Ū P O K O O T E I K A A M Ā U I VUW V I C T O R I A UNIVERSITY OF WELLINGTON Student ID:....................... EXAMINATIONS 2011 Trimester 2, MID-TERM TEST COMP103 Introduction

More information

Topics Applications Most Common Methods Serial Search Binary Search Search by Hashing (next lecture) Run-Time Analysis Average-time analysis Time anal

Topics Applications Most Common Methods Serial Search Binary Search Search by Hashing (next lecture) Run-Time Analysis Average-time analysis Time anal CSC212 Data Structure t Lecture 18 Searching Instructor: George Wolberg Department of Computer Science City College of New York @ George Wolberg, 2016 1 Topics Applications Most Common Methods Serial Search

More information

Practice Midterm 2 CMPS 12A Fall 2017

Practice Midterm 2 CMPS 12A Fall 2017 1.) Determine the output of the following program. public class Question1{ Car x = new Car("gray", 100000); Car y = new Car("red", 125000); Car z = new Car("blue", 150000); x = y; roadtrip(x); z = x; System.out.println(z.mileage);

More information

Object Oriented Programming: In this course we began an introduction to programming from an object-oriented approach.

Object Oriented Programming: In this course we began an introduction to programming from an object-oriented approach. CMSC 131: Chapter 28 Final Review: What you learned this semester The Big Picture Object Oriented Programming: In this course we began an introduction to programming from an object-oriented approach. Java

More information

COMP200 - Object Oriented Programming: Test One Duration - 60 minutes

COMP200 - Object Oriented Programming: Test One Duration - 60 minutes COMP200 - Object Oriented Programming: Test One Duration - 60 minutes Study the following class and answer the questions that follow: package shapes3d; public class Circular3DShape { private double radius;

More information

Chapter 13 Working with Threads

Chapter 13 Working with Threads Chapter 13 Working with Threads Until relatively recently only advanced programmers understood and knew how to employ threads in application programs. Part of the problem was that using threads was not

More information

Very similar to Java C++ C-Based syntax (if, while, ) object base class no pointers, object parameters are references All code in classes

Very similar to Java C++ C-Based syntax (if, while, ) object base class no pointers, object parameters are references All code in classes C# Very similar to Java C++ C-Based syntax (if, while, ) object base class no pointers, object parameters are references All code in classes Before we begin You already know and have programmed with Java

More information

Java and C# in Depth

Java and C# in Depth Chair of Software Engineering Java and C# in Depth Carlo A. Furia, Marco Piccioni, Bertrand Meyer Exercise Session Week 4 Chair of Software Engineering Don t forget to form project groups by tomorrow (March

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

Final Examination Semester 3 / Year 2012

Final Examination Semester 3 / Year 2012 Final Examination Semester 3 / Year 2012 COURSE : ADVANCED JAVA PROGRAMMING COURSE CODE : PROG 2114 TIME : 2 1/2 HOURS DEPARTMENT : COMPUTER SCIENCE LECTURER : LIM PEI GEOK Student s ID : Batch No. : Notes

More information

C#.Net. Course Contents. Course contents VT BizTalk. No exam, but laborations

C#.Net. Course Contents. Course contents VT BizTalk. No exam, but laborations , 1 C#.Net VT 2009 Course Contents C# 6 hp approx. BizTalk 1,5 hp approx. No exam, but laborations Course contents Architecture Visual Studio Syntax Classes Forms Class Libraries Inheritance Other C# essentials

More information

ListBox. Class ListBoxTest. Allows users to add and remove items from ListBox Uses event handlers to add to, remove from, and clear list

ListBox. Class ListBoxTest. Allows users to add and remove items from ListBox Uses event handlers to add to, remove from, and clear list C# cont d (C-sharp) (many of these slides are extracted and adapted from Deitel s book and slides, How to Program in C#. They are provided for CSE3403 students only. Not to be published or publicly distributed

More information

Objects and Classes Continued. Engineering 1D04, Teaching Session 10

Objects and Classes Continued. Engineering 1D04, Teaching Session 10 Objects and Classes Continued Engineering 1D04, Teaching Session 10 Recap: HighScores Example txtname1 txtname2 txtscore1 txtscore2 Copyright 2006 David Das, Ryan Lortie, Alan Wassyng 1 recap: HighScores

More information

Introduction to Inheritance

Introduction to Inheritance Introduction to Inheritance James Brucker These slides cover only the basics of inheritance. What is Inheritance? One class incorporates all the attributes and behavior from another class -- it inherits

More information

Java Fundamentals (II)

Java Fundamentals (II) Chair of Software Engineering Languages in Depth Series: Java Programming Prof. Dr. Bertrand Meyer Java Fundamentals (II) Marco Piccioni static imports Introduced in 5.0 Imported static members of a class

More information

PROGRAMMING FUNDAMENTALS

PROGRAMMING FUNDAMENTALS PROGRAMMING FUNDAMENTALS Q1. Name any two Object Oriented Programming languages? Q2. Why is java called a platform independent language? Q3. Elaborate the java Compilation process. Q4. Why do we write

More information

AP COMPUTER SCIENCE JAVA CONCEPTS IV: RESERVED WORDS

AP COMPUTER SCIENCE JAVA CONCEPTS IV: RESERVED WORDS AP COMPUTER SCIENCE JAVA CONCEPTS IV: RESERVED WORDS PAUL L. BAILEY Abstract. This documents amalgamates various descriptions found on the internet, mostly from Oracle or Wikipedia. Very little of this

More information

CSC Java Programming, Fall Java Data Types and Control Constructs

CSC Java Programming, Fall Java Data Types and Control Constructs CSC 243 - Java Programming, Fall 2016 Java Data Types and Control Constructs Java Types In general, a type is collection of possible values Main categories of Java types: Primitive/built-in Object/Reference

More information

Class and Functions. Reusable codes

Class and Functions. Reusable codes Class and Functions Reusable codes Object Oriented Design First concept of object oriented programming is emerged at 60 s. Smalltalk language which is introduced at 1972 was first object oriented programming

More information

UCLA PIC 20A Java Programming

UCLA PIC 20A Java Programming UCLA PIC 20A Java Programming Instructor: Ivo Dinov, Asst. Prof. In Statistics, Neurology and Program in Computing Teaching Assistant: Yon Seo Kim, PIC University of California, Los Angeles, Summer 2002

More information