/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package mycode;

/**
 *
 * @author Robin
 */
//Question 3
//Q3.1 - 3
//class header correct
public class ResearchPaper {
    //all properties named and typed correctly
    private String title;
    private String department;
    private boolean meetsDeptRequirements;
    private String reqCode;
    private String studentID;
    
    //Q3.2 - 3
    //constant declared with final/constant
    //named and typed correctly
    //assigned correctly
    public static final int DEAN_MIN_PAGES = 200;
    
    //Q3.3 - 4
    //header correct
    //parameter named correctly
    //typed correctly
    public ResearchPaper(String inTE, String inDT, boolean inMDR, String inRC , String inSID)
    {
        //properties assigned correctly
        title = inTE;
        department = inDT;
        meetsDeptRequirements = inMDR;
        reqCode = inRC;
        studentID = inSID;
    }
    
    //Q3.4 - 2
    //correct header and return types for all four getters
    public String getTitle() {
        return title;
    }

    public String getDepartment() {
        return department;
    }
    
    public boolean getMeetsDeptRequirements()
    {
        return meetsDeptRequirements;
    }

    public String getReqCode() {
        return reqCode;
    }

    public String getStudentID() {
        return studentID;
    }
    
    //Q6.1 - 7
    //header correct
    public boolean onDeansList()
    {
        //extract pages, peer reviewed and fieldResearch
        
        int pages = Integer.parseInt(reqCode.substring(0, reqCode.length() - 2));
        
        boolean peerReviewed = reqCode.charAt(reqCode.length()-2) == 'T';
        
        boolean fieldResearch = reqCode.charAt(reqCode.length()-1) == 'T';
        
        //all conditions combined correctly
        //makes use of the constant
        return meetsDeptRequirements && pages>= DEAN_MIN_PAGES && peerReviewed && fieldResearch; 
        //returned correctly
    }
    //Q3.7 - 5
    //header correct
    public String toString()
    {
        String r = "";
        //all fields included
        //format correct
        r = r + "Title: " + title + "\n";
        r = r + "Author: " + studentID + "\n";
        //calling the method
        r = r + "Meets " + department + "'s requirements: " + meetsDeptRequirements;
        
        //correctly returned
        return r;
    }
    
    
    

}