Question: Create an Application using C#. Which Adds, Edits, and Deletes assignments onto a storage medium, with grades per studentper assignment. Assignments must be separated into
Create an Application using C#. Which Adds, Edits, and Deletes assignments onto a storage medium, with grades per studentper assignment. Assignments must be separated into 2 groups- Homework and Test. Grades for each group per student must be calculated along with an overall grade for each student (given in both percentage and Letter grade).
a.Program must include
i.Subprograms with parameter passing
ii.Abstract Data types
iii.Encapsulation
iv.Exception/ Error Handling
v.Must verify only valid scores are entered per assignment
vi.Documented for maintenance purposes
This is the code I have so far, can someone fix the errors:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Project
{
public class Assignment
{
static void Main(string [] args)
{
string type;
double mark;
public Assignment(string type, double mark)
{
this.type = type;
this.mark = mark;
}
double getMark()
{
return mark;
}
}
class Student
{
string name;
double grade;
string letterGrade;
// list of Assignments
ArrayList AssignmentList = new ArrayList();
Student(string name)
{
this.name = name;
}
void addAssignment(Assignment A)
{
AssignmentList.Add(A);
}
void deleteAssignment(Assignment A)
{
AssignmentList.Remove(A);
}
void editAssignment(Assignment A, string type, double mark)
{
AssignmentList.Remove(A);
AssignmentList.Add(new Assignment(type, mark));
//AssignmentList.Add(A);
}
void calculateGrade()
{
grade = 0;
foreach (Assignment assignment in AssignmentList)
{
grade += assignment.getMark();
}
grade = grade / AssignmentList.Count;
}
void calculateLetterGrade()
{
if (grade > 90 && grade <= 100)
{
Console.WriteLine("A grade");
}
else if (grade > 80 && grade <= 90)
{
Console.WriteLine("B grade");
}
else if (grade > 70 && grade <= 80)
{
Console.WriteLine("C grade");
}
else if (grade > 60 && grade <= 70)
{
Console.WriteLine("D grade");
}
else if (grade > 50 && grade <= 60)
{
Console.WriteLine("E grade");
}
else
{
Console.WriteLine("F grade"); //fail
}
}
}
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
