March 2005 1/18R. Smith - University of St Thomas - Minnesota QMCS 230: Today in Class HomeworkHomework Nested LoopsNested Loops Other thingsOther things.

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

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 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 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 QMCS 130: Today’s Class Today: covering through P. 83 of textToday: covering through P. 83 of.
March R. Smith - University of St Thomas - Minnesota Today’s Class Course StuffCourse Stuff –Classroom change TOMORROW –Assignment; Lab While LoopsWhile.
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.
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 130: Today’s Class Young Scholars GrantsYoung Scholars Grants Exam Next TuesdayExam Next.
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.
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 R. Smith - University of St Thomas - Minnesota QMCS 130: Today’s Class The ProjectThe Project PointersPointers.
March R. Smith - University of St Thomas - Minnesota CISC Class Today Return Homework; grading recapReturn Homework; grading recap “Enigma”
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.
March R. Smith - University of St Thomas - Minnesota QMCS Class Today Working the InternetWorking the Internet RoutingRouting Firewalling in.
Spring R. Smith - University of St Thomas - Minnesota QMCS 130: Today’s Class Return HomeworkReturn Homework Class ScheduleClass Schedule Functions:
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 Class Today Cryptography – introductory termsCryptography – introductory terms “Enigma”
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 /18R. Smith - University of St Thomas - Minnesota QMCS 230 – Today in Class Authorizing OvertimeAuthorizing Overtime Weird Java stuff: conditionals,
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 ENGR 330: Today’s Class More “Clarifications” ?More “Clarifications” ? Interrupts – integrating.
March R. Smith - University of St Thomas - Minnesota Today’s Class First, course surveysFirst, course surveys RecapRecap More course thingsMore course.
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.
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.
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 Revised Lab 14/15Revised Lab 14/15 Counting WordsCounting Words Moving.
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.
March R. Smith - University of St Thomas - Minnesota QMCS 130: Today’s Class AssignmentsAssignments Logical operationsLogical operations Summations.
20 Oct - Overview Homework #1 Group-Id rule Notes on Java text file input/output –Scanner class –Printf (like C)
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.
Files Review For output to a file: –FileOutputStream variable initialized to filename (String) and append/not append (boolean) –PrintWriter variable initialized.
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.
For Friday Finish reading chapter 9 WebCT quiz 17.
7/6/2016 1R. Smith - University of St Thomas - Minnesota CISC 130: Today’s Class Collect PapersCollect Papers Review: Our ZeroesReview: Our Zeroes Review:
7/6/2016 1R. Smith - University of St Thomas - Minnesota CISC 130: Today’s Class Computer HardwareComputer Hardware Recap: next programRecap: next program.
Reading from a file A file is typically stored on your computers hard drive. In the simplest case, lets just assume it is text. For a program to use.
Presentation transcript:

March /18R. Smith - University of St Thomas - Minnesota QMCS 230: Today in Class HomeworkHomework Nested LoopsNested Loops Other thingsOther things Group work if timeGroup work if time Start working with files?Start working with files? Lab 8Lab 8

March /18R. Smith - University of St Thomas - Minnesota Homework Typical weekly assignmentsTypical weekly assignments –1 “informal” lab Hand in source code ONLYHand in source code ONLY Less credit than the “formal” labLess credit than the “formal” lab Checked in general for content and formChecked in general for content and form –1 “formal” lab source code ONLY source code ONLY –Checked carefully GradingGrading –Check plus plus – a few labs – for special work – think A+ –Check plus – almost no problems – think A –Check – Some problems – think of a B –Check Minus – many or major problems – think of a C –No Credit – major parts of the assignment missing

March /18R. Smith - University of St Thomas - Minnesota On the Exam Chapter 2, all sections exceptChapter 2, all sections except –2.6, 2.8 Chapter 3, all sections exceptChapter 3, all sections except –3.8, 3.9 Chapter 4, Sections Chapter 4, Sections Study the ‘Checkpoints’Study the ‘Checkpoints’

March /18R. Smith - University of St Thomas - Minnesota Reference Materials I will provide reference guidesI will provide reference guides –Java syntax basics –Reserved words you might use –Tables of details, if needed Closed book closed notesClosed book closed notes

March /18R. Smith - University of St Thomas - Minnesota Nested Loops How would we do hh:mm:ss ?How would we do hh:mm:ss ? What does “nesting” mean?What does “nesting” mean? –Nothing to do with eggs.

March /18R. Smith - University of St Thomas - Minnesota Break and Continue (Sec 4.8) Loops do all statements in orderLoops do all statements in order Break and Continue change this.Break and Continue change this. –Cause ‘surprising’ behavior They exist, but we will NOT use themThey exist, but we will NOT use them –Makes programs harder to understand –And harder for ME to read

March /18R. Smith - University of St Thomas - Minnesota Picking a loop Always do it at least once?Always do it at least once? Maybe skip it all sometimes?Maybe skip it all sometimes? A fixed number of times?A fixed number of times?

March /18R. Smith - University of St Thomas - Minnesota Picking a loop Always do it at least once?Always do it at least once? –Do - While Maybe skip it all sometimes?Maybe skip it all sometimes? –While A fixed number of times?A fixed number of times? –For loop

March /18R. Smith - University of St Thomas - Minnesota Group Work 8 groups - 4 problems8 groups - 4 problems ALL: average 4 numbers read from keyboardALL: average 4 numbers read from keyboard Different problemsDifferent problems –Use 4 separate statements –Use ‘for’ loop –Use ‘do while’ loop –Use ‘while’ loop

March /18R. Smith - University of St Thomas - Minnesota Working with Files We use the same methods as System.in/outWe use the same methods as System.in/out –println, print, printf, Scanner class We must “open” and “close” filesWe must “open” and “close” files –“Open” when we create the file object –“close()” method when done

March /18R. Smith - University of St Thomas - Minnesota Output Files PrintWriter classPrintWriter class –“new” takes file name as an argument –Creates that file Use the object with ‘print’ methodsUse the object with ‘print’ methods Write to a fileWrite to a file –import java.io.*; –public static void main(String[] args) throws IOException –PrintWriter pwa; –pwa = new PrintWriter(“existingfile.txt”); Example: write student namesExample: write student names

March /18R. Smith - University of St Thomas - Minnesota Append to Output File Use an extra object for the existing fileUse an extra object for the existing file “FileWriter” object“FileWriter” object FileWriter fw;// to define the existing fileFileWriter fw;// to define the existing file PrintWriter pwa;// to open for print functionsPrintWriter pwa;// to open for print functions fw = new FileWriter(“existingfile.txt”, true);fw = new FileWriter(“existingfile.txt”, true); pwa = new PrintWriter(fw);pwa = new PrintWriter(fw);

March /18R. Smith - University of St Thomas - Minnesota Input Files Use Scanner class and File classUse Scanner class and File class import java.util.Scanner;import java.util.Scanner; import java.io.*;import java.io.*; public static void main(String[] args) throws IOExceptionpublic static void main(String[] args) throws IOException fn; // identify the file to readfn; // identify the file to read Scanner sc; // for reading the dataScanner sc; // for reading the data fn = new File(“filename.txt”);fn = new File(“filename.txt”); sc = new Scanner(fn);sc = new Scanner(fn);

March /18R. Smith - University of St Thomas - Minnesota That’s it. Questions?Questions?

March /18R. Smith - University of St Thomas - Minnesota 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.