Answer to Question #69431 in C# for Amandeep kaur

Question #69431
2. Write a program that computes a weighted average giving the following weights.
Homework: 10%
Projects: 35%
Quizzes: 10%
Exams: 30%
Final Exam: 15%
Do a compile-time initialization with the following values:Homework: 97; Projects: 82; Quizzes: 60; Exams: 75; Final Exam 80. Display all values, including the weights, appropriately labeled and formatted. Rerun the application with different values.
1
Expert's answer
2017-08-01T06:14:10-0400
using System.IO;
using System;

/*
Write a program that computes a weighted average giving the following weights.
Homework: 10%
Projects: 35%
Quizzes: 10%
Exams: 30%
Final Exam: 15%
Do a compile-time initialization with the following values:
Homework: 97;
Projects: 82;
Quizzes: 60;
Exams: 75;
Final Exam 80.
Display all values, including the weights, appropriately labeled and formatted.
Rerun the application with different values.
*/

class Program
{
static void Main(){
//weights
int HomeworkWeight=10;
int ProjectsWeight=35;
int QuizzesWeight=10;
int ExamsWeight=30;
int FinalExamWeight=15;

//values
int Homework=97;
int Projects=82;
int Quizzes=60;
int Exams= 75;
int FinalExam=80;

//other values
/*
int Homework=90;
int Projects=75;
int Quizzes=80;
int Exams= 64;
int FinalExam=82;
*/

Console.WriteLine("Homework value={0}\tHomework Weight={1}%", Homework, HomeworkWeight);
Console.WriteLine("Projects value={0}\tProjects Weight={1}%", Projects, ProjectsWeight);
Console.WriteLine("Quizzes value={0}\tQuizzes Weight={1}%", Quizzes, QuizzesWeight);
Console.WriteLine("Exams value={0}\t\tExams Weight={1}%", Exams, ExamsWeight);
Console.WriteLine("FinalExam value={0}\tFinalExam Weight={1}%", FinalExam,FinalExamWeight);
Console.WriteLine("Result={0}", (Homework*HomeworkWeight+
Projects*ProjectsWeight+
Quizzes*QuizzesWeight+
Exams*ExamsWeight+
FinalExam*FinalExamWeight)/100);


}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS