RIS214. Class Test 3

Size: px
Start display at page:

Download "RIS214. Class Test 3"

Transcription

1 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? 2 : good attempt? 1 : 0; if (Sum(marks) < 0) assignment is incomplete resubmit entire assignment if (mark for resubmit > 50%) mark = 0 else assignment is incomplete if (second assignment incomplete) module is incomplete Come back next year Please read the departmental disciplinary code on the csi server. If you are found guilty of plagiarism (dealer or stealer), you will get incomplete for this assignment and you will have to resubmit. If your resubmitted program does not run correctly you will get an incomplete for the module. Come back next year. Remember that these weekly exercises are exercises. The more time you spend, the easier you will find the tests and exam. Submit before Wednesday 26 February 17:00. Section A (Operator overloading) 1. Consider the basic class for fractions that was discussed in class. Make provision for all types of exceptions. 1.1 Expand the class to make provision for the operators: -, *, /, ==,!=, >, <, Equals (unary) 1.2 Provide a method ToDouble() that will return the double equivalent of the fraction. 1.3 Provide a method, Parse(), which will take string input and instantiate a new instance of the class Fraction. Use hard coded values and expressions in the Main() method to test all operators and methods. static void Main() //Input Fraction f1 = new Fraction(3, 6); Fraction f2 = Fraction.Parse("1/3"); 1

2 //Return as decimals Console.WriteLine(f1.ToString() + " = " + f1.todouble().tostring()); Console.WriteLine(f2.ToString() + " = " + f2.todouble().tostring()); //Basic operations Fraction f3 = f1 + f2; Console.WriteLine(f1.ToString() + " + " + f2.tostring() + " = " + f3.tostring()); f3 = f1 - f2; Console.WriteLine(f1.ToString() + " - " + f2.tostring() + " = " + f3.tostring()); f3 = f1 * f2; Console.WriteLine(f1.ToString() + " * " + f2.tostring() + " = " + f3.tostring()); f3 = f1 / f2; Console.WriteLine(f1.ToString() + " / " + f2.tostring() + " = " + f3.tostring()); //Comparisons Console.WriteLine(f1 == f2? f1.tostring() + " = " + f2.tostring() : f1.tostring() + " <> " + f2.tostring()); Console.WriteLine(f1.Equals(f2)? f1.tostring() + " equals " + f2.tostring() : f1.tostring() + " not equal to " + f2.tostring()); Console.WriteLine(f1 > f2? f1.tostring() + " > " + f2.tostring() : f1 < f2? f1.tostring() + " < " + f2.tostring() : f1.tostring() + " = " + f2.tostring() ); Console.Write("Press any key to exit..."); //Main Section B (Generics and Indexers) 2. Develop a generic method that will accept a list of elements of any type and print all elements to the screen. Provide and implement several test cases. 3. Develop a generic class called Stock. The class should privately store the name of the stock, the current value of the stock and the value the stock was previously (default: 0). The class should contain a suitable constructor, a method to set the current value of the stock and override ToString() so that when it is called the class returns the current and previous value of the stock as well as the stocks name. In Main() create three instances of Stock: an int, decimal and long version. Use ToString() to write to console the stock values, change the current value then write to console once again. Ensure that the previous value of the stock is kept. Section C (Project) 4. Do number 22 in Nakov, page 616 and 618. Use an enum for the names of disciplines. Create a class CSchool with nested classes for CSchoolClass, CStudent, CTeacher, CDiscipline. Define generic lists for school classes, students, and teachers. Use serialisation to save your data (see the extra notes given to you last year as part of Chapter 13 of Blignaut or page 262 in the 2014 version of Blignaut). Use a menu driven application from a console application. Provide for reports with students in a class, classes taught by a teacher, etc. Be creative and see how much detail you can add. You may work together in groups for this one. List the names of all group members together with his/her contribution in a comment block at the top of every class. The contribution is expressed as a percentage of the input provided by the person who contributed the most. For example if A did the most, he gets 100%. If B did about 80% of the amount of work that A did, he gets 80%. The same for the other team members. I trust your integrity. Don t disappoint me. 2

3 SOLUTIONS Question 1 class Fraction //Fields private int numerator; private int denominator; // Constructor public Fraction(int numerator, int denominator) if (denominator == 0) throw new Exception("Cannot have zero denominator."); this.numerator = numerator; this.denominator = denominator; //Reduce(); //Constructor //Parse public static Fraction Parse(string s) string snumerator = s.substring(0, s.indexof("/")); string sdenominator = s.substring(s.indexof("/")+1); int numerator, denominator; if (int.tryparse(sdenominator, out denominator) && int.tryparse(snumerator, out numerator)) return new Fraction(numerator, denominator); else return new Fraction(0, 1); //Parse //Operators public static Fraction operator + (Fraction f1, Fraction f2) Fraction f = new Fraction(f1.numerator * f2.denominator + f2.numerator * f1.denominator, f1.denominator * f2.denominator); return f.reduce(); //operator + public static Fraction operator - (Fraction f1, Fraction f2) Fraction f = new Fraction(f1.numerator * f2.denominator - f2.numerator * f1.denominator, f1.denominator * f2.denominator); return f.reduce(); //operator - public static Fraction operator * (Fraction f1, Fraction f2) Fraction f = new Fraction(f1.numerator * f2.numerator, f1.denominator * f2.denominator); return f.reduce(); //operator * public static Fraction operator / (Fraction f1, Fraction f2) Fraction f = new Fraction(f1.numerator * f2.denominator, f1.denominator * f2.numerator); return f.reduce(); //operator / //Comparisons public static bool operator == (Fraction f1, Fraction f2) return (f1.numerator == f2.numerator && f1.denominator == f2.denominator); 3

4 public static bool operator!=(fraction f1, Fraction f2) return!(f1 == f2); public bool Equals(Fraction f) return (this.numerator == f.numerator && this.denominator == f.denominator); public static bool operator > (Fraction f1, Fraction f2) return f1.numerator * f2.denominator > f2.numerator * f1.denominator; public static bool operator <(Fraction f1, Fraction f2) return f1.numerator * f2.denominator < f2.numerator * f1.denominator; //Convert to double public double ToDouble() return numerator * 1.0 / denominator; // Reduce fraction to simplest form private Fraction Reduce() Fraction f = new Fraction(1, 1); int gcd = Math.Abs(numerator) > Math.Abs(denominator)? Math.Abs(denominator) : Math.Abs(numerator); if (gcd == 0) return this; while (!(numerator % gcd == 0 && denominator % gcd == 0)) gcd--; f.numerator = numerator / gcd; f.denominator = denominator / gcd; return f; //Reduce // Display public override String ToString() if (numerator == 0) return "0"; String sign = ""; if (numerator * denominator < 0) sign = "-"; if (denominator == 1) return sign + Math.Abs(numerator); return sign + Math.Abs(numerator) + "/" + Math.Abs(denominator); //ToString() //CFraction 4

5 Question 2 class Program static void Main(string[] args) //List of ints List<int> lstintegers = new List<int>(); lstintegers.addrange(new int[] 4, 7, 8, 9, 2, 4 ); Print<int>(lstIntegers); //List of strings List<string> lstnames = new List<string>(); lstnames.addrange(new string[] "John", "Mike", "Susan", "Abel", "Henri", "Dan" ); Print<string>(lstNames); //List of students List<CStudent> lststudents = new List<CStudent>(); lststudents.add(new CStudent("123", "John")); lststudents.add(new CStudent("345", "Mike")); lststudents.add(new CStudent("234", "Sarel")); lststudents.add(new CStudent("345", "Peet")); Print<CStudent>(lstStudents); //Opportunity to read output //Main static void Print<T>(List<T> list) foreach (T element in list) Console.WriteLine(element); //Print //class Program class CStudent public string StudentNumber get; set; public string StudentName get; set; public CStudent(string Number, string Name) StudentNumber = Number; StudentName = Name; public override string ToString() return StudentNumber + ", " + StudentName; //class CStudent 5

6 Question 3 class Program static void Main(string[] args) Stock<int> ComputerStock = new Stock<int>(20, "Computer INC"); Stock<decimal> RetailStock = new Stock<decimal>(14.33m, "Pick and Pray"); Stock<double> UFSStock = new Stock<double>( d, "UFS"); Console.WriteLine(UFSStock.ToString()); Console.WriteLine(RetailStock.ToString()); Console.WriteLine(ComputerStock.ToString()); ComputerStock.SetValue(30); RetailStock.SetValue(22.5m); UFSStock.SetValue(15.333d); Console.WriteLine(UFSStock.ToString()); Console.WriteLine(RetailStock.ToString()); Console.WriteLine(ComputerStock.ToString()); Console.ReadLine(); //Main //class Program public class CStock <T> private T Value; private T PreviousValue get; set; private string StockName get; set; public CStock(T value, string StockName) this.value = value; this.stockname = StockName; public void SetValue(T value) this.previousvalue = this.value; this.value = value; public override string ToString() return "Value of " + this.stockname +" was " + this.previousvalue + " and is now " + this.value; //clas CStock 6

7 Question 4 Below is one possible solution. This exercise was left open ended and you could have implemented it in any way that you thought would work. I tried to model a primary school where all students have the same set of subjects and stay in the same class for the entire year. In other words, a student belongs to one class only. Teachers who teach in different classes had to be entered spearately for all classes. I know that this is not always realistic, but we have to make some assumptions to keep the design simple. enum Disciplines Accounting, Afrikaans, English, History, IT, LifeSkills, Maths, Science //enum Disciplines [Serializable] class CSchool //Students [Serializable] public class CStudent public string Number get; set; public string Name get; set; //class CStudent //public List<CStudent> lststudents get; private set; //Classes [Serializable] public class CSchoolClass public string classidentifier; public List<CTeacher> lstteachers; public List<CStudent> lststudents; public CSchoolClass() lstteachers = new List<CTeacher>(); lststudents = new List<CStudent>(); //class CSchoolClass public List<CSchoolClass> lstclasses get; private set; //Teachers [Serializable] public class CTeacher public string Name get; set; public List<CDiscipline> lstdisciplines; public CTeacher() lstdisciplines = new List<CDiscipline>(); //class CTeacher //Disciplines [Serializable] public class CDiscipline public Disciplines Name; int NumberOfLessons; int NumberOfExercises; //class CDiscipline //Constructor public CSchool() lstclasses = new List<CSchoolClass>(); //class CSchool 7

8 class Program static CSchool School; #region Main and Menu static void Main(string[] args) School = new CSchool(); Read(); //Read data from disk Menu(); //Display menu first time //Main private static void Menu() Console.WriteLine("1. Enter classes"); Console.WriteLine("2. List classes"); Console.WriteLine("3. Enter teachers per class"); Console.WriteLine("4. List teachers per class"); Console.WriteLine("5. List classes per teacher"); Console.WriteLine("6. Enter students per class"); Console.WriteLine("7. List students per class"); Console.WriteLine("X. Exit"); Console.Write("\nSelect: "); char option = Console.ReadKey().KeyChar.ToString().ToUpper()[0]; switch (option) case '1': EnterClasses(); Menu(); break; case '2': ListClasses(); Menu(); break; case '3': EnterTeachersPerClass(); Menu(); break; case '4': ListTeachersPerClass(); Menu(); break; case '5': ListClassesPerTeacher(); Menu(); break; case '6': EnterStudentsPerClass(); Menu(); break; case '7': ListStudentsPerClass(); Menu(); break; case 'X': Save(); break; default: Menu(); break; //Menu #endregion Main and Menu #region Serialize private static void Save() FileStream fs = new FileStream("School.bin", FileMode.Create); IFormatter formatter = new BinaryFormatter(); formatter.serialize(fs, School); fs.close(); //Save private static void Read() if (File.Exists("School.bin")) FileStream fs = null; fs = new FileStream("School.bin", FileMode.Open); IFormatter formatter = new BinaryFormatter(); School = (CSchool)formatter.Deserialize(fs); fs.close(); //Read #endregion Serialize 8

9 #region School classes private static void EnterClasses() //if (School.lstClasses == null) // School.lstClasses = new List<CSchool.CSchoolClass>(); string sidentifier = ""; do Console.Write("Class name (x to exit): "); sidentifier = Console.ReadLine(); if (sidentifier.toupper()!= "X") School.lstClasses.Add(new CSchool.CSchoolClass classidentifier = sidentifier ); while (sidentifier.toupper()!= "X"); //EnterClasses private static void ListClasses() foreach (CSchool.CSchoolClass class_ in School.lstClasses) Console.WriteLine(class_.classIdentifier); //ListClasses #endregion School classes 9

10 #region Teachers per class private static void EnterTeachersPerClass() Console.Write("Class: "); string sclass = Console.ReadLine(); CSchool.CSchoolClass class_ = School.lstClasses.First(cl => cl.classidentifier == sclass); if (class_!= null) string sname = ""; do Console.Write("Teacher name (x to exit): "); sname = Console.ReadLine(); if (sname.toupper()!= "X") CSchool.CTeacher teacher = new CSchool.CTeacher Name = sname ; string sdiscipline = ""; do Console.Write("Discipline (x to exit): "); sdiscipline = Console.ReadLine(); if (sdiscipline.toupper()!= "X") Disciplines Discipline = (Disciplines)Enum.Parse(typeof(Disciplines), sdiscipline); teacher.lstdisciplines.add(new CSchool.CDiscipline Name = Discipline ); while (sdiscipline.toupper()!= "X"); class_.lstteachers.add(teacher); while (sname.toupper()!= "X"); //if class_!= null //EnterTeachersPerClass private static void ListTeachersPerClass() Console.Write("Class: "); string sclass = Console.ReadLine(); CSchool.CSchoolClass class_ = School.lstClasses.First(cl => cl.classidentifier == sclass); foreach (CSchool.CTeacher teacher in class_.lstteachers) Console.Write(teacher.Name + "\t"); foreach (CSchool.CDiscipline discipline in teacher.lstdisciplines) Console.Write(discipline.Name.ToString() + ", "); //foreach teacher //ListTeachersPerClass 10

11 private static void ListClassesPerTeacher() Console.Write("Teacher: "); string steacher = Console.ReadLine(); foreach (CSchool.CSchoolClass class_ in School.lstClasses) foreach (CSchool.CTeacher teacher in class_.lstteachers) if (teacher.name == steacher) Console.WriteLine(class_.classIdentifier); //ListClassesPerTeacher #endregion teachers per class #region Students per class private static void EnterStudentsPerClass() Console.Write("Class: "); string sclass = Console.ReadLine(); CSchool.CSchoolClass class_ = School.lstClasses.First(cl => cl.classidentifier == sclass); if (class_!= null) string snumber = ""; do Console.Write("Student number (x to exit): "); snumber = Console.ReadLine(); if (snumber!= "x") Console.Write("Student name: "); string sname = Console.ReadLine(); class_.lststudents.add(new CSchool.CStudent Number = snumber, Name = sname ); while (snumber!= "x"); //if class_!= null //EnterStudents private static void ListStudentsPerClass() Console.Write("Class: "); string sclass = Console.ReadLine(); CSchool.CSchoolClass class_ = School.lstClasses.First(cl => cl.classidentifier == sclass); foreach (CSchool.CStudent student in class_.lststudents) Console.WriteLine(student.Number + "\t" + student.name); //ListStudents #endregion Students per class //class Program 11

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 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 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

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

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: 5 September 2011 TIME: 3½ hours MARKS: 150 ASSESSORS: Prof. P.J. Blignaut & Mr. M.B. Mase MODERATOR: Dr. A. van

More information

CMSC 132, Object-Oriented Programming II Summer Lecture 1:

CMSC 132, Object-Oriented Programming II Summer Lecture 1: CMSC 132, Object-Oriented Programming II Summer 2018 Lecturer: Anwar Mamat Lecture 1: Disclaimer: These notes may be distributed outside this class only with the permission of the Instructor. 1.1 Course

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

Object Oriented Modeling

Object Oriented Modeling Object Oriented Modeling Object oriented modeling is a method that models the characteristics of real or abstract objects from application domain using classes and objects. Objects Software objects are

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

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

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

CIT 590 Homework 6 Fractions

CIT 590 Homework 6 Fractions CIT 590 Homework 6 Fractions Purposes of this assignment: Get you started in Java and Eclipse Get you comfortable using objects in Java Start looking at some common object uses in Java. General Idea of

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

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

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

What property of a C# array indicates its allocated size? What keyword in the base class allows a method to be polymorphic?

What property of a C# array indicates its allocated size? What keyword in the base class allows a method to be polymorphic? What property of a C# array indicates its allocated size? a. Size b. Count c. Length What property of a C# array indicates its allocated size? a. Size b. Count c. Length What keyword in the base class

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

C212 Fall 2010 Final Exam Answers

C212 Fall 2010 Final Exam Answers C212 Fall 2010 Final Exam Answers 1. Here s my code: cat Profile.java class Profile { String input = args[0]; String memory = ""; for (int i = 0; i < input.length(); i++) { char c = input.charat(i); if

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

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

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

Final Exam CS 251, Intermediate Programming December 10, 2014

Final Exam CS 251, Intermediate Programming December 10, 2014 Final Exam CS 251, Intermediate Programming December 10, 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

Lecture 13. Example. Encapsulation. Rational numbers: a number is rational if it can be defined as the ratio between two integers.

Lecture 13. Example. Encapsulation. Rational numbers: a number is rational if it can be defined as the ratio between two integers. Lecture 13 Example Rational numbers: a number is rational if it can be defined as the ratio between two integers Issues in object-oriented programming The class Rational completed Material from Holmes

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

EEE-425 Programming Languages (2013) 1

EEE-425 Programming Languages (2013) 1 2 Namespaces Classes Fields Properties Methods Attributes Events Interfaces (contracts) Methods Properties Events Control Statements if, else, while, for, switch foreach Additional Features Operation Overloading

More information

Programming using C# LECTURE 07. Inheritance IS-A and HAS-A Relationships Overloading and Overriding Polymorphism

Programming using C# LECTURE 07. Inheritance IS-A and HAS-A Relationships Overloading and Overriding Polymorphism Programming using C# LECTURE 07 Inheritance IS-A and HAS-A Relationships Overloading and Overriding Polymorphism What is Inheritance? A relationship between a more general class, called the base class

More information

CS 116. Lab Assignment # 1 1

CS 116. Lab Assignment # 1 1 Points: 2 Submission CS 116 Lab Assignment # 1 1 o Deadline: Friday 02/05 11:59 PM o Submit on Blackboard under assignment Lab1. Please make sure that you click the Submit button and not just Save. Late

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

AIMS Embedded Systems Programming MT 2017

AIMS Embedded Systems Programming MT 2017 AIMS Embedded Systems Programming MT 2017 Object-Oriented Programming with C++ Daniel Kroening University of Oxford, Computer Science Department Version 1.0, 2014 Outline Classes and Objects Constructors

More information

Objectives: Lab Exercise 1 Part 1. Sample Run. Part 2

Objectives: Lab Exercise 1 Part 1. Sample Run. Part 2 Objectives: king Saud University College of Computer &Information Science CSC111 Lab Object I All Sections - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

More information

Lecture 3. COMP1006/1406 (the Java course) Summer M. Jason Hinek Carleton University

Lecture 3. COMP1006/1406 (the Java course) Summer M. Jason Hinek Carleton University Lecture 3 COMP1006/1406 (the Java course) Summer 2014 M. Jason Hinek Carleton University today s agenda assignments 1 (graded) & 2 3 (available now) & 4 (tomorrow) a quick look back primitive data types

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

3. Convert 2E from hexadecimal to decimal. 4. Convert from binary to hexadecimal

3. Convert 2E from hexadecimal to decimal. 4. Convert from binary to hexadecimal APCS A Midterm Review You will have a copy of the one page Java Quick Reference sheet. This is the same reference that will be available to you when you take the AP Computer Science exam. 1. n bits can

More information

Basic Types & User Defined Types

Basic Types & User Defined Types Basic Types & User Defined Types 1. Objectives... 2 2. Built-in Types and Primitive Types... 2 3. Data Aggregates and Type Constructors... 3 4. Constructors... 3 5. User-defined Types and Abstract Data

More information

204111: Computer and Programming

204111: Computer and Programming 204111: Computer and Programming Week 4: Control Structures t Monchai Sopitkamon, Ph.D. Overview Types of control structures Using selection structure Using repetition structure Types of control ol structures

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

Building non-windows applications (programs that only output to the command line and contain no GUI components).

Building non-windows applications (programs that only output to the command line and contain no GUI components). C# and.net (1) Acknowledgements and copyrights: these slides are a result of combination of notes and slides with contributions from: Michael Kiffer, Arthur Bernstein, Philip Lewis, Hanspeter Mφssenbφck,

More information

Review. What is const member data? By what mechanism is const enforced? How do we initialize it? How do we initialize it?

Review. What is const member data? By what mechanism is const enforced? How do we initialize it? How do we initialize it? Review Describe pass-by-value and pass-by-reference Why do we use pass-by-reference? What does the term calling object refer to? What is a const member function? What is a const object? How do we initialize

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

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

// 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

When the above code runs, which type s execute method will be run? When the above code runs, which type s execute method will be run?

When the above code runs, which type s execute method will be run? When the above code runs, which type s execute method will be run? Q1) [4 marks] Type Hierarchy, Polymorphism, Dispatch: Use the type hierarchy given below to answer the questions. Remember that if a method appears in a subclass that has the same signature as a method

More information

Prelim 1 SOLUTION. CS 2110, September 29, 2016, 7:30 PM Total Question Name Loop invariants. Recursion OO Short answer

Prelim 1 SOLUTION. CS 2110, September 29, 2016, 7:30 PM Total Question Name Loop invariants. Recursion OO Short answer Prelim 1 SOLUTION CS 2110, September 29, 2016, 7:30 PM 0 1 2 3 4 5 Total Question Name Loop invariants Recursion OO Short answer Exception handling Max 1 15 15 25 34 10 100 Score Grader 0. Name (1 point)

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

C# Fundamentals. Hans-Wolfgang Loidl School of Mathematical and Computer Sciences, Heriot-Watt University, Edinburgh

C# Fundamentals. Hans-Wolfgang Loidl School of Mathematical and Computer Sciences, Heriot-Watt University, Edinburgh C# Fundamentals Hans-Wolfgang Loidl School of Mathematical and Computer Sciences, Heriot-Watt University, Edinburgh Semester 1 2018/19 H-W. Loidl (Heriot-Watt Univ) F20SC/F21SC 2018/19

More information

Introduction To C#.NET

Introduction To C#.NET Introduction To C#.NET Microsoft.Net was formerly known as Next Generation Windows Services(NGWS).It is a completely new platform for developing the next generation of windows/web applications. However

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

CMSC 331 Second Midterm Exam

CMSC 331 Second Midterm Exam 1 20/ 2 80/ 331 First Midterm Exam 11 November 2003 3 20/ 4 40/ 5 10/ CMSC 331 Second Midterm Exam 6 15/ 7 15/ Name: Student ID#: 200/ You will have seventy-five (75) minutes to complete this closed book

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

Let s get started! You first need to download Visual Studio to edit, compile and run C# programs. Download the community version, its free.

Let s get started! You first need to download Visual Studio to edit, compile and run C# programs. Download the community version, its free. C# Mini Lessons last update May 15,2018 From http://www.onlineprogramminglessons.com These C# mini lessons will teach you all the C# Programming statements you need to know, so you can write 90% of any

More information

COMP 1130 Programming Fundamentals (Javascript Rocks)

COMP 1130 Programming Fundamentals (Javascript Rocks) COMP 1130 Programming Fundamentals (Javascript Rocks) Class Website URL Teacher Contact Information High School Credits Concurrent Enrollment Course Description http://online.projectsocrates.org Mr. Roggenkamp

More information

CSCI 355 LAB #2 Spring 2004

CSCI 355 LAB #2 Spring 2004 CSCI 355 LAB #2 Spring 2004 More Java Objectives: 1. To explore several Unix commands for displaying information about processes. 2. To explore some differences between Java and C++. 3. To write Java applications

More information

Second Exam Computer Programming 326 Dr. St. John Lehman College City University of New York Thursday, 11 November 2010

Second Exam Computer Programming 326 Dr. St. John Lehman College City University of New York Thursday, 11 November 2010 Second Exam Computer Programming 326 Dr. St. John Lehman College City University of New York Thursday, 11 November 2010 NAME (Printed) NAME (Signed) E-mail Exam Rules Show all your work. Your grade will

More information

Account joeacct = new Account (100, new Account (500)); Account joeacct = new Account (100, new Account (500, null));

Account joeacct = new Account (100, new Account (500)); Account joeacct = new Account (100, new Account (500, null)); Exam information 369 students took the exam. Scores ranged from 1 to 20, with a median of 11 and an average of 11.1. There were 40 scores between 15.5 and 20, 180 between 10.5 and 15, 132 between 5.5 and

More information

(3) Some memory that holds a value of a given type. (8) The basic unit of addressing in most computers.

(3) Some memory that holds a value of a given type. (8) The basic unit of addressing in most computers. CS 7A Final Exam - Fall 206 - Final Exam Solutions 2/3/6. Write the number of the definition on the right next to the term it defines. () Defining two functions or operators with the same name but different

More information

IST311 Chapter 8: C# Collections - Index-Sequential Search List & Dictionary PROGRAM

IST311 Chapter 8: C# Collections - Index-Sequential Search List & Dictionary PROGRAM IST311 Chapter 8: C# Collections - Index-Sequential Search List & Dictionary PROGRAM class Program static void Main(string[] args) //create a few employees Employee e1 = new Employee(1111111, "Tiryon",

More information

Final exam. Final exam will be 12 problems, drop any 2. Cumulative up to and including week 14 (emphasis on weeks 9-14: classes & pointers)

Final exam. Final exam will be 12 problems, drop any 2. Cumulative up to and including week 14 (emphasis on weeks 9-14: classes & pointers) Review Final exam Final exam will be 12 problems, drop any 2 Cumulative up to and including week 14 (emphasis on weeks 9-14: classes & pointers) 2 hours exam time, so 12 min per problem (midterm 2 had

More information

Lesson 3: Accepting User Input and Using Different Methods for Output

Lesson 3: Accepting User Input and Using Different Methods for Output Lesson 3: Accepting User Input and Using Different Methods for Output Introduction So far, you have had an overview of the basics in Java. This document will discuss how to put some power in your program

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

Arrays & Classes. Problem Statement and Specifications

Arrays & Classes. Problem Statement and Specifications Arrays & Classes Quick Start Compile step once always make -k baseball8 mkdir labs cd labs Execute step mkdir 8 java Baseball8 cd 8 cp /samples/csc/156/labs/8/*. Submit step emacs Player.java & submit

More information

Tentative Teaching Plan Department of Software Engineering Name of Teacher Dr. Naeem Ahmed Mahoto Course Name Computer Programming

Tentative Teaching Plan Department of Software Engineering Name of Teacher Dr. Naeem Ahmed Mahoto Course Name Computer Programming Mehran University of Engineering Technology, Jamshoro FRM-003/00/QSP-004 Dec, 01, 2001 Tentative Teaching Plan Department of Software Engineering Name of Teacher Dr. Naeem Ahmed Mahoto Course Name Computer

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

AP CS Unit 4: Classes and Objects Programs

AP CS Unit 4: Classes and Objects Programs AP CS Unit 4: Classes and Objects Programs 1. Copy the Bucket class. Make sure it compiles (but you won t be able to run it because it does not have a main method). public class Bucket { private double

More information

Object Oriented Programming COP3330 / CGS5409

Object Oriented Programming COP3330 / CGS5409 Object Oriented Programming COP3330 / CGS5409 Classes & Objects DDU Design Constructors Member Functions & Data Friends and member functions Const modifier Destructors Object -- an encapsulation of data

More information

Connecting to Kdb+ from C# Platforms. AquaQ Analytics Limited

Connecting to Kdb+ from C# Platforms. AquaQ Analytics Limited Connecting to Kdb+ from C# Platforms AquaQ Analytics Limited AquaQ Analytics Limited 2013 Page 1 of 29 Authors This document was prepared by: Danny O Hanlon Paul McCabe Chris Patton Ronan Pairceir Dermot

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

Midterm Exam CS 251, Intermediate Programming March 12, 2014

Midterm Exam CS 251, Intermediate Programming March 12, 2014 Midterm Exam CS 251, Intermediate Programming March 12, 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

Introduction to Programming (Java) 4/12

Introduction to Programming (Java) 4/12 Introduction to Programming (Java) 4/12 Michal Krátký Department of Computer Science Technical University of Ostrava Introduction to Programming (Java) 2008/2009 c 2006 2008 Michal Krátký Introduction

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

Chapter 5 Some useful classes

Chapter 5 Some useful classes Chapter 5 Some useful classes Lesson page 5-1. Numerical wrapper classes Activity 5-1-1 Wrapper-class Integer Question 1. False. A new Integer can be created, but its contents cannot be changed. Question

More information

Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written.

Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written. QUEEN'S UNIVERSITY SCHOOL OF COMPUTING HAND IN Answers Are Recorded on Question Paper CISC124, WINTER TERM, 2012 FINAL EXAMINATION 9am to 12pm, 26 APRIL 2012 Instructor: Alan McLeod If the instructor is

More information

CSCI 355 Lab #2 Spring 2007

CSCI 355 Lab #2 Spring 2007 CSCI 355 Lab #2 Spring 2007 More Java Objectives: 1. To explore several Unix commands for displaying information about processes. 2. To explore some differences between Java and C++. 3. To write Java applications

More information

1.00 Introduction to Computers and Engineering Problem Solving. Final Examination - May 19, 2004

1.00 Introduction to Computers and Engineering Problem Solving. Final Examination - May 19, 2004 1.00 Introduction to Computers and Engineering Problem Solving Final Examination - May 19, 2004 Name: E-mail Address: TA: Section: You have 3 hours to complete this exam. For coding questions, you do not

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

About this exam review

About this exam review Final Exam Review About this exam review I ve prepared an outline of the material covered in class May not be totally complete! Exam may ask about things that were covered in class but not in this review

More information

CO Java SE 8: Fundamentals

CO Java SE 8: Fundamentals CO-83527 Java SE 8: Fundamentals Summary Duration 5 Days Audience Application Developer, Developer, Project Manager, Systems Administrator, Technical Administrator, Technical Consultant and Web Administrator

More information

egrapher Language Reference Manual

egrapher Language Reference Manual egrapher Language Reference Manual Long Long: ll3078@columbia.edu Xinli Jia: xj2191@columbia.edu Jiefu Ying: jy2799@columbia.edu Linnan Wang: lw2645@columbia.edu Darren Chen: dsc2155@columbia.edu 1. Introduction

More information

Page 1 of 16. Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written.

Page 1 of 16. Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written. Page 1 of 16 HAND IN Answers Are Recorded on Question Paper QUEEN'S UNIVERSITY SCHOOL OF COMPUTING CISC212, FALL TERM, 2005 FINAL EXAMINATION 9am to 12noon, 19 DECEMBER 2005 Instructor: Alan McLeod If

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 1214: Object-Oriented Programming

CSC 1214: Object-Oriented Programming CSC 1214: Object-Oriented Programming J. Kizito Makerere University e-mail: jkizito@cis.mak.ac.ug www: http://serval.ug/~jona materials: http://serval.ug/~jona/materials/csc1214 e-learning environment:

More information

CS 117 Programming II, Spring 2018 Dr. Ghriga. Midterm Exam Estimated Time: 2 hours. March 21, DUE DATE: March 28, 2018 at 12:00 PM

CS 117 Programming II, Spring 2018 Dr. Ghriga. Midterm Exam Estimated Time: 2 hours. March 21, DUE DATE: March 28, 2018 at 12:00 PM CS 117 Programming II, Spring 2018 Dr. Ghriga Midterm Exam Estimated Time: 2 hours March 21, 2018 DUE DATE: March 28, 2018 at 12:00 PM INSTRUCTIONS: Do all exercises for a total of 100 points. You are

More information

CS-140 Fall 2017 Test 2 Version A Nov. 29, 2017

CS-140 Fall 2017 Test 2 Version A Nov. 29, 2017 CS-140 Fall 2017 Test 2 Version A Nov. 29, 2017 Name: 1. (10 points) For the following, Check T if the statement is true, the F if the statement is false. (a) T F : An interface defines the list of fields

More information

Language Features. 1. The primitive types int, double, and boolean are part of the AP

Language Features. 1. The primitive types int, double, and boolean are part of the AP Language Features 1. The primitive types int, double, and boolean are part of the AP short, long, byte, char, and float are not in the subset. In particular, students need not be aware that strings are

More information

About This Lecture. Data Abstraction - Interfaces and Implementations. Outline. Object Concepts. Object Class, Protocol and State.

About This Lecture. Data Abstraction - Interfaces and Implementations. Outline. Object Concepts. Object Class, Protocol and State. Revised 01/09/05 About This Lecture Slide # 2 Data Abstraction - Interfaces and Implementations In this lecture we will learn how Java objects and classes can be used to build abstract data types. CMPUT

More information

DM550 Introduction to Programming part 2. Jan Baumbach.

DM550 Introduction to Programming part 2. Jan Baumbach. DM550 Introduction to Programming part 2 Jan Baumbach jan.baumbach@imada.sdu.dk http://www.baumbachlab.net COURSE ORGANIZATION 2 Course Elements Lectures: 10 lectures Find schedule and class rooms in online

More information

13 th Windsor Regional Secondary School Computer Programming Competition

13 th Windsor Regional Secondary School Computer Programming Competition SCHOOL OF COMPUTER SCIENCE 13 th Windsor Regional Secondary School Computer Programming Competition Hosted by The School of Computer Science, University of Windsor WORKSHOP I [ Overview of the Java/Eclipse

More information

A Fraction Class. Using a Fraction class, we can compute the above as: Assignment Objectives

A Fraction Class. Using a Fraction class, we can compute the above as: Assignment Objectives A Fraction Class Assignment Objectives What to Submit Evaluation Individual Work Write a Fraction class that performs exact fraction arithmetic. 1. Practice fundamental methods like equals, tostring, and

More information

I pledge by honor that I will not discuss this exam with anyone until my instructor reviews the exam in the class.

I pledge by honor that I will not discuss this exam with anyone until my instructor reviews the exam in the class. Name: Covers Chapters 1-3 50 mins CSCI 1301 Introduction to Programming Armstrong Atlantic State University Instructor: Dr. Y. Daniel Liang I pledge by honor that I will not discuss this exam with anyone

More information

Java and OOP. Part 3 Extending classes. OOP in Java : W. Milner 2005 : Slide 1

Java and OOP. Part 3 Extending classes. OOP in Java : W. Milner 2005 : Slide 1 Java and OOP Part 3 Extending classes OOP in Java : W. Milner 2005 : Slide 1 Inheritance Suppose we want a version of an existing class, which is slightly different from it. We want to avoid starting again

More information

Java Programming Fundamentals - Day Instructor: Jason Yoon Website:

Java Programming Fundamentals - Day Instructor: Jason Yoon Website: Java Programming Fundamentals - Day 1 07.09.2016 Instructor: Jason Yoon Website: http://mryoon.weebly.com Quick Advice Before We Get Started Java is not the same as javascript! Don t get them confused

More information

ADTs & Classes. An introduction

ADTs & Classes. An introduction ADTs & Classes An introduction Quick review of OOP Object: combination of: data structures (describe object attributes) functions (describe object behaviors) Class: C++ mechanism used to represent an object

More information

ASSIGNMENT 5 Objects, Files, and More Garage Management

ASSIGNMENT 5 Objects, Files, and More Garage Management ASSIGNMENT 5 Objects, Files, and More Garage Management COMP-202B, Winter 2010, All Sections Due: Wednesday, April 14, 2009 (23:55) You MUST do this assignment individually and, unless otherwise specified,

More information

CS506 Web Design & Development Final Term Solved MCQs with Reference

CS506 Web Design & Development Final Term Solved MCQs with Reference with Reference I am student in MCS (Virtual University of Pakistan). All the MCQs are solved by me. I followed the Moaaz pattern in Writing and Layout this document. Because many students are familiar

More information

Index COPYRIGHTED MATERIAL

Index COPYRIGHTED MATERIAL Index COPYRIGHTED MATERIAL Note to the Reader: Throughout this index boldfaced page numbers indicate primary discussions of a topic. Italicized page numbers indicate illustrations. A abstract classes

More information

Creating a Transacted Resource Using System.Transactions (Lab 2) (Visual C#, Visual Basic)

Creating a Transacted Resource Using System.Transactions (Lab 2) (Visual C#, Visual Basic) 1 System.Transactions in Whidbey Creating a Transacted Resource Using System.Transactions (Lab 2) (Visual C#, Visual Basic) For the Visual Basic lab, go to page 17. Objectives After completing this lab,

More information

EE 152 Advanced Programming LAB 7

EE 152 Advanced Programming LAB 7 EE 152 Advanced Programming LAB 7 1) Create a class called Rational for performing arithmetic with fractions. Write a program to test your class. Use integer variables to represent the private data of

More information

3. Java - Language Constructs I

3. Java - Language Constructs I Educational Objectives 3. Java - Language Constructs I Names and Identifiers, Variables, Assignments, Constants, Datatypes, Operations, Evaluation of Expressions, Type Conversions You know the basic blocks

More information

COMP 202 Java in one week

COMP 202 Java in one week COMP 202 Java in one week... Continued CONTENTS: Return to material from previous lecture At-home programming exercises Please Do Ask Questions It's perfectly normal not to understand everything Most of

More information

CHAPTER 7 OBJECTS AND CLASSES

CHAPTER 7 OBJECTS AND CLASSES CHAPTER 7 OBJECTS AND CLASSES OBJECTIVES After completing Objects and Classes, you will be able to: Explain the use of classes in Java for representing structured data. Distinguish between objects and

More information