Welcome to Tech Support Forum home to more then 136,000 problems solved. Issues have included: Spyware, Malware, Virus Issues, Windows, Microsoft, Linux, Networking, Security, Hardware, and Gaming Getting your problem solved is as easy as:
1. Registering for a free account
2. Asking your question
3. Receiving an answer

Registered members:
* Get free support
* Communicate privately with other members (PM).
* Removal of this message
* See fewer ads.
* And much more..

 





Want to know how to post a question? click here Having problems with spyware and pop-ups? First Steps
Go Back   Tech Support Forum > The Conversation Pit > Programming
User Name
Password
Site Map Register Donate Rules Blogs Mark Forums Read

Programming A discussion forum for programs and programming used in tech-related businesses.

Reply
 
Thread Tools
Old 03-18-2008, 09:36 AM   #1 (permalink)
Registered User
 
Join Date: Mar 2008
Posts: 2
OS: vista


algorithms help

Here is the problem:

1. Given an array of student grades, write an algorithm using the pseudocode from the book to
determine the highest grade, lowest grade and average grade. (You may be able to write this as
one algorithm or as three algorithms.)
2. A park ranger has been keeping track of the deer population in a national park. Her theory is
that the springtime deer population depends on the lowest temperature from the preceeding
winter according to the following:
Temperature of 0oF or colder: deer population drops by 12%
Temperature higher than 0oF: deer population increases by 15%
Assuming the deer population starts at 1000 and assuming you have available a function called
“getLowestTemperature” to get the lowest winter temperature, write an algorithm, using the
pseudocode from the book, to determine the deer population each spring for 15 consecutive
years.
missionduo is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Bookmark on Thread SoupReddit!
Reply With Quote
Old 04-03-2008, 01:51 PM   #2 (permalink)
Registered User
 
Lawand's Avatar
 
Join Date: Dec 2007
Location: Damascus, Syria
Posts: 23
OS: Windows XP PRO SP3 / Ubuntu 8.04


Re: algorithms help

what exact issues are you facing while trying to solve this problem?
__________________
Bugs mysteriously appear when you say, "Watch this!"
corollary: If you call another programmer over to see if he knows what's wrong the bug disappears!
Lawand is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Bookmark on Thread SoupReddit!
Reply With Quote
Old 04-22-2008, 11:44 PM   #3 (permalink)
Registered User
 
Join Date: Dec 2007
Posts: 7
OS: XP


Re: algorithms help

Your question reeks of homework. But here's the answer to the first question.

public void printGradeInfo(int[] grades)
{
double min = max = averageSum = 0;
for (int i = 0; i < grades.length; i++)
{
if (min > grades[i])
{
min = grades[i]
}
if (max < grades[i])
{
max = grades[i]
}
averageSum += grades[i]
}
Console.WriteLine(min);
Console.WriteLine(max);
Console.WriteLine(averageSum/grades.length);
}
joblow11 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Bookmark on Thread SoupReddit!
Reply With Quote
Old 04-23-2008, 01:02 AM   #4 (permalink)
Registered User
 
Join Date: Apr 2008
Posts: 3
OS: XP Pro, SP2


Re: algorithms help

Don't you need to initialise min to a high value rather than zero?
g_saint is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Bookmark on Thread SoupReddit!
Reply With Quote
Old 04-23-2008, 01:28 PM   #5 (permalink)
Registered User
 
Join Date: Dec 2007
Posts: 7
OS: XP


Re: algorithms help

Woops...you're right. It should be 4.0 or something.
joblow11 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Bookmark on Thread SoupReddit!
Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



All times are GMT -7. The time now is 09:00 AM.



Copyright 2001 - 2008, Tech Support Forum

Search Engine Friendly URLs by vBSEO

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81