SlideShare a Scribd company logo
1 of 21
Class 10 – Arrays
Agenda
 Lateral Thinking Warm-up
 Project 1 Results, Issues
 Discussion: SAAD - Problem Solving with Code
 Discussion/Demo: Intro to Arrays
 Intro to Assignment 7: Daily Agenda
 Intro to Project 2: Battleship
 Task assignment
 Rubric
 Project Work and Wrap-up
System Analysis & Design
 Problem Solving with Code
 Tools
 IPO (outside in)
 Pseudocode (linear, integrative)
 Flowchart (linear, integrative)
 Models & Approaches
 SDLC
 3-tier (n-tier)
 MVC (OOP)
SAAD – 3-tier (n-tier)
 Presentation
 Logic
 Data
SAAD - MVC
 Model
 View
 Controller
MVVM – the NeXt Generation
 Model
 View
 View-Model
 Data Binding
 Service Structure
MVC, N-Tier, MVVM – who
cares?
 Moving towards OOP
 Clean division of work between functional
units
 Example: Calculator Converter: Model? View?
Controller?
 Project 2 – later tonight…
Intro to Arrays
 What is an array?
 A collection of related data
 Similar to a set of mailboxes at a site
 The site is the array, each mailbox represents an
element
 The mailbox may contain a specific value or object
 The contents can be strings, integers, or even
another array
 Addressed using brackets or parentheses (zero-
based)
 Can be examined iteratively or uniquely
Arrays Illustrated
 Single Dimension
 Array=days_of_week(7)
 2-Dimensional (table)
 Array=address_book(4,7)
Mon Tues Wed Thurs Fri Sat Sun
fname lname addr city prov post Email
joe smith 123 My Street Halifax NS B1B 1B1 joe@test.com
jane jones 1 Main Dr Dartmouth NS B7B 7B7 jane@mymail.com
pat white 21 Goode Dr. Halifax NS B1A 2C3 pat@hotmail.com
sam davis 19 Smith Dr. Timberlea NS B9G 2K8 sam@mailstop.com
Creating and Accessing Arrays
 Single Dimension
a = Array.new # an empty array
a = [] # same as above
puts a => nil (no output)
a[0]=“hello” # assigns the value
a[1]=“ world”
puts a[0] + a[1]
puts a
x = [1,”green”,”martian”]
Array Properties and Methods
 Properties
a=[“hello”, 1, “world”,2,”!”]
 a.last => “!”
 a.first => “hello”
 a[0].class => String
 a[1].class => Fixnum
 a.at(1) => 1
 a.length => 5
Array Properties and Methods
 Methods
a.push (“my friend”) => [ “hello”, 1,
“world”,2,”!”,”my friend”]
a.pop => [ “hello”, 1, “world”,2,”!”]
a.sort => [1,2, “!”,”hello”,”world”]
a.reverse = [“!”,2,”world”,1,”hello”]
a.sort! => applied to array (permanent change)
a.delete_at(2) => [ “hello”, 1, 2,”!”]
a.each do |variable|
end => iterates through the array
Creating and Accessing Arrays
 Practice
Handout: Exercise 10-1, Creating and
Accessing an Array
2-Dimensional Arrays
 Creating
 x=Array.new(4) {Array.new(7)}
 a=[[1,"green"],[2,"red"],[3,"blue"]]
 Accessing & Assigning
 myval= a[1][0] => “green”
 x[2][4]=“Halifax”
 a[1][1]=“orange”
Iterating Through Arrays
 Using each
rows=5
cols=5
countr=0
mtrx=Array.new(rows) {Array.new(cols)}
mtrx.each do |myvar|
myvar.each do |ovar|
ovar=countr
countr=countr+1
end
end
Iterating Through Arrays
 Using for
rows=5
cols=5
countr=0
for x in (0..rows-1)
for y in (0..cols-1)
mtrx[x][y]=countr
countr=countr+1
end
end
Creating and Accessing Arrays
 Practice
Handout: Exercise 10-2, Creating and
Accessing a multi-dimensional
Array
Assignment 7: Daily Agenda
 Use a 2D Array to hold details
 Prompt for time (hour only)
 Prompt for appointment
 Prompt for location
 Assign inputs to elements
 Continue to prompt until user types in a blank
in the time slot
 Sort the Agenda and then generate Daily
Agenda by iterating through the array
Project 2: Battleship
 Simple Version
 8 x 8 grid (A-H, 1-8)
 2 ships each player
 Each ship assigned to a particular grid location
 10 shots each player
 A shot to the location of a vessel sinks it
 Draw grid and results after each shot
 “~” is unknown, “!” is sunk, “0” is a miss
 If two of the ships of any player are sunk, the other player
wins, end game
 If after ten shots one player has more ships than the other,
he/she wins, otherwise it’s a tie.
Wrap-up
 Summary
 Arrays
 Analysis & Design
 Assignment
 Project
 Next Week
 Brief intro to Classes
 Business Problems with Fishbone Diagram
 Project Time*
Practice/ Set-up
 Use this time to attempt the assignment to
prepare you for the project, OR
 Begin to set up your tasks, OR
 See me about any issues with grades, etc. OR
 Do any research you need to get the
assignment or project completed.
 GREAT TIP SITE:
 http://www.techotopia.com/index.php/Understanding_

More Related Content

What's hot

Object-Oriented Programming (OOP)
Object-Oriented Programming (OOP)Object-Oriented Programming (OOP)
Object-Oriented Programming (OOP)Ahmad karawash
 
The Ring programming language version 1.4 book - Part 20 of 30
The Ring programming language version 1.4 book - Part 20 of 30The Ring programming language version 1.4 book - Part 20 of 30
The Ring programming language version 1.4 book - Part 20 of 30Mahmoud Samir Fayed
 
Building a Mongo DSL in Scala at Hot Potato
Building a Mongo DSL in Scala at Hot PotatoBuilding a Mongo DSL in Scala at Hot Potato
Building a Mongo DSL in Scala at Hot PotatoMongoDB
 
Java OOP Programming language (Part 5) - Inheritance
Java OOP Programming language (Part 5) - InheritanceJava OOP Programming language (Part 5) - Inheritance
Java OOP Programming language (Part 5) - InheritanceOUM SAOKOSAL
 
Dev Concepts: Object-Oriented Programming
Dev Concepts: Object-Oriented ProgrammingDev Concepts: Object-Oriented Programming
Dev Concepts: Object-Oriented ProgrammingSvetlin Nakov
 
The Ring programming language version 1.8 book - Part 7 of 202
The Ring programming language version 1.8 book - Part 7 of 202The Ring programming language version 1.8 book - Part 7 of 202
The Ring programming language version 1.8 book - Part 7 of 202Mahmoud Samir Fayed
 
[OOP - Lec 09,10,11] Class Members & their Accessing
[OOP - Lec 09,10,11] Class Members & their Accessing[OOP - Lec 09,10,11] Class Members & their Accessing
[OOP - Lec 09,10,11] Class Members & their AccessingMuhammad Hammad Waseem
 
Introduction to machine_learning
Introduction to machine_learningIntroduction to machine_learning
Introduction to machine_learningKiran Lonikar
 
The Ring programming language version 1.10 book - Part 86 of 212
The Ring programming language version 1.10 book - Part 86 of 212The Ring programming language version 1.10 book - Part 86 of 212
The Ring programming language version 1.10 book - Part 86 of 212Mahmoud Samir Fayed
 
Redis Day TLV 2018 - Graph Distribution
Redis Day TLV 2018 - Graph DistributionRedis Day TLV 2018 - Graph Distribution
Redis Day TLV 2018 - Graph DistributionRedis Labs
 
Internet and Web Technology (CLASS-16) [Basic Elements of Java Program] | NIC...
Internet and Web Technology (CLASS-16) [Basic Elements of Java Program] | NIC...Internet and Web Technology (CLASS-16) [Basic Elements of Java Program] | NIC...
Internet and Web Technology (CLASS-16) [Basic Elements of Java Program] | NIC...Ayes Chinmay
 

What's hot (13)

Object-Oriented Programming (OOP)
Object-Oriented Programming (OOP)Object-Oriented Programming (OOP)
Object-Oriented Programming (OOP)
 
The Ring programming language version 1.4 book - Part 20 of 30
The Ring programming language version 1.4 book - Part 20 of 30The Ring programming language version 1.4 book - Part 20 of 30
The Ring programming language version 1.4 book - Part 20 of 30
 
Building a Mongo DSL in Scala at Hot Potato
Building a Mongo DSL in Scala at Hot PotatoBuilding a Mongo DSL in Scala at Hot Potato
Building a Mongo DSL in Scala at Hot Potato
 
Java OOP Programming language (Part 5) - Inheritance
Java OOP Programming language (Part 5) - InheritanceJava OOP Programming language (Part 5) - Inheritance
Java OOP Programming language (Part 5) - Inheritance
 
Dev Concepts: Object-Oriented Programming
Dev Concepts: Object-Oriented ProgrammingDev Concepts: Object-Oriented Programming
Dev Concepts: Object-Oriented Programming
 
The Ring programming language version 1.8 book - Part 7 of 202
The Ring programming language version 1.8 book - Part 7 of 202The Ring programming language version 1.8 book - Part 7 of 202
The Ring programming language version 1.8 book - Part 7 of 202
 
Session 4#
Session 4#Session 4#
Session 4#
 
[OOP - Lec 09,10,11] Class Members & their Accessing
[OOP - Lec 09,10,11] Class Members & their Accessing[OOP - Lec 09,10,11] Class Members & their Accessing
[OOP - Lec 09,10,11] Class Members & their Accessing
 
Introduction to machine_learning
Introduction to machine_learningIntroduction to machine_learning
Introduction to machine_learning
 
The Ring programming language version 1.10 book - Part 86 of 212
The Ring programming language version 1.10 book - Part 86 of 212The Ring programming language version 1.10 book - Part 86 of 212
The Ring programming language version 1.10 book - Part 86 of 212
 
Redis Day TLV 2018 - Graph Distribution
Redis Day TLV 2018 - Graph DistributionRedis Day TLV 2018 - Graph Distribution
Redis Day TLV 2018 - Graph Distribution
 
Pythonclass
PythonclassPythonclass
Pythonclass
 
Internet and Web Technology (CLASS-16) [Basic Elements of Java Program] | NIC...
Internet and Web Technology (CLASS-16) [Basic Elements of Java Program] | NIC...Internet and Web Technology (CLASS-16) [Basic Elements of Java Program] | NIC...
Internet and Web Technology (CLASS-16) [Basic Elements of Java Program] | NIC...
 

Viewers also liked

Manual for Troubleshooting Formulas & Functions in Excel
Manual for Troubleshooting Formulas & Functions in ExcelManual for Troubleshooting Formulas & Functions in Excel
Manual for Troubleshooting Formulas & Functions in ExcelChristopher Ward
 
Atlantic Woodworkers Website Strategy
Atlantic Woodworkers Website StrategyAtlantic Woodworkers Website Strategy
Atlantic Woodworkers Website StrategyStephen Parsons
 
How to analyze and tune sql queries for better performance percona15
How to analyze and tune sql queries for better performance percona15How to analyze and tune sql queries for better performance percona15
How to analyze and tune sql queries for better performance percona15oysteing
 
Program Renewal for NSCC Schools 2010-11
Program Renewal for NSCC Schools 2010-11Program Renewal for NSCC Schools 2010-11
Program Renewal for NSCC Schools 2010-11Stephen Parsons
 

Viewers also liked (6)

Manual for Troubleshooting Formulas & Functions in Excel
Manual for Troubleshooting Formulas & Functions in ExcelManual for Troubleshooting Formulas & Functions in Excel
Manual for Troubleshooting Formulas & Functions in Excel
 
Deck Project Phase II
Deck Project Phase IIDeck Project Phase II
Deck Project Phase II
 
Atlantic Woodworkers Website Strategy
Atlantic Woodworkers Website StrategyAtlantic Woodworkers Website Strategy
Atlantic Woodworkers Website Strategy
 
Class 11 lecture notes
Class 11 lecture notesClass 11 lecture notes
Class 11 lecture notes
 
How to analyze and tune sql queries for better performance percona15
How to analyze and tune sql queries for better performance percona15How to analyze and tune sql queries for better performance percona15
How to analyze and tune sql queries for better performance percona15
 
Program Renewal for NSCC Schools 2010-11
Program Renewal for NSCC Schools 2010-11Program Renewal for NSCC Schools 2010-11
Program Renewal for NSCC Schools 2010-11
 

Similar to Class 10 Arrays

body { text-align center; font-family sans-serif;}.docx
body {  text-align center;  font-family sans-serif;}.docxbody {  text-align center;  font-family sans-serif;}.docx
body { text-align center; font-family sans-serif;}.docxmoirarandell
 
Scala @ TechMeetup Edinburgh
Scala @ TechMeetup EdinburghScala @ TechMeetup Edinburgh
Scala @ TechMeetup EdinburghStuart Roebuck
 
ComputeFest 2012: Intro To R for Physical Sciences
ComputeFest 2012: Intro To R for Physical SciencesComputeFest 2012: Intro To R for Physical Sciences
ComputeFest 2012: Intro To R for Physical Sciencesalexstorer
 
Devry CIS 355A Full Course Latest
Devry CIS 355A Full Course LatestDevry CIS 355A Full Course Latest
Devry CIS 355A Full Course LatestAtifkhilji
 
INFORMATIVE ESSAYThe purpose of the Informative Essay assignme.docx
INFORMATIVE ESSAYThe purpose of the Informative Essay assignme.docxINFORMATIVE ESSAYThe purpose of the Informative Essay assignme.docx
INFORMATIVE ESSAYThe purpose of the Informative Essay assignme.docxcarliotwaycave
 
Once Upon a Process
Once Upon a ProcessOnce Upon a Process
Once Upon a ProcessDavid Evans
 
Topic2JavaBasics.ppt
Topic2JavaBasics.pptTopic2JavaBasics.ppt
Topic2JavaBasics.pptMENACE4
 
hallleuah_java.ppt
hallleuah_java.ppthallleuah_java.ppt
hallleuah_java.pptRahul201258
 
Why re-use core classes?
Why re-use core classes?Why re-use core classes?
Why re-use core classes?Levi Waldron
 
Linq To The Enterprise
Linq To The EnterpriseLinq To The Enterprise
Linq To The EnterpriseDaniel Egan
 
Software Architecture: Principles, Patterns and Practices
Software Architecture: Principles, Patterns and PracticesSoftware Architecture: Principles, Patterns and Practices
Software Architecture: Principles, Patterns and PracticesGanesh Samarthyam
 
Linq 1224887336792847 9
Linq 1224887336792847 9Linq 1224887336792847 9
Linq 1224887336792847 9google
 
R for Pirates. ESCCONF October 27, 2011
R for Pirates. ESCCONF October 27, 2011R for Pirates. ESCCONF October 27, 2011
R for Pirates. ESCCONF October 27, 2011Mandi Walls
 
PPT ON MACHINE LEARNING by Ragini Ratre
PPT ON MACHINE LEARNING by Ragini RatrePPT ON MACHINE LEARNING by Ragini Ratre
PPT ON MACHINE LEARNING by Ragini RatreRaginiRatre
 

Similar to Class 10 Arrays (20)

body { text-align center; font-family sans-serif;}.docx
body {  text-align center;  font-family sans-serif;}.docxbody {  text-align center;  font-family sans-serif;}.docx
body { text-align center; font-family sans-serif;}.docx
 
Clojure And Swing
Clojure And SwingClojure And Swing
Clojure And Swing
 
Scala @ TechMeetup Edinburgh
Scala @ TechMeetup EdinburghScala @ TechMeetup Edinburgh
Scala @ TechMeetup Edinburgh
 
ComputeFest 2012: Intro To R for Physical Sciences
ComputeFest 2012: Intro To R for Physical SciencesComputeFest 2012: Intro To R for Physical Sciences
ComputeFest 2012: Intro To R for Physical Sciences
 
Devry CIS 355A Full Course Latest
Devry CIS 355A Full Course LatestDevry CIS 355A Full Course Latest
Devry CIS 355A Full Course Latest
 
INFORMATIVE ESSAYThe purpose of the Informative Essay assignme.docx
INFORMATIVE ESSAYThe purpose of the Informative Essay assignme.docxINFORMATIVE ESSAYThe purpose of the Informative Essay assignme.docx
INFORMATIVE ESSAYThe purpose of the Informative Essay assignme.docx
 
Ggplot2 v3
Ggplot2 v3Ggplot2 v3
Ggplot2 v3
 
Introduction to r
Introduction to rIntroduction to r
Introduction to r
 
Once Upon a Process
Once Upon a ProcessOnce Upon a Process
Once Upon a Process
 
Topic2JavaBasics.ppt
Topic2JavaBasics.pptTopic2JavaBasics.ppt
Topic2JavaBasics.ppt
 
hallleuah_java.ppt
hallleuah_java.ppthallleuah_java.ppt
hallleuah_java.ppt
 
2.ppt
2.ppt2.ppt
2.ppt
 
Why re-use core classes?
Why re-use core classes?Why re-use core classes?
Why re-use core classes?
 
Linq To The Enterprise
Linq To The EnterpriseLinq To The Enterprise
Linq To The Enterprise
 
Machine Learning in R
Machine Learning in RMachine Learning in R
Machine Learning in R
 
Software Architecture: Principles, Patterns and Practices
Software Architecture: Principles, Patterns and PracticesSoftware Architecture: Principles, Patterns and Practices
Software Architecture: Principles, Patterns and Practices
 
JAVA BASICS
JAVA BASICSJAVA BASICS
JAVA BASICS
 
Linq 1224887336792847 9
Linq 1224887336792847 9Linq 1224887336792847 9
Linq 1224887336792847 9
 
R for Pirates. ESCCONF October 27, 2011
R for Pirates. ESCCONF October 27, 2011R for Pirates. ESCCONF October 27, 2011
R for Pirates. ESCCONF October 27, 2011
 
PPT ON MACHINE LEARNING by Ragini Ratre
PPT ON MACHINE LEARNING by Ragini RatrePPT ON MACHINE LEARNING by Ragini Ratre
PPT ON MACHINE LEARNING by Ragini Ratre
 

More from Stephen Parsons

Chairs Report to LSCRS 2012 AGM
Chairs Report to LSCRS 2012 AGMChairs Report to LSCRS 2012 AGM
Chairs Report to LSCRS 2012 AGMStephen Parsons
 
Class 6 truth tables and boolean math
Class 6   truth tables and boolean mathClass 6   truth tables and boolean math
Class 6 truth tables and boolean mathStephen Parsons
 
Class 5 - Set Theory and Venn Diagrams
Class 5 - Set Theory and Venn DiagramsClass 5 - Set Theory and Venn Diagrams
Class 5 - Set Theory and Venn DiagramsStephen Parsons
 
Class 4 IPO and Intro to Ruby
Class 4 IPO and Intro to RubyClass 4 IPO and Intro to Ruby
Class 4 IPO and Intro to RubyStephen Parsons
 
Class 3 Binary & Hexadecimal
Class 3 Binary & HexadecimalClass 3 Binary & Hexadecimal
Class 3 Binary & HexadecimalStephen Parsons
 
Class 1 introduction to logic & problem solving
Class 1   introduction to logic & problem solvingClass 1   introduction to logic & problem solving
Class 1 introduction to logic & problem solvingStephen Parsons
 
Portfolio Of A Community
Portfolio Of A CommunityPortfolio Of A Community
Portfolio Of A CommunityStephen Parsons
 
Cause & effect analysis part 2
Cause & effect analysis part 2Cause & effect analysis part 2
Cause & effect analysis part 2Stephen Parsons
 
Cause & effect analysis part 1
Cause & effect analysis part 1Cause & effect analysis part 1
Cause & effect analysis part 1Stephen Parsons
 

More from Stephen Parsons (14)

Chairs Report to LSCRS 2012 AGM
Chairs Report to LSCRS 2012 AGMChairs Report to LSCRS 2012 AGM
Chairs Report to LSCRS 2012 AGM
 
Class 7 lecture notes
Class 7 lecture notesClass 7 lecture notes
Class 7 lecture notes
 
Class 6a ruby math
Class 6a   ruby mathClass 6a   ruby math
Class 6a ruby math
 
Class 6 truth tables and boolean math
Class 6   truth tables and boolean mathClass 6   truth tables and boolean math
Class 6 truth tables and boolean math
 
Class 5 - Set Theory and Venn Diagrams
Class 5 - Set Theory and Venn DiagramsClass 5 - Set Theory and Venn Diagrams
Class 5 - Set Theory and Venn Diagrams
 
Class 4 IPO and Intro to Ruby
Class 4 IPO and Intro to RubyClass 4 IPO and Intro to Ruby
Class 4 IPO and Intro to Ruby
 
Class 3 Binary & Hexadecimal
Class 3 Binary & HexadecimalClass 3 Binary & Hexadecimal
Class 3 Binary & Hexadecimal
 
Class 2 Math I
Class 2 Math IClass 2 Math I
Class 2 Math I
 
Class 1 introduction to logic & problem solving
Class 1   introduction to logic & problem solvingClass 1   introduction to logic & problem solving
Class 1 introduction to logic & problem solving
 
Portfolio Of A Community
Portfolio Of A CommunityPortfolio Of A Community
Portfolio Of A Community
 
Cause & effect analysis part 2
Cause & effect analysis part 2Cause & effect analysis part 2
Cause & effect analysis part 2
 
Cause & effect analysis part 1
Cause & effect analysis part 1Cause & effect analysis part 1
Cause & effect analysis part 1
 
Class 9 Lecture Notes
Class 9 Lecture NotesClass 9 Lecture Notes
Class 9 Lecture Notes
 
Class 8 Lecture Notes
Class 8 Lecture NotesClass 8 Lecture Notes
Class 8 Lecture Notes
 

Recently uploaded

Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsKarinaGenton
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
Class 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfClass 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfakmcokerachita
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptx
ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptxENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptx
ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptxAnaBeatriceAblay2
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 

Recently uploaded (20)

Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its Characteristics
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
Class 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfClass 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdf
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptx
ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptxENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptx
ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptx
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 

Class 10 Arrays

  • 1. Class 10 – Arrays
  • 2. Agenda  Lateral Thinking Warm-up  Project 1 Results, Issues  Discussion: SAAD - Problem Solving with Code  Discussion/Demo: Intro to Arrays  Intro to Assignment 7: Daily Agenda  Intro to Project 2: Battleship  Task assignment  Rubric  Project Work and Wrap-up
  • 3. System Analysis & Design  Problem Solving with Code  Tools  IPO (outside in)  Pseudocode (linear, integrative)  Flowchart (linear, integrative)  Models & Approaches  SDLC  3-tier (n-tier)  MVC (OOP)
  • 4. SAAD – 3-tier (n-tier)  Presentation  Logic  Data
  • 5. SAAD - MVC  Model  View  Controller
  • 6. MVVM – the NeXt Generation  Model  View  View-Model  Data Binding  Service Structure
  • 7. MVC, N-Tier, MVVM – who cares?  Moving towards OOP  Clean division of work between functional units  Example: Calculator Converter: Model? View? Controller?  Project 2 – later tonight…
  • 8. Intro to Arrays  What is an array?  A collection of related data  Similar to a set of mailboxes at a site  The site is the array, each mailbox represents an element  The mailbox may contain a specific value or object  The contents can be strings, integers, or even another array  Addressed using brackets or parentheses (zero- based)  Can be examined iteratively or uniquely
  • 9. Arrays Illustrated  Single Dimension  Array=days_of_week(7)  2-Dimensional (table)  Array=address_book(4,7) Mon Tues Wed Thurs Fri Sat Sun fname lname addr city prov post Email joe smith 123 My Street Halifax NS B1B 1B1 joe@test.com jane jones 1 Main Dr Dartmouth NS B7B 7B7 jane@mymail.com pat white 21 Goode Dr. Halifax NS B1A 2C3 pat@hotmail.com sam davis 19 Smith Dr. Timberlea NS B9G 2K8 sam@mailstop.com
  • 10. Creating and Accessing Arrays  Single Dimension a = Array.new # an empty array a = [] # same as above puts a => nil (no output) a[0]=“hello” # assigns the value a[1]=“ world” puts a[0] + a[1] puts a x = [1,”green”,”martian”]
  • 11. Array Properties and Methods  Properties a=[“hello”, 1, “world”,2,”!”]  a.last => “!”  a.first => “hello”  a[0].class => String  a[1].class => Fixnum  a.at(1) => 1  a.length => 5
  • 12. Array Properties and Methods  Methods a.push (“my friend”) => [ “hello”, 1, “world”,2,”!”,”my friend”] a.pop => [ “hello”, 1, “world”,2,”!”] a.sort => [1,2, “!”,”hello”,”world”] a.reverse = [“!”,2,”world”,1,”hello”] a.sort! => applied to array (permanent change) a.delete_at(2) => [ “hello”, 1, 2,”!”] a.each do |variable| end => iterates through the array
  • 13. Creating and Accessing Arrays  Practice Handout: Exercise 10-1, Creating and Accessing an Array
  • 14. 2-Dimensional Arrays  Creating  x=Array.new(4) {Array.new(7)}  a=[[1,"green"],[2,"red"],[3,"blue"]]  Accessing & Assigning  myval= a[1][0] => “green”  x[2][4]=“Halifax”  a[1][1]=“orange”
  • 15. Iterating Through Arrays  Using each rows=5 cols=5 countr=0 mtrx=Array.new(rows) {Array.new(cols)} mtrx.each do |myvar| myvar.each do |ovar| ovar=countr countr=countr+1 end end
  • 16. Iterating Through Arrays  Using for rows=5 cols=5 countr=0 for x in (0..rows-1) for y in (0..cols-1) mtrx[x][y]=countr countr=countr+1 end end
  • 17. Creating and Accessing Arrays  Practice Handout: Exercise 10-2, Creating and Accessing a multi-dimensional Array
  • 18. Assignment 7: Daily Agenda  Use a 2D Array to hold details  Prompt for time (hour only)  Prompt for appointment  Prompt for location  Assign inputs to elements  Continue to prompt until user types in a blank in the time slot  Sort the Agenda and then generate Daily Agenda by iterating through the array
  • 19. Project 2: Battleship  Simple Version  8 x 8 grid (A-H, 1-8)  2 ships each player  Each ship assigned to a particular grid location  10 shots each player  A shot to the location of a vessel sinks it  Draw grid and results after each shot  “~” is unknown, “!” is sunk, “0” is a miss  If two of the ships of any player are sunk, the other player wins, end game  If after ten shots one player has more ships than the other, he/she wins, otherwise it’s a tie.
  • 20. Wrap-up  Summary  Arrays  Analysis & Design  Assignment  Project  Next Week  Brief intro to Classes  Business Problems with Fishbone Diagram  Project Time*
  • 21. Practice/ Set-up  Use this time to attempt the assignment to prepare you for the project, OR  Begin to set up your tasks, OR  See me about any issues with grades, etc. OR  Do any research you need to get the assignment or project completed.  GREAT TIP SITE:  http://www.techotopia.com/index.php/Understanding_

Editor's Notes

  1. Model: The model contains the core information for an application. This includes the data and validation rules as well as data access and aggregation logic. View: The view encapsulates the presentation of the application, and in ASP.NET this is typically the HTML markup. Controller: The controller contains the control-flow logic. It interacts with the Model and Views to control the flow of information and execution of the application.