got this code that i wrote the get all score and print end score but i didnt read right help me
exem is 40% assigments is 30% and participation is 30%
6 Replies
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace _1.cs
{
class Program
{
static void Main(string[] args)
{
Console.Write("Enter the grade for exams (0-100):");
int exem = int.Parse(Console.ReadLine());
Console.Write("Enter the grade for assignments (0-100):");
int assignments = int.Parse(Console.ReadLine());
Console.Write("Enter the grade for participation (0-100)");
int participation = int.Parse(Console.ReadLine());
Console.WriteLine((exem + assignments + participation) / 3);
Console.ReadLine();
}
}
}
that is code
how i do that exem are worth 40% of total score and assignments and participation are 30%
Weighted arithmetic mean
The weighted arithmetic mean is similar to an ordinary arithmetic mean (the most common type of average), except that instead of each of the data points contributing equally to the final average, some data points contribute more than others. The notion of weighted mean plays a role in descriptive statistics and also occurs in a more general form...
represent the weight as a decimal (e.g. 40% = 0.4), then multiply the weight of each grade category with the score for that category (e.g. if I got an average of 90 on my exams, 90*0.4 -- this get's you the "exam" category's contribution to the total weighted average). Do this for all grade categories and sum the results to get the final weighted average of all categories.
Note, what I wrote assumes the weights of all categories total to 100%
thanks
was thinking about it but didnt know how to like do it
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace _1.cs
{
class Program
{
static void Main(string[] args)
{
Console.Write("Enter the grade for exams (0-100):");
int exem = int.Parse(Console.ReadLine());
Console.Write("Enter the grade for assignments (0-100):");
int assignments = int.Parse(Console.ReadLine());
Console.Write("Enter the grade for participation (0-100)");
int participation = int.Parse(Console.ReadLine());
Console.WriteLine(((exem * 0.4) + (assignments * 0.3) + (participation*0.3)) / 3);
Console.ReadLine();
}
}
}
The "Basic Example" in @mg's link better suits your scenario:
because the weights don't sum to 100%
(to be clear, that math will be off [for these weights] in the version following my original instructions)
My dumbass did 40 + 30 + 30 = 110
This is almost right, but you don't need to divide by 3
Each category contributes a certain amount to the final score. Exams contribute 40%, assignments 30%, and participation 30%
Because everything is on the same scale (i.e. percentage points), you don't need to divide