|
Throw out the highest and lowest grades -- Kyfanatic --
I need to write a function that will take all the grades and throw out the highest and lowest grades and then come up with the average for the remaining grades. How can I accomplish this? Thanks |
|
-- Cerebrus --
What code have you come up with so far ? What algorithm are you using ? |
|
-- BradleyPeter --
Yes, this sounds like another programming exercise. I agree strongly with Cerebrus. We are not here to do people's work for them, but to help them when they hit a problem they can't solve. Peter -----Original Message----- From: DotNetDevelopment on behalf of Cerebrus Sent: Sat 7/15/2006 11:46 AM To: DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting Cc: Subject: Re: Throw out the highest and lowest grades What code have you come up with so far ? What algorithm are you using ? |
|
-- StephenRussell --
Bradley, Peter <mailto:pbradley> wrote: Yes, this sounds like another programming exercise. I agree strongly with Cerebrus. We are not here to do people's work for them, but to help them when they hit a problem they can't solve. Well I may have a need to do this for a scoring system where we toss the highest and lowest score per area of judging. My schema was tending towards this: USE GO /****** Object: Table Script Date: 07/15/2006 11:55:41 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_PADDING ON GO CREATE TABLE ( NOT NULL, -- Pkey NULL, -- Contest Key NULL, -- Judge Key NULL, -- Sample Key (relates back to team) NULL, -- Style of Meat (shoulder, rib, wholehog, etc..) NULL, -- Question Key (18, 0) NULL, -- Value given by Judge. (1000) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, CONSTRAINT PRIMARY KEY CLUSTERED ( ASC )WITH (IGNORE_DUP_KEY = OFF) ON ) ON GO SET ANSI_PADDING OFF For QIDs I can have up to 8 different entries. (Tenderness, Taste, smokyness,...) For judges to a contest I will have 4 to 7 depending on how many were available. So how do I toss out the highest and lowest score for a qid,typeid, entryid, eventid ? Scores range from 10 -> 1 where most values are in the 9 to 7 range. Stephen Russell DBA / Operations Developer Memphis TN 38115 901.246-0159 http://spaces.msn.com/members/srussell /-- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.394 / Virus Database: 268.10.1/389 - Release Date: 7/14/2006 |
|
-- BradleyPeter --
Are you on the right list? This list is for .NET development - C# and VB.NET. Peter -----Original Message----- From: DotNetDevelopment on behalf of Stephen Russell Sent: Sat 7/15/2006 6:15 PM To: DotNetDevelopment Cc: Subject: Re: Throw out the highest and lowest grades Bradley, Peter <mailto:pbradley> wrote: Yes, this sounds like another programming exercise. I agree strongly with Cerebrus. We are not here to do people's work for them, but to help them when they hit a problem they can't solve. Well I may have a need to do this for a scoring system where we toss the highest and lowest score per area of judging. My schema was tending towards this: USE GO /****** Object: Table Script Date: 07/15/2006 11:55:41 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_PADDING ON GO CREATE TABLE ( NOT NULL, -- Pkey NULL, -- Contest Key NULL, -- Judge Key NULL, -- Sample Key (relates back to team) NULL, -- Style of Meat (shoulder, rib, wholehog, etc..) NULL, -- Question Key (18, 0) NULL, -- Value given by Judge. (1000) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, CONSTRAINT PRIMARY KEY CLUSTERED ( ASC )WITH (IGNORE_DUP_KEY = OFF) ON ) ON GO SET ANSI_PADDING OFF For QIDs I can have up to 8 different entries. (Tenderness, Taste, smokyness,...) For judges to a contest I will have 4 to 7 depending on how many were available. So how do I toss out the highest and lowest score for a qid,typeid, entryid, eventid ? Scores range from 10 -> 1 where most values are in the 9 to 7 range. Stephen Russell DBA / Operations Developer Memphis TN 38115 901.246-0159 http://spaces.msn.com/members/srussell /-- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.394 / Virus Database: 268.10.1/389 - Release Date: 7/14/2006 |
|
-- StephenRussell --
Bradley, Peter <mailto:pbradley> wrote: Are you on the right list? This list is for .NET development - C# and VB.NET. That will be the interface I'll be doing the work in, eventually. Data will be in SQL, but it's going to get done either way, on the server or the bizClass. Bradley, Peter <mailto:pbradley> wrote: Yes, this sounds like another programming exercise. I agree strongly with Cerebrus. We are not here to do people's work for them, but to help them when they hit a problem they can't solve. Well I may have a need to do this for a scoring system where we toss the highest and lowest score per area of judging. My schema was tending towards this: USE GO /****** Object: Table Script Date: 07/15/2006 11:55:41 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_PADDING ON GO CREATE TABLE ( NOT NULL, -- Pkey NULL, -- Contest Key NULL, -- Judge Key NULL, -- Sample Key (relates back to team) NULL, -- Style of Meat (shoulder, rib, wholehog, etc..) NULL, -- Question Key (18, 0) NULL, -- Value given by Judge. (1000) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, CONSTRAINT ASC )WITH (IGNORE_DUP_KEY = OFF) ON ) ON GO SET ANSI_PADDING OFF For QIDs I can have up to 8 different entries. (Tenderness, Taste, smokyness,...) For judges to a contest I will have 4 to 7 depending on how many were available. So how do I toss out the highest and lowest score for a qid,typeid, entryid, eventid ? Scores range from 10 -> 1 where most values are in the 9 to 7 range. Stephen Russell DBA / Operations Developer Memphis TN 38115 901.246-0159 http://spaces.msn.com/members/srussell /-- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.394 / Virus Database: 268.10.1/389 - Release Date: 7/14/2006 |
|
-- BradleyPeter --
OK. I'd do it in SQL, in a stored procedure, and call the SP from your code. Peter -----Original Message----- From: DotNetDevelopment on behalf of Stephen Russell Sent: Sun 7/16/2006 2:34 AM To: DotNetDevelopment Cc: Subject: Re: Throw out the highest and lowest grades Bradley, Peter <mailto:pbradley> wrote: Are you on the right list? This list is for .NET development - C# and VB.NET. That will be the interface I'll be doing the work in, eventually. Data will be in SQL, but it's going to get done either way, on the server or the bizClass. Bradley, Peter <mailto:pbradley> wrote: Yes, this sounds like another programming exercise. I agree strongly with Cerebrus. We are not here to do people's work for them, but to help them when they hit a problem they can't solve. Well I may have a need to do this for a scoring system where we toss the highest and lowest score per area of judging. My schema was tending towards this: USE GO /****** Object: Table Script Date: 07/15/2006 11:55:41 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_PADDING ON GO CREATE TABLE ( NOT NULL, -- Pkey NULL, -- Contest Key NULL, -- Judge Key NULL, -- Sample Key (relates back to team) NULL, -- Style of Meat (shoulder, rib, wholehog, etc..) NULL, -- Question Key (18, 0) NULL, -- Value given by Judge. (1000) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, CONSTRAINT ASC )WITH (IGNORE_DUP_KEY = OFF) ON ) ON GO SET ANSI_PADDING OFF For QIDs I can have up to 8 different entries. (Tenderness, Taste, smokyness,...) For judges to a contest I will have 4 to 7 depending on how many were available. So how do I toss out the highest and lowest score for a qid,typeid, entryid, eventid ? Scores range from 10 -> 1 where most values are in the 9 to 7 range. Stephen Russell DBA / Operations Developer Memphis TN 38115 901.246-0159 http://spaces.msn.com/members/srussell /-- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.394 / Virus Database: 268.10.1/389 - Release Date: 7/14/2006 |
|
-- StephenRussell --
Bradley, Peter <mailto:pbradley> wrote: OK. I'd do it in SQL, in a stored procedure, and call the SP from your code. I agree. At best I got a SP with a cursor. I am going to look at it in a VS2005 environment, but I haven't started at it as of yet. I just hopped on the existing thread, with a real client based Q, and not an academic trial. :) -----Original Message----- From: DotNetDevelopment on behalf of Stephen Russell Sent: Sun 7/16/2006 2:34 AM To: DotNetDevelopment Cc: Subject: Re: Throw out the highest and lowest grades Bradley, Peter <mailto:pbradley> wrote: Are you on the right list? This list is for .NET development - C# and VB.NET. That will be the interface I'll be doing the work in, eventually. Data will be in SQL, but it's going to get done either way, on the server or the bizClass. Bradley, Peter <mailto:pbradley> wrote: Yes, this sounds like another programming exercise. I agree strongly with Cerebrus. We are not here to do people's work for them, but to help them when they hit a problem they can't solve. Well I may have a need to do this for a scoring system where we toss the highest and lowest score per area of judging. My schema was tending towards this: USE GO /****** Object: Table Script Date: 07/15/2006 11:55:41 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_PADDING ON GO CREATE TABLE ( NOT NULL, -- Pkey NULL, -- Contest Key NULL, -- Judge Key NULL, -- Sample Key (relates back to team) NULL, -- Style of Meat (shoulder, rib, wholehog, etc..) NULL, -- Question Key (18, 0) NULL, -- Value given by Judge. (1000) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, CONSTRAINT ASC )WITH (IGNORE_DUP_KEY = OFF) ON ) ON GO SET ANSI_PADDING OFF For QIDs I can have up to 8 different entries. (Tenderness, Taste, smokyness,...) For judges to a contest I will have 4 to 7 depending on how many were available. So how do I toss out the highest and lowest score for a qid,typeid, entryid, eventid ? Scores range from 10 -> 1 where most values are in the 9 to 7 range. Stephen Russell DBA / Operations Developer Memphis TN 38115 901.246-0159 http://spaces.msn.com/members/srussell /-- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.394 / Virus Database: 268.10.1/389 - Release Date: 7/14/2006 |
|
-- BradleyPeter --
Stephen, We've thrown this around in the office quite a bit, but the only way we've come up with is, like you, to use a cursor. That's likely to be quite slow, so you'll probably want to do it asynchronously. I shouldn't really be trying to help with this, either. I'm a vegetarian :) (And well hopped!) Peter -----Original Message----- From: DotNetDevelopment Re: Throw out the highest and lowest grades Bradley, Peter <mailto:pbradley> wrote: OK. I'd do it in SQL, in a stored procedure, and call the SP from your code. I agree. At best I got a SP with a cursor. I am going to look at it in a VS2005 environment, but I haven't started at it as of yet. I just hopped on the existing thread, with a real client based Q, and not an academic trial. :) -----Original Message----- From: DotNetDevelopment on behalf of Stephen Russell Sent: Sun 7/16/2006 2:34 AM To: DotNetDevelopment Cc: Subject: Re: Throw out the highest and lowest grades Bradley, Peter <mailto:pbradley> wrote: Are you on the right list? This list is for .NET development - C# and VB.NET. That will be the interface I'll be doing the work in, eventually. Data will be in SQL, but it's going to get done either way, on the server or the bizClass. Bradley, Peter <mailto:pbradley> wrote: Yes, this sounds like another programming exercise. I agree strongly with Cerebrus. We are not here to do people's work for them, but to help them when they hit a problem they can't solve. Well I may have a need to do this for a scoring system where we toss the highest and lowest score per area of judging. My schema was tending towards this: USE GO /****** Object: Table Script Date: 07/15/2006 11:55:41 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_PADDING ON GO CREATE TABLE ( NOT NULL, -- Pkey NULL, -- Contest Key NULL, -- Judge Key NULL, -- Sample Key (relates back to team) NULL, -- Style of Meat (shoulder, rib, wholehog, etc..) NULL, -- Question Key (18, 0) NULL, -- Value given by Judge. (1000) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, CONSTRAINT ASC ) ON GO SET ANSI_PADDING OFF For QIDs I can have up to 8 different entries. (Tenderness, Taste, smokyness,...) For judges to a contest I will have 4 to 7 depending on how many were available. So how do I toss out the highest and lowest score for a qid,typeid, entryid, eventid ? Scores range from 10 -> 1 where most values are in the 9 to 7 range. Stephen Russell DBA / Operations Developer Memphis TN 38115 901.246-0159 http://spaces.msn.com/members/srussell /-- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.394 / Virus Database: 268.10.1/389 - Release Date: 7/14/2006 |
|
-- StephenRussell --
Bradley, Peter <mailto:pbradley> wrote: Stephen, We've thrown this around in the office quite a bit, but the only way we've come up with is, like you, to use a cursor. That's likely to be quite slow, so you'll probably want to do it asynchronously. I shouldn't really be trying to help with this, either. I'm a vegetarian :) We have had a vegitarian as a judge once before. It was in 2004 or was it 03??? Thanks. I see this as a good test on a C# sp, and not the same old T-SQL's of the past. Stephen Russell DBA / Operations Developer Memphis TN 38115 901.246-0159 http://spaces.msn.com/members/srussell /-- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.394 / Virus Database: 268.10.1/389 - Release Date: 7/14/2006 |