Need help with this assignment I don\'t understand what is it asking I\'m very n
ID: 3777904 • Letter: N
Question
Need help with this assignment I don't understand what is it asking I'm very new to programming explanation of steps will be highly appreciated.
Alternative Coding
It can be difficult to know the efficiency of using certain coding mechanisms without having worked with a language where those tools don’t exist. C# streamlines certain activities, like accessing certain objects and displaying text on the screen. Let’s see “how the other half lives!” Code the Grades project from Exercise 3-1, such that you obtain the same output, including formatting/positioning, WITHOUT including the "using" keyword OR any calls to Writeline.
HINT: "System.XYZ…." accesses class “XYZ” within the namespace “System”.
//Exercise 3-1
using System;
class Grades {
public static void Main(string[] args) {
const float MIDTERM_PERCENTAGE = .25F;
const float FINALEXAM_PERCENTAGE = .25F;
const float RESEARCH_PERCENTAGE = .30F;
const float PRESENTATION_PERCENTAGE = .20F;
int midterm = 70;
int finalExamGrade = 80;
int research = 90;
int presentation = 100;
float finalNumericGrade = 0;
finalNumericGrade =
(midterm * MIDTERM_PERCENTAGE) +
(finalExamGrade * FINALEXAM_PERCENTAGE) +
(research * RESEARCH_PERCENTAGE) +
(presentation * PRESENTATION_PERCENTAGE);
Console.WriteLine("Midterm grade is : " + midterm);
Console.WriteLine("Final Exam grade is : " + finalExamGrade);
Console.WriteLine("Research grade is : " + research);
Console.WriteLine("Presentation grade is: " + presentation);
Console.WriteLine(" The final grade is: " + finalNumericGrade);
}
}
Explanation / Answer
using System.IO;
using System;
class Grades {
public static void Main(string[] args) {
const float MIDTERM_PERCENTAGE = .25F;
const float FINALEXAM_PERCENTAGE = .25F;
const float RESEARCH_PERCENTAGE = .30F;
const float PRESENTATION_PERCENTAGE = .20F;
int midterm = 70;
int finalExamGrade = 80;
int research = 90;
int presentation = 100;
float finalNumericGrade = 0;
finalNumericGrade =
(midterm * MIDTERM_PERCENTAGE) +
(finalExamGrade * FINALEXAM_PERCENTAGE) +
(research * RESEARCH_PERCENTAGE) +
(presentation * PRESENTATION_PERCENTAGE);
Console.WriteLine("Midterm grade is : " + midterm);
Console.WriteLine("Final Exam grade is : " + finalExamGrade);
Console.WriteLine("Research grade is : " + research);
Console.WriteLine("Presentation grade is: " + presentation);
Console.WriteLine(" The final grade is: " + finalNumericGrade);
}
}
-------output---------------
Midterm grade is : 70
Final Exam grade is : 80
Research grade is : 90
Presentation grade is: 100
The final grade is: 84.5
-------------output ends--------
// Now we are removing the using System namespace
class Grades {
public static void Main(string[] args) {
const float MIDTERM_PERCENTAGE = .25F;
const float FINALEXAM_PERCENTAGE = .25F;
const float RESEARCH_PERCENTAGE = .30F;
const float PRESENTATION_PERCENTAGE = .20F;
int midterm = 70;
int finalExamGrade = 80;
int research = 90;
int presentation = 100;
float finalNumericGrade = 0;
finalNumericGrade =
(midterm * MIDTERM_PERCENTAGE) +
(finalExamGrade * FINALEXAM_PERCENTAGE) +
(research * RESEARCH_PERCENTAGE) +
(presentation * PRESENTATION_PERCENTAGE);
// to access the Writeline we need to access directly using System.Console.WriteLine
System.Console.WriteLine("Midterm grade is : " + midterm);
System.Console.WriteLine("Final Exam grade is : " + finalExamGrade);
System.Console.WriteLine("Research grade is : " + research);
System.Console.WriteLine("Presentation grade is: " + presentation);
System.Console.WriteLine(" The final grade is: " + finalNumericGrade);
}
}
-------output---------------
Midterm grade is : 70
Final Exam grade is : 80
Research grade is : 90
Presentation grade is: 100
The final grade is: 84.5
-------------output ends--------
Note: Please ask doubts if any. God bless you!!