Question
Write java code for the following: Project Description Natural Sciences and Engineering Research Council of Canada (NSERC) would like to build a system to maintain
Write java code for the following:
Project Description
Natural Sciences and Engineering Research Council of Canada (NSERC) would like to build a system to maintain grant applications. There are three users in the system, i.e., industry researcher (Iresearcher), academic researchers (Aresearcher), administrators (Administrator). The system stores a users basic information such as name, password (pw), and unique id (id).
Each application is developed by a team of at most ten applicants, it also has a unique id (id), description, name, and score. Only researchers can be valid applicants. A team has a leader and a set of members. A team leader can add/remove new team members and create new applications. Each application will be reviewed by a set of reviewers and a reviewer can be of either an academic researcher or an administrator. Only administrators can assign reviewers to an application. A reviewer can give numerical marks to an application that they are assigned. An applications score will be the average of marks from all the reviewers of the application.
We also provide a test case, i.e., TestApplication.java, which contains some implicit constraints regarding the logic of the project to be designed. Please read the test case carefully. Note that, you are not allowed to modify the test case.
Below is the test file:
TestApplication.java:
package test;
import static org.junit.Assert.*;
import java.util.ArrayList;
import java.util.List;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import yorku.ca.src.Administrator;
import yorku.ca.src.Application;
import yorku.ca.src.Aresearcher;
import yorku.ca.src.Iresearcher;
import yorku.ca.src.Team;
public class TestApplication {
@Before
public void setUp() throws Exception {
}
@After
public void tearDown() throws Exception {
}
@Test
public void test() {
//Initializing applicants;
String name1 = "greg", id1 = "nserc1001", pw1 = "123";
String name2 = "jeff", id2 = "nserc1002", pw2 = "123";
String name3 = "jackie", id3 = "nserc1003", pw3 = "123";
String name5 = "john", id5 = "nserc1005", pw5 = "123";
Iresearcher ir = new Iresearcher(name1, id1, pw1);
Aresearcher ar = new Aresearcher(name2, id2, pw2);
Aresearcher ar2 = new Aresearcher(name3, id3, pw3);
Aresearcher ar3 = new Aresearcher(name5, id5, pw5);
//Initializing admin
String name4 = "jack", id4 = "nserc1004", pw4 = "123";
Administrator admin = new Administrator(name4, id4, pw4);
//Initializing a team
ArrayList
member.add(ir);
member.add(ar);
member.add(ar3);
Applicant leader = ar2; //team leader
Team team = new Team(member, leader);
//a leader can create a NSERC application
String app_name = "mobile malware detection", project_id = "app1001", description = "bug detection";
Application app = leader.createApp(app_name, project_id, description, team);
//assign reviewers for the application
admin.assignReviewer(app, ar);
admin.assignReviewer(app, ar2);
admin.assignReviewer(app, ar3);
admin.assignReviewer(app, admin);
//reviewers evaluate the application and give scores
ar.grade(app, 80.0);
ar2.grade(app, 100.0);
ar3.grade(app, 30.0);
admin.grade(app, 90.0);
//get the score of the application
double score = app.getScore();
assertEquals(score, 75.0,0.001);
}
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started