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.
|
|
- Juniper King
- 5 years ago
- Views:
Transcription
1 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 Biljon 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. Answer the following question on paper. Question 1 (30 minutes) Consider the following class definition for a mortgage loan: SECTION A class CMortgage public decimal LoanAmount get; set; public int Term get; set; public double Rate get; set; 1.1 The monthly payment on a mortgage loan can be calculated according to the formula: M = P(i(1+i) n )/((1+i) n 1) where P = mortgage amount i = Monthly interest rate as fraction, e.g for 1%. n is the term in months. Add a method to the class that will return the monthly payment. (6) 1.2 As the class is defined at the moment, the user is expected to enter the monthly interest rate as a fraction. This means that the class user will have to divide the percentage annual interest rate by 1200 before it can be assigned to the property. Add a private data member for the monthly rate to the class and change the property so that the user will be allowed to enter the interest rate as percentage per year. (4) 1.3 Consider the following implementation of the class in a console application. Complete the missing parts. (9) static void Main(string[] args) //1.3.1 Declare and instantiate Mortgage object... //1.3.2 Read loan amount from keyboard and assign to // LoanAmount property Console.Write("Loan amount : ");... //1.3.3 Read percentage annual interest rate from keyboard and // assign to Rate property Console.Write("Interest rate (% per year) : ");... //1.3.4 Read the term (months) from keyboard and assign to // Term property Console.Write("Term (months) : ");...
2 //1.3.5 Display output Console.WriteLine("Monthly payment : 0:C",...); 2 //Allow user opportunity to read the output Console.WriteLine(); Console.Write("Press any key to exit..."); Console.ReadKey(); 1.4 Change the class definition so that it would not be possible to instantiate objects of the class. (1) 1.5 Add a public abstract method, LumpSumPayment to CMortgage that will allow the user to make a lump sum payment. The method must take a single decimal parameter with the amount that will be paid. The method will not return any value. (3) 1.6 Create a new class, CHomeLoan that will inherit from CMortgage. (2) 1.7 In CHomeLoan, override the method LumpSumPayment of the base class. The method must subtract the paid amount from the loan amount. (3) [28] SECTION B Answer any two of the following three questions by developing the solutions in C#. Make sure that you enter your name, student number and question number for every class in a comment block at the top of the code window. You will not get marks if you do it, but you will lose 3 marks for every question if you don t do it. You might even get zero for the entire test if you don t do it! Make sure that you give appropriate names to all controls and variables. Create a folder on the T-drive in the format Surname_StudentNumber, e.g. Blignaut_ Create all projects, one for each question, in this folder. Question 2 (30 minutes) Develop a Windows forms application as in the example that will allow the user to enter a sentence and then count the number of words in the sentence. You may not use the method Split(). Hint: You can count the words by counting the transitions from space to no-space. [20] Question 3 (30 minutes) Develop a console application that will do a compile-time initialisation and put the following integers in this order in a one-dimensional array, Numbers: 13, 7, 99, 52, 88, 41, 56, 78, 101, 66. Call two methods. The first method should take the array, Numbers, as parameter and return the square roots of the numbers as another array. The second method should return void and take both the original numbers and the square roots as two parallel arrays as parameters and display the original array along with the square roots as in the screen print below. The Main() method of the program is given below, with some parts removed which you must complete:
3 static void Main(string[] args) //Compile-time initialisation of array int[] Numbers =... //Sort the numbers... //Get the square roots double [] SquareRoots = GetSquareRoots(Numbers); //Display the numbers along with the square roots DisplayNumbers(Numbers, SquareRoots); 3 //Allow the user time to read the output Console.Write("\n\n\nPress any key to exit..."); Console.ReadKey(); [20] Question 4 (30 minutes) Consider the scenario of a queue of people waiting to be helped at a counter. This is a typical example of the first-in-first-out principle where the person at the front of the queue is always helped first and the ones coming later are added to the back of the queue. Develop an application that will allow a user to add the names of people to a list box as they arrive at the door. When the first person in the list is helped, his name must be removed from the list, meaning that all the others will move one place up. For some reason or other, a clerical worker in the office needs to list all the people in the queue in alphabetical order. The first person in the queue should not lose his position, even though his name does not appear at the top of the list anymore. 4.1 Develop the form as in the example. 4.2 Declare an array list on form level that will be used to store the names of the people in the queue. Instantiate the array list in the form s constructor. 4.3 Write the click event handler for the Add button. (i) Enter the name of the person (as entered by the user in the text box above) to the list box. (ii) Add the name of the person to the array list. (iii) Clear the text box and put the cursor back in the text box. 4.4 Sort the items in the list box in the click event handler of the Sort button. 4.5 Write the click event handler for the Original order button. Step through the array list and refill the list box. 4.6 Write the click event handler for the Remove first person button. Hint: Sort the people in the queue in the original order first, then remove the first person in both arrays and then sort the list box again if it was sorted before. [20]
4 4 SECTION C Question 5 (90 minutes) Develop an object oriented GUI application that will assist a stock manager to keep track of his stock. There are two types of stock: Capital and consumables. All stock items have a stock code and description. Capital items also have an asset number while the quantity of consumables on hand should be saved. Allow the user to enter several stock items one after the other in any order. When the user clicks on New, all data fields should be cleared to prepare input for a new item. For capital items the Asset number field must be visible and for consumables the Quantity on hand item must be available. A list of items in stock should be available at any time. A possible interface is shown below. 5.1 Develop the class CStock. It must not be possible to instantiate objects of CStock. Declare auto-implemented properties for the StockCode and Description. Besides the basic constructor, make also provision for a constructor that will have parameters with which the stock code and description can be initialised. (11) 5.2 Develop the class CConsumable to inherit from CStock. Declare an auto-implemented property for the quantity on hand. The basic constructor must assign a 0 to this property and a second constructor must use a parameter to initialise the property. (8) 5.3 Develop the class for CCapitalItem to inherit from CStock. Declare an auto-implemented property for the asset number. The basic constructor must assign an empty string to this property and a second constructor must use parameters to initialise all properties in the sub-class and base class. (12) 5.4 Develop the form as in the example above. Note that there is another button Save underneath New. Only one of these two buttons, New and Save, is visible at a time. (4) 5.5 Write the code for the click event handler of the Close button. (1) 5.6 Write code for the CheckedChanged event handlers of the two radio buttons that will set visibility of the labels and text boxes for asset number and quantity on hand as necessary. (5) 5.7 Declare an array list, Stock, on form level and instantiate the array list in the form s Load event handler. This array list will be used to store individual instances of either CConsumable or CCapitalItem. (2) 5.8 Write a method, ClearControls(), to clear all text boxes and uncheck all radio buttons. Put the focus in the text box for stock code. (9) 5.9 Write the code for the click event handler of the New button. Clear the controls, set the visibility of the New and Save buttons to false and true respectively and disable the buttons for List and Remove All. (5) 5.10 Write the code for the click event handler of the Save button. (i) Declare a local object, Item, of CStock. (1) (ii) Depending on which radio button is checked, instantiate Item to be either a CCapitalItem or CConsumable. If it is a CCapitalItem, use the constructor to assign values for the stock code, description and asset number. If it is a CConsumable, use the basic constructor and then assign values to the stock code, description and quantity on hand afterward. (8) (iii) Add the item to the list of stock items. (2) (iv) Set the visibility of the New and Save buttons to true and false respectively. (2) (v) Enable the buttons for List and Remove All. (2) 5.11 Write the code for the click event handler of the Remove all button. If the user confirms, all items must be removed from the array list. (4) 5.12 Write the code for the click event handler of the List button. Use a foreach to step through the array list and then display the stock in a message box as in the example. (9) [85]
5 5 MEMORANDUM Question public decimal Payment() return (decimal)((double)loanamount * (Rate * Math.Pow(1 + Rate, Term)) / (Math.Pow(1 + Rate, Term) - 1)); 1.2 private double drate; public double Rate get return drate; set drate = value / 1200; CMortgage Mortgage = new CHomeLoan(); Mortgage.LoanAmount = decimal.parse(console.readline()); Mortgage.Rate = double.parse(console.readline()); Mortgage.Term = int.parse(console.readline()); Console.WriteLine("Monthly payment : 0:C", Mortgage.Payment()); 1.4 abstract class CMortgage 1.5 public abstract void LumpSumPayment(decimal decamount); 1.6 class CHomeLoan : CMortgage 1.7 public override void LumpSumPayment(decimal decamount) LoanAmount -= decamount;
6 6 Question 2 Design of form File name of form, e.g. CfrmWords All components, excluding labels, have names private void Count1() //Add space to beginning string s = " " + txtsentence.text; //Declare variable int iwords = 0; //Step through characters of the string for (int i = 1; i < s.length; i++) if (s[i - 1] == ' ' && s[i]!= ' ') //Start of new word iwords++; //Display output string smsg = "Number of words : " + iwords.tostring(); MessageBox.Show(sMsg, "WORDS", OK, Info); Question 3 private void btncounts_click(object sender, EventArgs e) Count1(); private static double[] GetSquareRoots(int[] _Numbers ) double[] SquareRoots = new double [_Numbers.Length]; for (int i = 0; i < _Numbers.Length; i++) SquareRoots[i] = Math.Sqrt(_Numbers[i]); return SquareRoots; //GetSquareRoots static private void DisplayNumbers(int[] _Numbers, double[] _SquareRoots ) Console.WriteLine("Numbers\tSquare roots\n\n"); for (int i = 0; i < _Numbers.Length; i++) Console.WriteLine("0,5\t1,8:F3", _Numbers[i], _SquareRoots[i]); //DisplayNumbers static void Main(string[] args) int[] Numbers = 13, 7, 99, 52, 88, 41, 56, 78, 101, 66 ; Array.Sort(Numbers); double [] SquareRoots = GetSquareRoots(Numbers); DisplayNumbers(Numbers, SquareRoots); Console.Write("\n\n\nPress any key to exit..."); Console.ReadKey(); //Main
7 7 Question 4 (22) Design of form File name of form, e.g. CfrmQueue All components, excluding labels, have names public partial class CfrmQueue : Form ArrayList arrlstnames; public CfrmQueue() InitializeComponent(); arrlstnames = new ArrayList(); private void btnadd_click(object sender, EventArgs e) lstbxnames.items.add(txtname.text); arrlstnames.add(txtname.text); txtname.clear(); txtname.focus(); private void btnsort_click(object sender, EventArgs e) lstbxnames.sorted = true; private void SortOriginal() lstbxnames.sorted = false; lstbxnames.items.clear(); foreach (string sname in arrlstnames) lstbxnames.items.add(sname); private void btnoriginal_click(object sender, EventArgs e) SortOriginal(); private void btnremove_click(object sender, EventArgs e) if (lstbxnames.items.count > 0) bool issorted = lstbxnames.sorted; SortOriginal(); lstbxnames.items.removeat(0); arrlstnames.removeat(0); lstbxnames.sorted = issorted;
8 8 Question abstract class CStock public string StockCode get; set; public string Description get; set; public CStock() public CStock(string _sstockcode, string _sdescription ) StockCode = _sstockcode; Description = _sdescription; 5.2 class CConsumable : CStock public int QuantityOnHand get; set; public CConsumable() QuantityOnHand = 0; //CConsumable public CConsumable(int _iquantityonhand) QuantityOnHand = _iquantityonhand; //CConsumable 5.3 class CCapitalItem : CStock public string AssetNumber get; set; public CCapitalItem() AssetNumber = ""; public CCapitalItem(string _sstockcode, string _sdescription, string _sassetnumber ) StockCode = _sstockcode; Description = _sdescription; AssetNumber = _sassetnumber; 5.4 Design of form File name of form, e.g. CfrmStock All components, excluding labels, have names 5.5 private void btnclose_click(object sender, EventArgs e) this.close(); //btnclose_click
9 5.6 private void radcapital_checkedchanged(object sender, EventArgs e) lblassetnumber.visible = radcapital.checked; txtassetnumber.visible = radcapital.checked; lblquantityonhand.visible = radconsumable.checked; txtquantityonhand.visible = radconsumable.checked; //radcapital_checkedchanged Call this for both radio buttons. 5.7 ArrayList Stock; private void frmstock_load(object sender, EventArgs e) Stock = new ArrayList(); 5.8 private void ClearControls() txtstockcode.clear(); txtdescription.clear(); txtassetnumber.clear(); txtquantityonhand.text = "0"; radcapital.checked = false; radconsumable.checked = false; txtstockcode.focus(); //ClearControls 5.9 private void btnnew_click(object sender, EventArgs e) ClearControls(); btnnew.visible = false; btnsave.visible = true; btnlist.enabled = false; btnclearlist.enabled = false; private void btnsave_click(object sender, EventArgs e) CStock Item; if (radcapital.checked) Item = new CCapitalItem(txtStockCode.Text, txtdescription.text, txtassetnumber.text); else Item = new CConsumable(); Item.StockCode = txtstockcode.text; Item.Description = txtdescription.text; ((CConsumable)Item).QuantityOnHand = int.parse(txtquantityonhand.text); Stock.Add(Item); btnnew.visible = true; btnsave.visible = false; btnlist.enabled = true; btnclearlist.enabled = true;
10 5.11 private void btnclearlist_click(object sender, EventArgs e) if (MessageBox.Show("Sure you want to remove all items in stock?", "CONFIRM REMOVE", MessageBoxButtons.YesNo) == DialogResult.Yes) Stock.Clear(); //btnclearlist_click private void btnlist_click(object sender, EventArgs e) string s = "Code\tDescription\tAsset no/qty\n" + "====\t=========\t========\n\n"; foreach (CStock Item in Stock) s += Item.StockCode + "\t" + Item.Description; if (Item is CCapitalItem) s += "\t" + ((CCapitalItem)Item).AssetNumber + " (Capital item) \n"; else s += "\t" + ((CConsumable)Item).QuantityOnHand.ToString() + " (Consumable) \n"; MessageBox.Show(s, "Stock list"); //btnlist_click
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 informationUNIVERSITY 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 informationThis 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 informationUNIVERSITY 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 informationUNIVERSITY 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 informationUNIVERSITY 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 informationCSIS 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 informationUNIVERSITY 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 informationUNIVERSITY 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(b) This is a valid identifier in Java: _T_R-U_E_. (c) This is a valid identifier in Java: _F_A_L_$_E_
ComS 207: Programming I Midterm 1, Tue. Sep 19, 2006 Student Name: Student ID Number: Recitation Section: 1. True/False Questions (10 x 1p each = 10p) (a) ComS 207 Rocks! (b) This is a valid identifier
More informationUNIVERSITY 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 informationUNIVERSITY 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 informationGrouping Objects. Primitive Arrays and Iteration. Produced by: Dr. Siobhán Drohan. Department of Computing and Mathematics
Grouping Objects Primitive Arrays and Iteration Produced by: Dr. Siobhán Drohan Department of Computing and Mathematics http://www.wit.ie/ Topic List Primitive arrays Why do we need them? What are they?
More informationIntroduction 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 informationRIS214. 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 informationThe first program we write will display a picture on a Windows screen, with buttons to make the picture appear and disappear.
4 Programming with C#.NET 1 Camera The first program we write will display a picture on a Windows screen, with buttons to make the picture appear and disappear. Begin by loading Microsoft Visual Studio
More informationDistributed 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 informationCheck out how to use the random number generator (introduced in section 4.11 of the text) to get a number between 1 and 6 to create the simulation.
Chapter 4 Lab Loops and Files Lab Objectives Be able to convert an algorithm using control structures into Java Be able to write a while loop Be able to write an do-while loop Be able to write a for loop
More informationClasses 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 informationFinal 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 informationData dependent execution order data dependent control flow
Chapter 5 Data dependent execution order data dependent control flow The method of an object processes data using statements, e.g., for assignment of values to variables and for in- and output. The execution
More informationObjects and Classes. Engineering 1D04, Teaching Session 9
Objects and Classes Engineering 1D04, Teaching Session 9 Recap - Classes & Objects class hsrecord public string name; public int score; hsrecord myref; myref = new hsrecord(); Class declaration defines
More informationAPCS Semester #1 Final Exam Practice Problems
Name: Date: Per: AP Computer Science, Mr. Ferraro APCS Semester #1 Final Exam Practice Problems The problems here are to get you thinking about topics we ve visited thus far in preparation for the semester
More informationFaculty 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 informationFunctions. Arash Rafiey. September 26, 2017
September 26, 2017 are the basic building blocks of a C program. are the basic building blocks of a C program. A function can be defined as a set of instructions to perform a specific task. are the basic
More informationC# 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 informationLab - 1. Solution : 1. // Building a Simple Console Application. class HelloCsharp. static void Main() System.Console.WriteLine ("Hello from C#.
Lab - 1 Solution : 1 // Building a Simple Console Application class HelloCsharp static void Main() System.Console.WriteLine ("Hello from C#."); Solution: 2 & 3 // Building a WPF Application // Verifying
More informationCS 1063 Introduction to Computer Programming Midterm Exam 2 Section 1 Sample Exam
Seat Number Name CS 1063 Introduction to Computer Programming Midterm Exam 2 Section 1 Sample Exam This is a closed book exam. Answer all of the questions on the question paper in the space provided. If
More informationObject 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 informationMemorandum. 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 informationProgramming Problems 22nd Annual Computer Science Programming Contest
Programming Problems 22nd Annual Computer Science Programming Contest Department of Mathematics and Computer Science Western Carolina University 5 April 2011 Problem One: Add Times Represent a time by
More informationUsing Numbers, Formulas, and Functions
UNIT FOUR: Using Numbers, Formulas, and Functions T o p i c s : Using the Sort function Create a one-input data table Hide columns Resize columns Calculate with formulas Explore functions I. Using the
More informationDuhok 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 informationUNIVERSITY 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 informationExcel 2013 Part 2. 2) Creating Different Charts
Excel 2013 Part 2 1) Create a Chart (review) Open Budget.xlsx from Documents folder. Then highlight the range from C5 to L8. Click on the Insert Tab on the Ribbon. From the Charts click on the dialogue
More informationMidterm 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 informationImperative and Object Oriented Programming. Tutorial 1. Charlie Abela Department of Artificial Intelligence
Imperative and Object Oriented Programming Tutorial 1 Department of Artificial Intelligence charlie.abela@um.edu.mt Tutorial 1 In this tutorial you will be using the BlueJ IDE to develop java classes.
More informationBoxPrint and Console Input Verifiers
* Dynamic Memory *Big O Notation*Stacks *Extreme Programming*Selection Sort*Insertion Sort*Waterfall Model String*Arrays*ArrayList*Client Server*Artificial Intelligence*Inheritance*Files*Video Games*Short
More informationYou can call the project anything you like I will be calling this one project slide show.
C# Tutorial Load all images from a folder Slide Show In this tutorial we will see how to create a C# slide show where you load everything from a single folder and view them through a timer. This exercise
More informationIntroduction to Computation and Problem Solving
Class 13: Inheritance and Interfaces Introduction to Computation and Problem Solving Prof. Steven R. Lerman and Dr. V. Judson Harward 2 More on Abstract Classes Classes can be very general at the top of
More informationDistributed 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 informationClass 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 informationJava for Non Majors. Final Study Guide. April 26, You will have an opportunity to earn 20 extra credit points.
Java for Non Majors Final Study Guide April 26, 2017 The test consists of 1. Multiple choice questions 2. Given code, find the output 3. Code writing questions 4. Code debugging question 5. Short answer
More informationJava 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 informationQuick 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 informationMedical Office System Chapter 18: Calculator
Chapter 18: Calculator This chapter discusses Accessing the Calculator! the calculator program incorporated into the MOS system.! the business and general math functions.! the arithmetic functions.! amortization
More informationPOLYTECHNIC OF NAMIBIA SCHOOL OF COMPUTING AND INFORMATICS DEPARTMENT OF COMPUTER SCIENCE
/. POLYTECHNIC OF NAMIBIA SCHOOL OF COMPUTING AND INFORMATICS DEPARTMENT OF COMPUTER SCIENCE COUR ENAME: PROGRAMMING 1 COUR ECODE: PRGSlOS NQFLEVEL: 5 DATE: JUNE 20 15 DURATION: 2HOURS MARKS: 100 PAPER:
More informationObjects 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 informationYour First Windows Form
Your First Windows Form From now on, we re going to be creating Windows Forms Applications, rather than Console Applications. Windows Forms Applications make use of something called a Form. The Form is
More informationIntroduction 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 informationProblem Grade Total
CS 101, Prof. Loftin: Final Exam, May 11, 2009 Name: All your work should be done on the pages provided. Scratch paper is available, but you should present everything which is to be graded on the pages
More informationEngr 123 April 25, 2018 Final Exam Review. 3. Write a method which will accept a string and return the number of three-letter words in the string.
Engr 123 April 25, 2018 Final Exam Review Final Exam is Monday April 30, 2018 at 8:00am 1. Write a method named EvenOdd which will accept a string and a bool as arguments. If the bool is true the method
More informationClass Test 4. Question 1. Use notepad to create a console application that displays a stick figure. See figure 1. Question 2
Class Test 4 Marks will be deducted for each of the following: -5 for each class/program that does not contain your name and student number at the top. -2 If program is named anything other than Question1,
More informationJava Identifiers, Data Types & Variables
Java Identifiers, Data Types & Variables 1. Java Identifiers: Identifiers are name given to a class, variable or a method. public class TestingShastra { //TestingShastra is an identifier for class char
More informationMidterm Exam CS 251, Intermediate Programming March 6, 2015
Midterm Exam CS 251, Intermediate Programming March 6, 2015 Name: NetID: Answer all questions in the space provided. Write clearly and legibly, you will not get credit for illegible or incomprehensible
More informationIntroduction to Object Oriented Systems Development. Practical Session (Week 2)
This practical session consists of three parts. Practical Session (Week 2) Part 1 (Tutorial). Starting with NetBeans In this module, we will use NetBeans IDE (Integrated Development Environment) for Java
More informationC# 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 informationCS 520 Theory and Practice of Software Engineering Fall 2017
CS 520 Theory and Practice of Software Engineering Fall 2017 OO design patterns September 28, 2017 Logistics Homework 1 deadline: 10/17/2017. Paper reading 1 (Practical guide to statistical tests) deadline:
More informationCS170 Introduction to Computer Science Midterm 2
CS170 Introduction to Computer Science Midterm 2 03/25/2009 Name: Solution You are to honor the Emory Honor Code. This is a closed book and closednotes exam, and you are not to use any other resource than
More informationPROGRAMMING IN C AND C++:
PROGRAMMING IN C AND C++: Week 1 1. Introductions 2. Using Dos commands, make a directory: C:\users\YearOfJoining\Sectionx\USERNAME\CS101 3. Getting started with Visual C++. 4. Write a program to print
More informationRules and syntax for inheritance. The boring stuff
Rules and syntax for inheritance The boring stuff The compiler adds a call to super() Unless you explicitly call the constructor of the superclass, using super(), the compiler will add such a call for
More informationAdvanced Systems Programming
Advanced Systems Programming Introduction to C++ Martin Küttler September 19, 2017 1 / 18 About this presentation This presentation is not about learning programming or every C++ feature. It is a short
More informationIntroduction to Computer Science Unit 2. Notes
Introduction to Computer Science Unit 2. Notes Name: Objectives: By the completion of this packet, students should be able to describe the difference between.java and.class files and the JVM. create and
More informationMicrosoft Excel 2016 LEVEL 2
TECH TUTOR ONE-ON-ONE COMPUTER HELP COMPUTER CLASSES Microsoft Excel 2016 LEVEL 2 kcls.org/techtutor Microsoft Excel 2016 Level 2 Manual Rev 11/2017 instruction@kcls.org Microsoft Excel 2016 Level 2 Welcome
More informationDepartment 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 informationDo not start the test until instructed to do so!
CS 1054: Programming in Java Page 1 of 6 Form A READ THIS NOW! Failure to read and follow the instructions below may result in severe penalties Failure to adhere to these directions will not constitute
More informationMore About Classes CS 1025 Computer Science Fundamentals I Stephen M. Watt University of Western Ontario
More About Classes CS 1025 Computer Science Fundamentals I Stephen M. Watt University of Western Ontario The Story So Far... Classes as collections of fields and methods. Methods can access fields, and
More informationCIS133J. Working with Numbers in Java
CIS133J Working with Numbers in Java Contents: Using variables with integral numbers Using variables with floating point numbers How to declare integral variables How to declare floating point variables
More informationEXAMINATION FOR THE BSC (HONS) INFORMATION TECHNOLOGY; BSC (HONS) INFORMATION SYSTEMS & BSC (HONS) COMPUTER SCIENCE; YEAR 1
FACULTY OF SCIENCE AND TECHNOLOGY EXAMINATION FOR THE BSC (HONS) INFORMATION TECHNOLOGY; BSC (HONS) INFORMATION SYSTEMS & BSC (HONS) COMPUTER SCIENCE; YEAR 1 ACADEMIC SESSION 2014; SEMESTER 2 PRG1203:
More information3.Constructors and Destructors. Develop cpp program to implement constructor and destructor.
3.Constructors and Destructors Develop cpp program to implement constructor and destructor. Constructors A constructor is a special member function whose task is to initialize the objects of its class.
More informationClass Test 4. Question 1. Use notepad to create a console application that displays a face. See figure 1. Figure 1. Question2
Class Test 4 Marks will be deducted for the following: -2 If the program is named anything other than Question1,2 etc. -5 if the program does not contain your name & student number at the top. Question
More informationMemorandum 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 informationEL-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 informationMore 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 informationDOING MORE WITH EXCEL: MICROSOFT OFFICE 2013
DOING MORE WITH EXCEL: MICROSOFT OFFICE 2013 GETTING STARTED PAGE 02 Prerequisites What You Will Learn MORE TASKS IN MICROSOFT EXCEL PAGE 03 Cutting, Copying, and Pasting Data Basic Formulas Filling Data
More informationIT 374 C# and Applications/ IT695 C# Data Structures
IT 374 C# and Applications/ IT695 C# Data Structures Module 2.1: Introduction to C# App Programming Xianrong (Shawn) Zheng Spring 2017 1 Outline Introduction Creating a Simple App String Interpolation
More informationVisual Basic/C# Programming (330)
Page 1 of 12 Visual Basic/C# Programming (330) REGIONAL 2017 Production Portion: Program 1: Calendar Analysis (400 points) TOTAL POINTS (400 points) Judge/Graders: Please double check and verify all scores
More informationInheritance and Interfaces
Inheritance and Interfaces Object Orientated Programming in Java Benjamin Kenwright Outline Review What is Inheritance? Why we need Inheritance? Syntax, Formatting,.. What is an Interface? Today s Practical
More informationJava Programming Lecture 7
Java Programming Lecture 7 Alice E. Fischer Feb 16, 2015 Java Programming - L7... 1/16 Class Derivation Interfaces Examples Java Programming - L7... 2/16 Purpose of Derivation Class derivation is used
More information1 Method Signatures and Overloading (3 minutes, 2 points)
CS180 Spring 2010 Exam 1 Solutions, 15 February, 2010 Prof. Chris Clifton Turn Off Your Cell Phone. Use of any electronic device during the test is prohibited. Time will be tight. If you spend more than
More informationCSE 142 Su 04 Computer Programming 1 - Java. Objects
Objects Objects have state and behavior. State is maintained in instance variables which live as long as the object does. Behavior is implemented in methods, which can be called by other objects to request
More informationPOLYTECHNIC OF NAMIBIA SCHOOL OF COMPUTING AND INFORMATICS DEPARTMENT OF COMPUTER SCIENCE
POLYTECHNIC OF NAMIBIA SCHOOL OF COMPUTING AND INFORMATICS DEPARTMENT OF COMPUTER SCIENCE COURSE NAME: OBJECT ORIENTED PROGRAMMING COURSE CODE: OOP521S NQF LEVEL: 6 DATE: NOVEMBER 2015 DURATION: 2 HOURS
More informationMore 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 informationExcel Tips. Contents. By Dick Evans
Excel Tips By Dick Evans Contents Pasting Data into an Excel Worksheet... 2 Divide by Zero Errors... 2 Creating a Dropdown List... 2 Using the Built In Dropdown List... 3 Entering Data with Forms... 4
More informationLAB: WHILE LOOPS IN C++
LAB: WHILE LOOPS IN C++ MODULE 2 JEFFREY A. STONE and TRICIA K. CLARK COPYRIGHT 2014 VERSION 4.0 PALMS MODULE 2 LAB: WHILE LOOPS IN C++ 2 Introduction This lab will provide students with an introduction
More informationObject-oriented Programming and Software Engineering CITS1001. Multiple-choice Mid-semester Test
Object-oriented Programming and Software Engineering CITS1001 Multiple-choice Mid-semester Test Semester 1, 2015 Mark your solutions on the provided answer page, by filling in the appropriate circles.
More informationThe JFrame Class Frame Windows GRAPHICAL USER INTERFACES. Five steps to displaying a frame: 1) Construct an object of the JFrame class
CHAPTER GRAPHICAL USER INTERFACES 10 Slides by Donald W. Smith TechNeTrain.com Final Draft 10/30/11 10.1 Frame Windows Java provides classes to create graphical applications that can run on any major graphical
More informationCS111: PROGRAMMING LANGUAGE II
1 CS111: PROGRAMMING LANGUAGE II Computer Science Department Lecture 1: Introduction Lecture Contents 2 Course info Why programming?? Why Java?? Write once, run anywhere!! Java basics Input/output Variables
More informationProgramming Basics. Digital Urban Visualization. People as Flows. ia
Programming Basics Digital Urban Visualization. People as Flows. 28.09.2015 ia zuend@arch.ethz.ch treyer@arch.ethz.ch Programming? Programming is the interaction between the programmer and the computer.
More informationCIS 3260 Intro. to Programming with C#
Running Your First Program in Visual C# 2008 McGraw-Hill 2010 The McGraw-Hill Companies, Inc. All rights reserved. Run Visual Studio Start a New Project Select File/New/Project Visual C# and Windows must
More informationString sequence of characters string Unicode Characters immutable they cannot be changed after they have been created.
String A string is basically a sequence of characters A string in C# is an object of type String The string type represents a string of Unicode Characters. String objects are immutable that is they cannot
More informationJava: Classes. An instance of a class is an object based on the class. Creation of an instance from a class is called instantiation.
Java: Classes Introduction A class defines the abstract characteristics of a thing (object), including its attributes and what it can do. Every Java program is composed of at least one class. From a programming
More informationProblem Solving through Programming In C Prof. Anupam Basu Department of Computer Science & Engineering Indian Institute of Technology, Kharagpur
Problem Solving through Programming In C Prof. Anupam Basu Department of Computer Science & Engineering Indian Institute of Technology, Kharagpur Lecture 18 Switch Statement (Contd.) And Introduction to
More informationProgramming 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 informationINTRODUCTION TO SOFTWARE SYSTEMS (COMP1110/COMP1140/COMP1510/COMP6710)
Important notice: This document is a sample exam. The final exam will differ from this exam in numerous ways. The purpose of this sample exam is to provide students with access to an exam written in a
More informationSolution to Test of Computer Science 203x Level Score: / 100 Time: 100 Minutes
Solution to Test of Computer Science 203x Level Score: / 100 Time: 100 Minutes PART I: Multiple Choice (3 points each) Note: The correct answer can be any combination of A, B, C, D. Example, Sample Question:
More informationCE221 Programming in C++ Part 1 Introduction
CE221 Programming in C++ Part 1 Introduction 06/10/2017 CE221 Part 1 1 Module Schedule There are two lectures (Monday 13.00-13.50 and Tuesday 11.00-11.50) each week in the autumn term, and a 2-hour lab
More informationPractice 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 informationObject Oriented Programming 2015/16. Final Exam June 28, 2016
Object Oriented Programming 2015/16 Final Exam June 28, 2016 Directions (read carefully): CLEARLY print your name and ID on every page. The exam contains 8 pages divided into 4 parts. Make sure you have
More information1. Data types ( =13 points)
Software Development I Univ.-Prof. Dr. Alois Ferscha Examination, January 27, 2015 Last name: SAMPLE SOLUTION First name: Institute for Pervasive Computing Lecture hall: Seat: ID: SKZ: Points / Grade:
More information