PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Homework Help

Hi, well, i know a lot of you are programmers, and I hope that some of you know VB. I have some problem with some of my comp prog hw, can someone help? here are the questions:

1. The city of Cary is holding a special census. The census takers collect one record for each citizen as follows:

CENSUS FILE DESCRIPTION
File name: Census
Not sorted
FIELD DESCRIPTION POSITIONS DATA TYPE DECIMALS
Age 1-3 Numeric 0
Gender 4 Character
Martial status 5 Character
Voting District 6-7 Numeric 0

The voting district field contains a number from 1 through 22

Design the report, draw the hierarchy chart, and draw the logic of the program that would produce a count of the number of citizens residing in each of the 22 voting districts.


EDIT--DAMMIT, IT KEEPS SCREWING THE FORM UP

gaah, ignore this thread--i cant seem to post it right
Well then, while we're here, why don't you guys help ME with MY homework?

Write a procedure to find the tangent line to a function f at a given x-value.
This is in MAPLE7, not some C++ or anything like that. I feel so stupid because I can't get it to work and I'm not even sure I'm doing it right. My old math teacher at high school was so great, but I've just fallen apart since I haven't had any math like I did in high school.

All I do is take the derivative of the function, plug in the given x-value, and then use the slope-point formula to calculate the equation of the line, then output that. Right?
How would I check for errors? Like x would have to be numeric, but there's no way to restrict f... oh well. And my program always comes up with something weird... I don't know.

Code:
tangline:=proc(f,x1::numeric)
func:=f:
y1:=func(x)
func:=D(func):
m:=func(x1):
y=m*x-m*x1+y1;
end:


That's what I've got so far.

Now here's my call and output:
Code:
> tangline(x,1);

y = D(x)(1) x - D(x)(1) + x(x)

That looks like it says it's x^2+x-1 dx... but how can a tangent line be a polynomial like that? shouldn't it just be a straight line?

[edit] Okay, I say that I was doing f of x and needed to do f of x1 at the beginning... that helped some. Now the output for that same thing is 2x-1 :/
Ok, i have a different question that doesnt involve the stupid data table. Here goes:

Each week, the home office for a fast-food restaurant franchise distributes a ffile containing new prices for the items it carries. The file contains the item name and current price. Create a flowchart or pseudocode for a program that loads the current values into arrays. Then the program reads in a customer record containing a customer number nd item name, and prints either the correct price or the message, "Sorry, we do not cary that" as output.

I hope someone finds it in their heart to help moose and me. PLEASE!!!! *weeps on knees*
Well... I think I figured out my problem. I just used a Ti-86 graphing calculator... but uhm, how do I simplify the answer and get rid of all of those zero's and D(x)'s that mean NOTHING! AHHH BOO HOO HOOOOOO
help!!!
My advice to you guys is to read the previous chapters and look at the example code. Usually those school programming books tell you everything you need to know in the previous chapters. Infact if you look at the sample code for all the different functions, really close, they practically have written your whole program in the book. You just have to understand what they are doing. But you really should figure out your algorithims yourself, so you understand how they work.

Programming developing process:

1. Get an idea of what you have to do.
2. Open up your complier/interpreter,think about the problem, look at sample code for inspiration.
3. Once you have an idea of how to write your code, then begin writing code.
4. Debug.
5. If it didn't work, look at your code again and repeat steps 1 - 5.

You will probably do this process many many times, but that's what programming is all about.

If you absolutely can't figure it out, then post your code in a programming forum dedicated to your programming launguage, and ask others for help.
But only do this if you absolutely have to. There have been many times I have been tempted to ask for help, but I kept trying to do it myself and I figured it out.

Nicodemus, instead of posting the problem to be solved, try thinking how you can do it. I haven't even seen any code from you. Trust me, you don't want others to make algorithims for you. You will never learn to program if they do.


Moose, you're on the right path. I don't know your language, so I'm not much help. Wait for somebody else to help you and in the mean time, keep trying. You may figure it out before anybody helps you.
Okay, I just took out my calculator and drew an X^2+1 line, which the tangent for is obviously y=1, and that's the output I got... after I mentally removed all of the useless dx's and 1's and 0's :/