Minute Paper 32 Questions – Some Answers
- What is the definition of a member?
- A part of a structure. A structure is made up of members
– each member has a name and a type
- How many arrays can you have with a single structure?
- If I understand the question – as many as you need.
Suppose you had a structure for Student. You could have an array for
resident students, an array for commuter students. An array for
student-athletes. Arrays for each major, possibly arrays for each year in
school (Fr, So …) … You might not have all of these (wasted space, there
is likely a better way to do all of this), but you could.
- Is using structures actually easier than using arrays?
- I wouldn’t say that – because generally you work with an
array of some structure. It is easier than using parallel arrays however
(once you get used to the member notation)
- How beneficial will structures be to future programming?
(later in the semester)
- Well, you only have one unassigned program left (and it
will probably involve structures). It is a good technique. It has been
improved upon by OOP – which is what we will spend most of the rest of
the semester on.
- Will structures appear on Assignment 12?
- Would we have to use structures in any of the last
assignments?
- What is more practical, parallel or 2D arrays?
- What is better, parallel arrays or 2 dimensional arrays?
- If what you are doing can fit in 2D arrays, I would use
them. But in a lot of problems different data types are needed – so
cannot use 2D arrays.
- Are arrays going to be the focal point for the next few
weeks?
- When we get to OOP, you may start seeing less of them
- What are the limitations of structures?
- They’re not OOP? I don’t have a good answer to this
question.
- Why did you change the laptop’s background?
- I had the laptop on in my office and was just thinking
that the picture was a little grim compared to my office PC’s background.
The new picture is from a trip I took to Norway in 2003. It is a
beautiful place. I think the lighter background aids visibility a bit
(but we’re not often looking at the desktop).
- Where do we go from here?
- To OOP (Object-Oriented Programming). OOP in a way is
Structures + Code. Where the code is associated with the structure. In
VB.NET, OOP is now provided to you, the user (largely due to the success
of Java probably). VB really had used some OOP internally for a while. (A
button is a sort of a Structure with some Visual members – the
properties)
- Can you place multiple structures in one structure?
- Yes. First of all, you can put a structure inside a
structure. A Student structure could include an Address structure (which
would include Strings for street address, city, state, zip). You could
also have a structure for a Phone, which could be used for home phone
number and cell phone number. See Below:
Private Structure
Address
Public streetNum As String
Public city As String
Public state As String
Public zip As String
End Structure
Private Structure
Phone
Public areaCode As String
Public number As String
End Structure
Private Structure
Student
Public name As String
Public addr As
Address
Public homePhone As
Phone
Public cellPhone As
Phone
Public major As String
Public year As Integer
End Structure