QUESTION 1
A series of daily detections of people with a virus is stored in the CSV file “virus.txt”, the format of the file M is given below:
23/03/2020, 8
24/03/2020, 6
25/03/2020, 2
26/03/2020, 5
27/03/2020, 9
Write a program that reads the data from the file and create a report with the format
virus Detection Report
Date Detections
23/03/2020 8
24/03/2020 6
25/03/2020 2
26/03/2020 5
27/03/2020 9
Average = 6
Highest detections recorded = 9 on 27/03/2020
Days with detections > 5 = 3
Using the same file from above, produce a report that displays the number of days that had detections that were in the ranges 0, I-9,10-19,20-20,30+ Range Report
Range Number of Days
0 0
1-9 5
10-19 0
20-2 9 0
30+ 0
QUESTION 2
a) Write a class to represent a Student:
- The class should have three attributes to represent the students gender (string), fee (double), and a unique student number (int).
- Provide a default constructor that sets a unique value for the student number. Also, provide a single parameterized constructor that should Initialise the name and fee attributes to values that are passed to the constructor and sets a unique value for the student number.
- Provide getter and setter methods for the attributes.
- Provide a single method called CalcDiscount which returns a discount amount available to a student, the discount rate is 10% of the fee.
- Write a subclass of this Student class to represent a non-EU student. For this, you should an additional attribute for nationality (string). Also write a replacement method for the CalcDiscount method, where the discount rate for a non-EU student is 2%.
- Provide a ToString() methods for each class to return values of all of a students attributes and the available discount.
b) Write a Main() method in the program.cs class to use the Student and Non_EU classes. Here you will:
- Declare an array of 4 elements to store both student and Non_EU objects.
- Fill this array with two of each type of object, using your constructors
- Loop through the array and use the ToString() method to print the attributes for each student object and discount available.
