March 2005 1R. Smith - University of St Thomas - Minnesota QMCS 230: Today in Class Tomorrow’s ExamTomorrow’s Exam Today’s LabToday’s Lab SortingSorting.

Slides:



Advertisements
Similar presentations
March R. Smith - University of St Thomas - Minnesota Today’s Class Quiz RecapQuiz Recap Exam ReviewExam Review C MaterialC Material Matlab MaterialMatlab.
Advertisements

Written by: Dr. JJ Shepherd
March R. Smith - University of St Thomas - Minnesota QMCS 230: Today in Class ProjectsProjects 2 dimensional arrays2 dimensional arrays Higher dimensionsHigher.
March /18R. Smith - University of St Thomas - Minnesota QMCS 230: Today in Class Three exam questionsThree exam questions Lab with filesLab with.
March /18R. Smith - University of St Thomas - Minnesota QMCS 230: Today in Class Reading numbers from dialogsReading numbers from dialogs Converting.
March R. Smith - University of St Thomas - Minnesota QMCS 230: Today in Class AdministrativeAdministrative –Project proposals –This week’s lab Notes.
March R. Smith - University of St Thomas - Minnesota QMCS 230: Today in Class Lab 16Lab 16 Filling in an arrayFilling in an array Searching for a.
March R. Smith - University of St Thomas - Minnesota QMCS 130: Today’s Class More about FunctionsMore about Functions RecursionRecursion.
March /18R. Smith - University of St Thomas - Minnesota QMCS 230: Today in Class IF StatementIF Statement Revisiting assignment statementsRevisiting.
March /18R. Smith - University of St Thomas - Minnesota QMCS 230: Today in Class Hard Drives – more laterHard Drives – more later MethodsMethods.
March R. Smith - University of St Thomas - Minnesota QMCS 130: Today’s Class Exam TopicsExam Topics.
March /18R. Smith - University of St Thomas - Minnesota QMCS 230: Today in Class The project assignment, againThe project assignment, again Arrays.
March R. Smith - University of St Thomas - Minnesota QMCS 130: Today’s Class Functions and Array ArgumentsFunctions and Array Arguments ExamExam.
March R. Smith - University of St Thomas - Minnesota ENGR 330: Today’s Class Class on Wednesday – “Lab time” in OSS 230Class on Wednesday – “Lab.
March R. Smith - University of St Thomas - Minnesota Today’s Class RecapRecap More course thingsMore course things Work on labs/projectsWork on labs/projects.
March R. Smith - University of St Thomas - Minnesota QMCS 130: Today’s Class GradingGrading The examThe exam Sorting arraysSorting arrays Pointers,
Spring R. Smith - University of St Thomas - Minnesota QMCS 130: Today’s Class Where we areWhere we are Strings and TextStrings and Text ConditionalsConditionals.
Spring R. Smith - University of St Thomas - Minnesota QMCS 130: Today’s Class Final Exam ReviewFinal Exam Review –Assessment –Exam Format –C –Matlab.
March R. Smith - University of St Thomas - Minnesota QMCS 130: Today’s Class Exam StatusExam Status Recap of Lab 7 ExampleRecap of Lab 7 Example.
March /18R. Smith - University of St Thomas - Minnesota QMCS 230: Today in Class I/O ObjectsI/O Objects Lab 12Lab 12.
March R. Smith - University of St Thomas - Minnesota QMCS 230: Today in Class Today’s LabToday’s Lab SortingSorting.
March /18R. Smith - University of St Thomas - Minnesota QMCS 230: Today in Class Reviewing previous workReviewing previous work Using a dialog boxUsing.
C#.NET C# language. C# A modern, general-purpose object-oriented language Part of the.NET family of languages ECMA standard Based on C and C++
March /18R. Smith - University of St Thomas - Minnesota QMCS 230: Today in Class End of Chapter 2: READ Section 2.15End of Chapter 2: READ Section.
March /18R. Smith - University of St Thomas - Minnesota QMCS 230: Today in Class HomeworkHomework Nested LoopsNested Loops Other thingsOther things.
March /18R. Smith - University of St Thomas - Minnesota QMCS 230: Today in Class Class projectsClass projects Lab 13: Use the method documentation.
March /18R. Smith - University of St Thomas - Minnesota QMCS 230 – Today in Class Getting Homework BackGetting Homework Back DecimalFormat class.
6/22/2015 1R. Smith - University of St Thomas - Minnesota QMCS Class Today St. Lukes Case StudySt. Lukes Case Study.
Spring R. Smith - University of St Thomas - Minnesota QMCS 130: Today’s Class Return HomeworkReturn Homework Class ScheduleClass Schedule Functions:
Loops – While, Do, For Repetition Statements Introduction to Arrays
March /18R. Smith - University of St Thomas - Minnesota QMCS 230: Today in Class Exam ReviewExam Review Arithmetic - I think everyone gets thisArithmetic.
March R. Smith - University of St Thomas - Minnesota QMCS 130: Today’s Class Upcoming Exam – April 8Upcoming Exam – April 8 Structures ReviewStructures.
March R. Smith - University of St Thomas - Minnesota QMCS Class Today Cryptography – introductory termsCryptography – introductory terms “Enigma”
March R. Smith - University of St Thomas - Minnesota QMCS 230: Today in Class Rest of semesterRest of semester –More on strings (Chapter 10) –More.
March R. Smith - University of St Thomas - Minnesota QMCS 130: Today’s Class RecapRecap Functions and CFunctions and C Using FunctionsUsing Functions.
March /18R. Smith - University of St Thomas - Minnesota QMCS 230: Today in Class MethodsMethods Problem solving by decompositionProblem solving by.
March R. Smith - University of St Thomas - Minnesota Today’s Class Lab 1 commentsLab 1 comments Data Types in Chapter 4Data Types in Chapter 4 Lab.
March /18R. Smith - University of St Thomas - Minnesota QMCS 230: Today in Class Nested IFNested IF “Boolean” Logical Operations“Boolean” Logical.
March R. Smith - University of St Thomas - Minnesota QMCS 130: Today’s Class Lab Status, Paper StatusLab Status, Paper Status Comments on Ints vs.
March /18R. Smith - University of St Thomas - Minnesota QMCS 230: Today in Class Random NumbersRandom Numbers Output filesOutput files Input filesInput.
6/28/2015 1R. Smith - University of St Thomas - Minnesota CISC 130: Today’s Class History Paper recapHistory Paper recap Finish the movieFinish the movie.
March R. Smith - University of St Thomas - Minnesota QMCS 130: Today’s Class Data IndependenceData Independence Matlab #3: Exercise 5.1Matlab #3:
March R. Smith - University of St Thomas - Minnesota QMCS 230: Today in Class Buttons: Radio and Check BoxButtons: Radio and Check Box Lab 20Lab.
Computer Science II Exam I Review Monday, February 6, 2006.
March R. Smith - University of St Thomas - Minnesota QMCS 130: Today’s Class StatusStatus –Survey –Returning homework ArraysArrays –What are they?
March R. Smith - University of St Thomas - Minnesota QMCS 130: Today’s Class Finish up Lab 13Finish up Lab 13 Lab 14 – DetailsLab 14 – Details.
March R. Smith - University of St Thomas - Minnesota QMCS 130: Today’s Class The examThe exam –Open book, no notes, like last time Exam TopicsExam.
March R. Smith - University of St Thomas - Minnesota ENGR 330: Today’s Class Administrative: do you want another lab?Administrative: do you want.
March R. Smith - University of St Thomas - Minnesota QMCS 130: Today’s Class Matlab “Matrix Laboratory”Matlab “Matrix Laboratory” Chapter 1 – matrices.
March /18R. Smith - University of St Thomas - Minnesota QMCS 230: Today in Class About HomeworkAbout Homework Increment/DecrementIncrement/Decrement.
March R. Smith - University of St Thomas - Minnesota QMCS 130: Today’s Class Homework & GradesHomework & Grades Multiple DimensionsMultiple Dimensions.
March R. Smith - University of St Thomas - Minnesota Today’s Class Homework NotesHomework Notes –Always try to match the printed output if I give.
March /18R. Smith - University of St Thomas - Minnesota QMCS 230: Today in Class Change in order of topicsChange in order of topics –Starting Chapter.
March /18R. Smith - University of St Thomas - Minnesota QMCS 230: Today in Class More LoopsMore Loops Do While – a ‘trailing decision’ loopDo While.
March R. Smith - University of St Thomas - Minnesota QMCS 130: Today’s Class Nested For loopsNested For loops IF StatementsIF Statements Else StatementElse.
March /18R. Smith - University of St Thomas - Minnesota QMCS 230: Today in Class The ExamThe Exam Homework NotesHomework Notes.
March R. Smith - University of St Thomas - Minnesota QMCS 230: Today in Class Peek at Lab 16Peek at Lab 16 Side effects and arraysSide effects and.
9/21/2015 1R. Smith - University of St Thomas - Minnesota CISC 130: Today’s Class RecapRecap Files, writing filesFiles, writing files 1D Array Recap1D.
By Nicholas Policelli An Introduction to Java. Basic Program Structure public class ClassName { public static void main(String[] args) { program statements.
An Object-Oriented Approach to Programming Logic and Design Chapter 3 Using Methods and Parameters.
March R. Smith - University of St Thomas - Minnesota QMCS 130: Today’s Class Grades & Lab 12Grades & Lab 12 Upcoming ExamUpcoming Exam StructuresStructures.
March R. Smith - University of St Thomas - Minnesota QMCS Class Today “Enigma” recap and finish“Enigma” recap and finish The quiz/surveyThe.
March /18R. Smith - University of St Thomas - Minnesota QMCS 230: Today in Class A note on methodsA note on methods ObjectsObjects Creating your.
1/28/2016 1R. Smith - University of St Thomas - Minnesota CISC 130: Today’s Class Assignments 7 and 8Assignments 7 and 8 ExamExam History Paper AssignmentHistory.
Written by: Dr. JJ Shepherd
Two Dimensional Arrays Found in chapter 8, Section 8.9.
2/22/2016 1R. Smith - University of St Thomas - Minnesota CISC 130: Today’s Class History Paper scheduleHistory Paper schedule RecapRecap Plus PlusPlus.
March /18R. Smith - University of St Thomas - Minnesota QMCS 230: Today in Class What’s on the Exam Next Week?What’s on the Exam Next Week? Lab 8Lab.
Basic Class Structure. Class vs. Object class - a template for building an object –defines the instance data that the object will hold –defines instance.
7/6/2016 1R. Smith - University of St Thomas - Minnesota CISC 130: Today’s Class Collect PapersCollect Papers Review: Our ZeroesReview: Our Zeroes Review:
Presentation transcript:

March R. Smith - University of St Thomas - Minnesota QMCS 230: Today in Class Tomorrow’s ExamTomorrow’s Exam Today’s LabToday’s Lab SortingSorting

March R. Smith - University of St Thomas - Minnesota Exam Chapter – I/OChapter – I/O Chapter 5 – MethodsChapter 5 – Methods Chapter 6 – Classes and ObjectsChapter 6 – Classes and Objects Chapter 8 – ArraysChapter 8 – Arrays No long programs – a few statements at mostNo long programs – a few statements at most Reading programs – what happens?Reading programs – what happens? Open Book, Open Notes.Open Book, Open Notes.

March R. Smith - University of St Thomas - Minnesota Chapter – I/O Role of the different classes and objectsRole of the different classes and objects –File, Scanner –FileWriter, PrintWriter Testing for a file’s existenceTesting for a file’s existence Reading until end of fileReading until end of file Throws clauseThrows clause

March R. Smith - University of St Thomas - Minnesota Chapter 5 – Methods Calling a methodCalling a method –With or without arguments –What kinds of arguments can we pass? Void vs. value-returning methodsVoid vs. value-returning methods –Calling with/without a value returned –What sorts of values can be returned? Arguments and “side effects”Arguments and “side effects” –What happens when we change an argument? –Primitive vs reference variables Strings vs arraysStrings vs arrays

March R. Smith - University of St Thomas - Minnesota Declaring a method Mostly we’ve declared the main methodMostly we’ve declared the main method Two situationsTwo situations –Method that stands alone Public static Public static –Method that’s tied to an object Public Public Local variablesLocal variables –Similar to parameters – just exist in the method –Defined locally, results are all local –A “new” will be preserved –Results should be returned via RETURN statement Throwing exceptionsThrowing exceptions

March R. Smith - University of St Thomas - Minnesota Chapter 6 – Classes and Objects Class – a ‘template’ for an objectClass – a ‘template’ for an object Object – an “instance” of a classObject – an “instance” of a class Instance fieldsInstance fields –Local variables tied to a particular variable –Retain their value over time Constructor – the object’s ‘creation’ methodConstructor – the object’s ‘creation’ method –Normally provided automatically –You can ‘tailor’ it to an object BankAccount: initialize balance to 0BankAccount: initialize balance to 0 Overloading – reusing the method nameOverloading – reusing the method name –Usually refers to changes in the parameter list

March R. Smith - University of St Thomas - Minnesota Object Features An object – data plus methodsAn object – data plus methods –Some variables with methods tied to them Object’s internal variables = instance fieldsObject’s internal variables = instance fields –We use reference variables to handle objects BankAccount exampleBankAccount example –One object per distinct account The current balanceThe current balance Data about the last transactionData about the last transaction How is this like visiting an ATM?How is this like visiting an ATM? –Methods to modify the balance –Methods to report account’s status Public vs PrivatePublic vs Private –Make Variable declarations PRIVATE –Make Method declarations PUBLIC

March R. Smith - University of St Thomas - Minnesota Object Methods General featuresGeneral features –Like other methods, but they can use the object’s instance fields –Refer to the object when calling the method –Does “Scanner” have instance fields? ConstructorsConstructors –Special methods named with the Class name –Optional – a ‘built in’ version is always provided –You can tailor it to your object Initializing the balance in BankAccountInitializing the balance in BankAccount

March R. Smith - University of St Thomas - Minnesota Chapter 8 – Arrays Focus on 1 dimensional arrays on examFocus on 1 dimensional arrays on exam Array declaration and initializationArray declaration and initialization –Fixed size established when the program runs –Initializing with constants –Arrays of strings Array Reference VariablesArray Reference Variables –Changing the reference variable –Changing contents of an array –Passing as a method parameter or result

March R. Smith - University of St Thomas - Minnesota Array Operations Min, max, average, sumMin, max, average, sum For loops – both typesFor loops – both types –Length attribute – arrayname.length First element is always #0First element is always #0 Files and sentinel valuesFiles and sentinel values –Make the array too large –Mark the end with a sentinel value

March R. Smith - University of St Thomas - Minnesota LAB: Selection Sort Create a 15-element arrayCreate a 15-element array Fill it with random numbersFill it with random numbers –Use int, float, or double, as you prefer Print it out so it’s readablePrint it out so it’s readable Sort it using the selection sortSort it using the selection sort Print it out againPrint it out again Write the selection sort as a separate methodWrite the selection sort as a separate method Write the printout procedure as a separate methodWrite the printout procedure as a separate method

March R. Smith - University of St Thomas - Minnesota Sorting – Selection Sort I know a lot of algorithmsI know a lot of algorithms –I never remember array sorting algorithms –The problem with arrays – everything is in a fixed location Selection SortSelection Sort –Start at one end Find the lowest value in the arrayFind the lowest value in the array Swap it with the first elementSwap it with the first element –Repeat the process for the array minus the first element

March R. Smith - University of St Thomas - Minnesota Selection Sort Example Min = 12Min =

March R. Smith - University of St Thomas - Minnesota Coding the selection sort Two loopsTwo loops Outer loop looks at subsets of the arrayOuter loop looks at subsets of the array Inner loop does “min” on remaining arrayInner loop does “min” on remaining array JavadocJavadoc –Basics: p tag: p. 259 tag: p

March R. Smith - University of St Thomas - Minnesota That’s it. Questions?Questions? Creative Commons License This work is licensed under the Creative Commons Attribution-Share Alike 3.0 United States License. To view a copy of this license, visit or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.