Starting from:

$25

CO225 - Software Construction - Lab 05 I/O -Solved

Objectives:

The major objectives of this laboratory class are to

(1)  learn the idea of objects which have their own attributes and methods. Some attributes might be specific to the class and some might be to an instance.

(2)  learn

•  how to read data from a file,

•  how to generate random numbers

•  creating arrays of objects

Task 01:

There are 61 students in the CO225 class – at least registered for the class as of now. We want to track the attendance of all students and display the number of students who have less than 80% attendance.

Your first task is to develop a Java class called Student with suitable attributes and methods including a constructor. Each student is identified with their surname (only the surname with no initials for technical reasons. If there are more than one students with the same surname, registration number is added at the end of the surname. ). The surnames of all the students are given in a file called co225-classlist.txt which can be downloaded from Moodle. All students are expected to come for 45 lecture sessions. When creating a student you are required to give his/her name and random integer (0 <= attendance <= 45 ) denoting his/her attendance. The student class should provide suitable methods to;

●     get the attendance percentage of a student and,

●     get the average attendance percentage of all the students.

Once you have created the Student class, create a Main class which has the main method in it. Inside the main method create an array of 61 students. Create 61 student objects using the names given in the co225-classlist.txt file.Then display the names of students whose attendance percentage is less than 80% and save those names to a separate text file (co225-classlist-ineligible.txt). At the same time , you need to update names whose attendance percentage is less than 80 in the co225-classlist.txt file as follows.

Let’s say there is a student with the surname “Abc” and less than 80% attendance.

Then that surname should  be updated as “Abc-ineligible” in the co225-classlist.txt file.


More products