Re: student question/ array
From: Troy Scott (tigerweld
Date: 04/10/04
- Next message: Tony Proctor: "Re: Removing White Space..."
- Previous message: Randy Birch: "Re: Monitoring File System Changes"
- In reply to: Jim Carlock: "Re: student question/ array"
- Next in thread: Jim Carlock: "Re: student question/ array"
- Reply: Jim Carlock: "Re: student question/ array"
- Reply: Larry Serflaten: "Re: student question/ array"
- Messages sorted by: [ date ] [ thread ]
Date: Sat, 10 Apr 2004 09:05:04 -0500
Jim, maybe I didn't make myself clear. This is a problem in the current
chapter we are dealing with. The problem originally stated it wanted the
student to create a project to analyze an income survey. Here is the problem
in full.
********************************
8.1 Create a project to analyze an income survey. The statistics for each
home include an indentification code, the number of members in the
household, and the yearly income. A menu will contain File, Reports, and
Help. The File menu will contain Enter Data, and Exit. As the data are
entered, they should be assigned from the text boes to hte elements of a
multi dim array.
The reports for the project will be sent to hte rpinter and include the
following:
(a) A three-column report displaying the input data.
(b) A listing of the identification nu;mber and income for each household
that exceeds the average income.
(c) The percentage of households having incomes below the poverty level.
Test Data
Poverty Level: 8000 for a family of one or two, plus 2000 for each
additional member.
This where the test data is, too much to list.
Then the professor hands out a *** with some changes he wants:
Modify the menu structure.
File
Enter Data Enter new survey data. Be certain to initialize
the array.
Open Survey File Retrieve data from the data file and place in the
array.
Save Survey File Write the data from teh array to the survey data
file.
Reports
Survey Data Report All survey data.
High Income Report Identification number and income for each household
exceeding the average income.
Below Poverty Report The percentage for households having incoems below
poverty level.
Help
About
Combo Box Data Entry. When allowing for data entry, use a combo box to
permit selection of "Number of Persons". The list components of the combo
box should allow for family sizes, or "Number of Perons" up to 4. However,
larger family sizes should be permitted by entry into the text component of
the combo box. Describe in the comments of the program abstract which type
of combo box you have selected and why you made this choice.
Report Generation. Produce reasonably formatted reports for all reports.
Describe the contents of each report in the comments of your program
adbstract.
Processing a Data File. When saving the survey data in a sequential data
file, name the dat file SURVDATA.DAT and be certain that the data file is
stored in the project directory for this project. If necessary you may need
to sue the APP.PATH techniques described in the text. You may need to
review the first portion of chapter 10. The use of APP.PATH is described in
this chapter in the section "Locating a File".
********************************
So, now you know as much as I do. Like I said, he hasn't been much help at
all on this, much less this semester. Not once has he sat down and use his
computer to display sample code or even used it for teaching. He lectures
the whole time. 95% of the class time is lecture. Go figure.
Troy
"Jim Carlock" <anonymous@127.0.0.1> wrote in message
news:OX#l6#vHEHA.4092@TK2MSFTNGP11.phx.gbl...
> It sounds like the typical student thing where they leave alot up to
> the student to determine the best way to do this. I've seen alot of
> instructors work in this manner, and I think they're looking for
> creativity.
>
> The way I'd think of it is they want a database. It would help if we
> knew why a number would be stored in a combo box and what
> that number really represents. Is it the number of persons in a
> particular city, state, country? You might want to start here.
>
> Restating things means you understand what is being asked,
> and if it's done in front of the class, will show leadership and that
> you are willing to step up to the plate and it will help the rest of
> the class as well. Don't worry about what they want to teach,
> worry about what the problem is. Find out the requirements
> that are needed. Alot of times the professor will indicate that
> it is up to YOU. But I really don't think that is appropriate,
> because things in real life are more defined and the requirements
> are more specific, and the end result will be that you will have
> accept their abstract problem (and this where your creativity
> will come into play, because this is where you redefine what
> the problem really is and you create something that goes
> beyond what is required, and you'll have an out if the project
> you've created doesn't represent what was asked). If needed
> restate the problem, put it in writing and get the professor to
> sign it.
>
> I'd present the professor with something as follows:
>
> "I understand that you want a database to hold the following
> information:
>
> ID, AVGANNUALINCOME, and CITYPOPULATION
>
> and that you will use this information to determine the average
> shoe size, which in turn will be used to determine digit size,
> which in turn will be used to determine the size of the seat of the
> commode, in to prevent kids from falling into commercial
> commodes and to prevent these from overflowing into
> classrooms."
>
> I've done this in this past with professors that gave quite abstract
> problems and it works. Sometimes professors give you a broken
> problem and look for you to fix what they've broken. It can be
> used in a good manner to help students understand that they need
> to ask questions when a problem is presented to them. The
> student (or person working on a project) must get a clear
> understanding of the project and then take the project from that
> point and work a solution.
>
> There really is no need to put a number that represents the number
> of persons, in a combobox, and that doesn't make any sense at all.
> So ask the professor about what kind of purpose there is for a
> number being put into a combobox. It is usually the id that goes
> into a combobox, or a limited list of words that are put there,
> as in the case of country names, state names, city names, etc.
>
> If you really want to impress the guy, make sure you understand,
> the problem. If he is looking for creativity, be creative.
>
> As for the problem, I'd present a form with three fields. Make the
> ID field the combobox. Add a fourth field and call it CityName.
>
> You can get to this goal, in several different ways. I'd use an
> Access database if you have availability to one. Do you have an
> Access Database?
>
> --
> Jim Carlock
> http://www.microcosmotalk.com/
> Post replies to the newsgroup.
>
>
> "Troy Scott mindspringcom>" <tigerweld<removebrakets> wrote:
> no Jim, I need for it to be 14 rows with 3 columns. The first column will
> hold an ID Number, second column is Annual Income, and third column is
> Number of Persons. To be honest we have a terrible teacher for a
professor.
> He didn't go over arrays well and the whole class is lost.
>
> The user must be able to use a text box for Annual Income and ID Number,
the
> Number of Persons must be a combo box. User must be able to enter all
this
> data for 14 rows, then save it as a file, be able to load the file back
into
> the array and print it. I believe I can figure out the rest if I can just
> get started on entering the data into an array. Like I said the professor
> didn't go over this part at all, nor does the text book even mentions it!
>
> Thanks,
>
> Troy
>
> "Jim Carlock" <anonymous@127.0.0.1> wrote in message
> news:uX35TpeHEHA.2164@TK2MSFTNGP12.phx.gbl...
> > You will need to set up a loop to loop through the items.
> >
> > Dim i As Integer
> > For i = 1 To 13
> > mintIncomeSurvey(i, 1) = Val(Text1.Text)
> > '...whatever other code you need to set the other stuff up
> > Next i
> >
> > That would put the same value into the first column of the array
> > you have set up.
> >
> > Was there something that we might have overlooked?
> >
> > Did you want 13 text boxes? What exactly did you want
> > to accomplish. Feel free to describe it in real world terms,
> > ie, you'd like to store name and address information, you'd
> > like to set up a mortgage payment schedule, etc.
> >
> > Alot of times combo boxes are used to select items and
> > then information is put into other places, ie textboxes, see
> > real world example of javascript at:
> >
> > http://www.microcosmotalk.com/tech/scripts/
> >
> > Select a coutry out of the country combobox there. It's
> > not VB but the same thing can be done in VB.
> >
> > Let us know if that helps.
> >
> > --
> > Jim Carlock
> > http://www.microcosmotalk.com/
> > Post replies to the newsgroup.
> >
> >
> > "Troy Scott" wrote:
> > How is this going to work for 14 rows?
> >
> > Troy
> >
> > "Randy Birch" <rgb_removethis@mvps.org> wrote:
> > > mintIncomeSurvey(1, 1) = Val(Text1.Text)
> > > mintIncomeSurvey(1, 2) = Val(Text2.Text)
> > > mintIncomeSurvey(1, 3) = Val(Text3.Text)
> > >
> > > ... or ...
> > >
> > > If Combo1.ListIndex > -1 then
> > > mintIncomeSurvey(1, 1) = Val(Combo1.List(Combo1.ListIndex))
> > > end if
> > >
> > > ... or, if you're storing the numeric value in the combo item's
ItemData
> > > property ...
> > >
> > > If Combo1.ListIndex > -1 then
> > > mintIncomeSurvey(1, 1) = Combo1.ItemData(Combo1.ListIndex)
> > > end if
> > >
> > > ... then ...
> > >
> > > debug.print mintIncomeSurvey(1, 1)
> > > debug.print mintIncomeSurvey(1, 2)
> > > debug.print mintIncomeSurvey(1, 3)
> > >
> > > to see the values.
> > > --
> > >
> > > Randy Birch
> > > MVP Visual Basic
> > > http://vbnet.mvps.org/
> > > Please respond only to the newsgroups so all can benefit.
> > >
> > >
> > > "Troy Scott mindspring.com>" <tigerweld<removebrakets> wrote in
message
> > > news:eTW5gJeHEHA.3584@TK2MSFTNGP09.phx.gbl...
> > > : Hello, I'm a VB newbie and I am stumped! I'm trying to use two text
> > boxes
> > > : and a drop down list to enter data into an array and I don't know
how
> to
> > > : begin.
> > > :
> > > : This is all I have so far.
> > > :
> > > : Dim mintIncomeSurvey(1 To 14, 1 To 3) As Integer
> > > : Dim mintRowIndex As Integer
> > > : Dim mintColIndex As Integer
> > > :
> > > :
> > > : HELP!
> > > :
> > > : Troy
> > > :
> > > :
> > >
> >
> >
> >
>
>
>
- Next message: Tony Proctor: "Re: Removing White Space..."
- Previous message: Randy Birch: "Re: Monitoring File System Changes"
- In reply to: Jim Carlock: "Re: student question/ array"
- Next in thread: Jim Carlock: "Re: student question/ array"
- Reply: Jim Carlock: "Re: student question/ array"
- Reply: Larry Serflaten: "Re: student question/ array"
- Messages sorted by: [ date ] [ thread ]