Laboratory 13: Law of Demeter Java API Javadoc for EasyGridBag In this lab, you will be designing and implementing the model portion of the Model-View-Controller design pattern. You will need a set of...

1 answer below »
Please double check and test.Thanks


Laboratory 13: Law of Demeter Java API Javadoc for EasyGridBag In this lab, you will be designing and implementing the model portion of the Model-View-Controller design pattern. You will need a set of classes (a model) to allow the LabManager GUI to track the progress of CSC 2121 lab students throughout the semester. The number of CSC 2121 sections that the LabManager will be working with is specified in the main method. In this lab, there will be two sections. Each section will have a different number of students, with the data for each section read in from and stored to a separate text file. The text file will store (in a comma delimited file) student ID, student name, lab grade and partner ID for each completed lab (14 total). A student is assigned a random partner each lab period. An odd number of students present for a given lab will result in one randomly chosen student as their own partner. If a student is present for the lab and works on the lab with their partner for the entire class, that student (and partner) receives a default 'D' for the lab, even if the lab is not complete or has several major issues. Completion of the lab before the final due date specified in the syllabus results in an A, B, C, or D depending on how many major or minor issues are still present in the final lab submission. From the CSC 2121 syllabus: Interpreting your ilearn grade: • A: lab completed with no issues (1.00 points) • B: lab completed with a few minor issues (0.75 points) • C: lab completed with a few major issues (0.50 points) • D: lab not completed or several major issues (0.25 points) • F: lab not attended or not working with partner (0.00 points) o if you have 2 or more Fs, you cannot pass lab Final Grade: • A: >= 13.25 points • B: >= 11.00 points • C: >= 8.50 points • D: >= 4.50 points Lab: • Model-View-Controller Design Pattern • Class Cohesion and Separation of Responsibilities • Complete and Consistent Protocol • Law of Demeter • Expert Pattern file:///C:/Users/luke3/Desktop/OOP/Programs/Program03/APIdocs/api/index.html file:///C:/Users/luke3/Desktop/OOP/Programs/Program03/13-Law%20of%20Demeter/javadoc/EasyGridBag/index.html Part I: Class Cohesion and Separation of Responsibilities Most of the work for the actual GUI has been completed for you. Thus, your model must interface with the GUI using the protocol listed in Part II. This means that your model will include, at a minimum, a Sections class. Try to determine what minimal set of classes that you need to perform the duties described at the top of the lab. You are only concerned with the classes required to store the data (the model), not the GUI. Remember that classes have knowing, doing, or controlling responsibilities (separation of responsibilities). The Expert pattern also suggests that classes responsible for knowing data should manipulate it (so some classes may have both knowing and doing responsibilities). Make sure that you adhere to the Law of Demeter in your design, and consider any additional classes that may be needed for proper class cohesion. Download the following files: • Random.java //no work • Lab.java //no work • Labs.java //no work • Student.java • Students.java • Section.java • Sections.java Part II: Model and Law of Demeter Using the classes provided in the previous part, implement the following public interface for a Sections class so that it can interact with the GUI (some of these methods may have been completed for you): • Sections(int num_sections, double[] grade_constants, int total_num_labs) //constructor • int getNumSections() • int getNumStudents(int sectionID) //the number of students in a given section • int getNumLabs(int sectionID) //the number of labs completed by the class for a given section • int getNumLabs(int sectionID, int studentID) //the number of labs completed by an individual student • int getPartnerID(int sectionID, int studentID, int labID) //a student's partner for a given lab (note consistent parameter ordering) • String getStudentName(int sectionID, int studentID) • boolean isPresent(int sectionID, int studentID, int labID) • String studentInfo(int sectionID, int studentID) //all lab grades for a single student (used in top text box in GUI) • String partnerList(int sectionID, int labID) //list of partners for the requested lab • void computePartners(int sectionID) //randomly assign partners for the lab • boolean isActive(int sectionID, int studentID) //is student still in the class? • void setInactive(int sectionID, int studentID) //student has withdrawn • void setNotPresent(int sectionID, int studentID, int labID) //student absent for lab (simply set the lab grade to F) • void setGrade(int sectionID, int studentID, int labID, char grade) //update the student's grade for the lab (and partner's) • void addLab(int sectionID) //starting a new lab • void writeFiles() • can you identify any additional essential methods to form a complete protocol? file:///C:/Users/luke3/Desktop/OOP/Programs/Program03/13-Law%20of%20Demeter/Lab13/Random.java file:///C:/Users/luke3/Desktop/OOP/Programs/Program03/13-Law%20of%20Demeter/Lab13/Lab.java file:///C:/Users/luke3/Desktop/OOP/Programs/Program03/13-Law%20of%20Demeter/Lab13/Labs.java file:///C:/Users/luke3/Desktop/OOP/Programs/Program03/13-Law%20of%20Demeter/Lab13/Student.java file:///C:/Users/luke3/Desktop/OOP/Programs/Program03/13-Law%20of%20Demeter/Lab13/Students.java file:///C:/Users/luke3/Desktop/OOP/Programs/Program03/13-Law%20of%20Demeter/Lab13/Section.java file:///C:/Users/luke3/Desktop/OOP/Programs/Program03/13-Law%20of%20Demeter/Lab13/Sections.java • add at least one convenience method (calls essential methods to perform a task) Note: IDs passed as parameters are 1-based! Note that the method signatures (studentID and labID passed as parameters with a consistent ordering) imply that the Law of Demeter is followed by the GUI. That is, instead of obtaining a reference to a student and then obtaining a reference to a particular lab, the GUI passes the student and lab IDs as parameters, and lets the classes that control the relevant data handle the request. Even though the GUI uses defensive programming before calling the above methods, your methods should check that the parameters are valid (preconditions are met) before proceeding. To save time, you may use simple error checking (error codes or default values) rather than exception handling. Methods that have several parameters should have their parameters verified in different classes. Part III: View-Controller Identify the view and controller portions of the M-V-C design pattern. Note how the controller is registered with the view (Observer design pattern). Complete the processGrade method. To correctly set a grade, both the student selected and their partner must have the grade set. Download the following files: • LabManagerDriver.java • LabManagerView.java • EasyGridBag.java • CenterFrame.java • section1.txt • section2.txt file:///C:/Users/luke3/Desktop/OOP/Programs/Program03/13-Law%20of%20Demeter/Lab13/LabManagerDriver.java file:///C:/Users/luke3/Desktop/OOP/Programs/Program03/13-Law%20of%20Demeter/Lab13/LabManagerView.java file:///C:/Users/luke3/Desktop/OOP/Programs/Program03/13-Law%20of%20Demeter/Lab13/EasyGridBag.java file:///C:/Users/luke3/Desktop/OOP/Programs/Program03/13-Law%20of%20Demeter/Lab13/CenterFrame.java file:///C:/Users/luke3/Desktop/OOP/Programs/Program03/13-Law%20of%20Demeter/Lab13/section1.txt file:///C:/Users/luke3/Desktop/OOP/Programs/Program03/13-Law%20of%20Demeter/Lab13/section2.txt
Answered Same DayNov 30, 2020

Answer To: Laboratory 13: Law of Demeter Java API Javadoc for EasyGridBag In this lab, you will be designing...

Vidhi answered on Dec 04 2020
149 Votes
Completed Solution/a.JPG
Completed Solution/b.JPG
Completed Solution/Law of Demeter.zip
Law of Demeter/build.xml

Builds, tests, and runs the project Law of Demeter.


Law of Demeter/build/classes/.netbeans_automatic_build
Law of Demeter/build/classes/.netbeans_update_resources
Law of Demeter/build/classes/CenterFrame$1.class
synchronized class CenterFrame$1 extends java.awt.event.WindowAdapter {
void CenterFrame$1(CenterFrame);
public void windowClosing(java.awt.event.WindowEvent);
}
Law of Demeter/build/classes/CenterFrame.class
public abstract synchronized class CenterFrame extends javax.swing.JFrame {
public void CenterFrame(int, int, String);
private void center(int, int);
}
Law of Demeter/build/classes/EasyGridBag.class
public synchronized class EasyGridBag extends java.awt.GridBagLayout {
private java.awt.GridBagConstraints c;
private int rows;
private int columns;
private java.awt.Container cont;
public void EasyGridBag(int, int, java.awt.Container);
public void fillCellCenterWithinCell(int, int, java.awt.Component);
public void fillCellAlignWithinCell(int, int, int, java.awt.Component);
public void fillCellWithRowColSpan(int, int, int, int, int, java.awt.Component);
public void fillCellWithOffsets(int, int, int, int, int, int, int, java.awt.Component);
public void setRowWeight(int, double);
public void setColumnWeight(int, double);
}
Law of Demeter/build/classes/Lab.class
public synchronized class Lab {
private char grade;
private int partnerID;
public void Lab(char, int);
public void Lab();
public boolean isPresent();
public void setGrade(char);
public char getGrade();
public void setPartnerID(int);
public int getPartnerID();
}
Law of Demeter/build/classes/LabManagerDriver.class
public synchronized class LabManagerDriver {
public void LabManagerDriver();
public static void main(String[]);
}
Law of Demeter/build/classes/LabManagerView$1.class
synchronized class LabManagerView$1 extends java.awt.event.WindowAdapter {
void LabManagerView$1(LabManagerView);
public void windowClosing(java.awt.event.WindowEvent);
}
Law of Demeter/build/classes/LabManagerView$2.class
synchronized class LabManagerView$2 {
}
Law of Demeter/build/classes/LabManagerView$LabManagerController.class
synchronized class LabManagerView$LabManagerController implements java.awt.event.ActionListener {
private void
LabManagerView$LabManagerController(LabManagerView);
public void actionPerformed(java.awt.event.ActionEvent);
}
Law of Demeter/build/classes/LabManagerView.class
public synchronized class LabManagerView extends CenterFrame {
private javax.swing.JComboBox cboSections;
private javax.swing.JComboBox cboLabs;
private javax.swing.JComboBox cboStudents;
private javax.swing.JComboBox cboGrades;
private Sections sections;
private javax.swing.JTextArea txtPartners;
private javax.swing.JTextField txtStudentInfo;
private javax.swing.JButton btnAddLab;
private javax.swing.JButton btnInactive;
private javax.swing.JButton btnNotPresent;
private javax.swing.JButton btnQuit;
private javax.swing.JButton btnPartnerList;
private javax.swing.JButton btnSave;
private javax.swing.JButton btnSetGrade;
private javax.swing.JLabel lblGrade;
private LabManagerView$LabManagerController lmc;
private void processGrade();
private void fillStudents();
private void fillLabs();
private void processSection();
private void processInactive();
private void processNotPresent();
private void fillTextArea();
private void processWriteFiles();
private void processQuit();
private void fillTextBox();
private void processPartnerList();
private void processAddLab();
public void LabManagerView(int, int, String, int, double[], int);
private javax.swing.JButton processButton(String, java.awt.Font, LabManagerView$LabManagerController);
}
Law of Demeter/build/classes/Labs.class
public synchronized class Labs {
private java.util.ArrayList labs;
public void Labs();
public int getNumLabs();
public void addLab(char, int);
public void addLab();
public void setGrade(int, char);
public char getGrade(int);
public void setPartnerID(int, int);
public int getPartnerID(int);
public boolean isPresent(int);
public char computeFinalGrade(double[]);
}
Law of Demeter/build/classes/Random.class
public synchronized class Random {
private static Random random;
private java.util.Random rand;
private void Random();
public static Random getRandomNumberGenerator();
public int randomInt(int, int);
public double randomFloat(int, int);
static void ();
}
Law of Demeter/build/classes/Section.class
public synchronized class Section {
private int sectionID;
private Students students;
private String file;
public void Section(int, int);
public int getSectionID();
public void setSectionID(int);
public Students getStudents();
public void setStudents(Students);
public String getFile();
public void setFile(String);
public void computePartners(Random);
public void writeFile(double[], int);
}
Law of Demeter/build/classes/section1.txt
1,Amon Amarth,Y,2,A,1,B,5,B,12
2,Arch Enemy,Y,2,A,15,A,4,C,5
3,Before The Dawn,Y,2,A,5,C,3,A,4
4,Behemoth,Y,2,A,14,A,2,A,3
5,Crionics,Y,2,A,3,B,1,C,2
6,Gorod,Y,1,C,10,B,9,F,0
7,Illdisposed,Y,1,A,8,C,11,B,11
8,Kalmah,Y,1,A,7,A,12,D,9
9,Kataklysm,Y,1,A,12,B,6,D,8
10,Neuraxis,N,1,C,6
11,Nile,Y,1,A,13,C,7,B,7
12,Obscura,Y,1,A,9,A,8,B,1
13,Omnium Gatherum,Y,1,A,11,C,15,C,14
14,Quo Vadis,Y,1,A,4,F,0,C,13
15,Testament,Y,1,A,2,C,13,F,0
Law of Demeter/build/classes/section2.txt
1,Anata,Y,2,A,11,F,0,A,11
2,Blind Stare,Y,2,A,7,F,0,A,0
3,Dark Tranquillity,Y,2,A,10,B,5,B,5
4,Detonation,Y,2,A,13,B,8,C,8
5,Dimension Zero,Y,2,C,16,B,3,B,3
6,Eternal Lies,Y,2,B,12,C,7,A,7
7,Fragments of Unbecoming,Y,2,A,2,C,6,A,6
8,Gates of Ishtar,Y,2,F,0,B,4,C,4
9,Graveworm,Y,1,A,14,C,15,B,16
10,In Thy Dreams,Y,1,A,3,C,14,A,14
11,Insomnium,Y,1,A,1,B,12,A,1
12,Immolation,Y,1,B,6,B,11,B,15
13,Impious,Y,1,A,4,C,16,F,0
14,Mors Principium Est,Y,1,A,9,C,10,A,10
15,Swallow The Sun,Y,1,F,0,C,9,B,12
16,Trauma,Y,1,C,5,C,13,B,9
Law of Demeter/build/classes/Sections.class
public synchronized class Sections {
private java.util.ArrayList sections;
private double[] grade_constants;
private int total_num_labs;
private Random rand;
public void Sections(int, double[], int);
public int getNumSections();
public int getNumStudents(int);
public int getNumLabs(int);
public int getNumLabs(int, int);
public int getPartnerID(int, int, int);
public String getStudentName(int, int);
public boolean isPresent(int, int, int);
public String studentInfo(int, int);
public String partnerList(int, int);
public void setInactive(int, int);
public void setNotPresent(int, int, int);
public void setGrade(int, int, int, char);
public void addLab(int);
public boolean isActive(int, int);
public void computePartners(int);
public void writeFiles();
}
Law of Demeter/build/classes/Student.class
public synchronized class Student {
private int studentID;
private String name;
private int rank;
private Labs labs;
private boolean active;
private boolean hasPartner;
public void Student(int, String, boolean, int, Labs);
public int getStudentID();
public void setStudentID(int);
public String getName();
public void setName(String);
public int getRank();
public void setRank(int);
public Labs getLabs();
public void setLabs(Labs);
public boolean isActive();
public void setActive(boolean);
public boolean hasPartner();
public void setHasPartner(boolean);
public boolean isPresent(int);
public int getNumLabs();
public void setPartnerID(int);
public char computeFinalGrade(double[]);
public String toString();
}
Law of Demeter/build/classes/Students.class
public synchronized class Students {
private java.util.ArrayList students;
private int current_labID;
private int max_rank;
public void Students(String, int);
private int determineCurrentLabNumber();
public java.util.ArrayList getStudents();
public void setStudents(java.util.ArrayList);
public String partnerList(int);
private int determineMaxRank();
public String getStudentName(int);
public String studentInfo(int);
public int getGrade(int, int);
private java.util.ArrayList getAvailableStudentsOfSpecificRank(int, Random);
private void checkAndCorrectForOdd(int, java.util.ArrayList, Random);
private int getRandomPartnerID(int, java.util.ArrayList, Random);
public void computePartners(Random);
private java.util.ArrayList readFile(String, int);
public void writeFile(String, double[], int);
private static String spaces(int);
}
Law of Demeter/manifest.mf
Manifest-Version: 1.0
X-COMMENT: Main-Class will be added automatically by build
Law of Demeter/nbproject/build-impl.xml















































































































































































































Must set src.dir
Must set test.src.dir
Must set build.dir
Must set dist.dir
Must set build.classes.dir
Must set dist.javadoc.dir
Must set build.test.classes.dir
Must set build.test.results.dir
Must set build.classes.excludes
Must set dist.jar




































































































Must set javac.includes
































































































































No tests executed.























































































































































































































































Must set JVM to use for profiling in profiler.info.jvm
Must set profiler agent JVM arguments in profiler.info.jvmargs.agent





























































































































































































































Must select some files in the IDE or set javac.includes













































To run this application from the command line without Ant, try:

java -jar "${dist.jar.resolved}"










































Must select one file in the IDE or set run.class



Must select one file in the IDE or set run.class
...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here