Brief A Technical School certifies students who successfully complete a course o
ID: 3699274 • Letter: B
Question
Brief A Technical School certifies students who successfully complete a course of study involving a variety of taught, self-study or project modules. To determine whether or not a student is certified, their transcript is checked against a certification criteria. For this assignment, you will individually develop classes to store data for modules, students and their transcripts. You will demonstrate the functionality of your code on sample transcripts. Programming Methodology The Module Class The Module class maintains instance variables for type, title, code and level. The type is an enumeration with four values corresponding to the type of modules available: taught, self-study, project and client project. The level is an enumeration containing three level values. All instance variables are private with get and set methods. There is one constructor to initialise module object and is provided with input for all instance variables. The Module class should override the toString method to return a nice text representation. The Technical School Class The Technical School maintains the Semester 1 Module Offerings Table: Module Type Taught Taught Taught Taught Taught Taught Self-Study Self-Study Self-Study Self-Study Self-Study Title Level Code PROG101 STAT102 DATA222 PROG202 INSY313 WEBS332 TECH103 THEO111 MODC233 TOPG233 LOGI321 PRO1399 EXTO396 Programming Database Design Object-Oriented Programming Information Systems Web Services Theory of Computation Model Checking Topology Logic Web App Dev Client Project Great Code Company Instantiate the appropriate Module object using data from the Semester 1 Module Offerings Table as input parameters. One suggestion is to create the method static private Module semesterOneModuleOfferings(), which returns a primitive array populated by 13 Module objects, corresponding to each row of the table. TechnicalSchool maintains a private instance variable Modulel] offerings and the default constructor TechnicalSchool) sets this.offerings TechnicalSchool. semesterOneModuleOfferings0. Write a get method for this.offerings.Explanation / Answer
Please upvote if you find the answer satisfactory :)
Please run the EvaluateStudents class given to you with this code, everything should work as intended. In case you run into any issues, please comment on this any and I will resolve it. Thank you. Below is the code:
GRADE Enum
public enum Grade {
A1(100,90,"A+"),
A2(90,85,"A"),
A3(85,80,"A-"),
B1(80,75,"B+"),
B2(75,70,"B"),
B3(70,65,"B-"),
C1(65,60,"C+"),
C2(60,65,"C"),
C3(65,50,"C-"),
D(50,0,"A+");
private Grade(int u,int l,String g){
this.upper=u;
this.lower=l;
this.grade=g;
}
public int getUpper() {
return upper;
}
public void setUpper(int upper) {
this.upper = upper;
}
public int getLower() {
return lower;
}
public void setLower(int lower) {
this.lower = lower;
}
public String getGrade() {
return grade;
}
public void setGrade(String grade) {
this.grade = grade;
}
private int upper;
private int lower;
private String grade;
}
MODULE CLASS
public class Module {
public static enum moduleType {
TAUGHT, SELF_STUDY, PROJECT, CLIENT_PROJECT
}
private moduleType type;
private String title;
private String code;
private int level;
@Override
public String toString() {
return "Module: Type=" + getTypeDesc() + " Title=" + title + " Code=" + code + " level=" + level + "";
}
public Module(moduleType type, String title, String code, int level) {
super();
this.type = type;
this.title = title;
this.code = code;
this.level = level;
}
public String getTypeDesc() {
switch(type)
{case TAUGHT: return "Taught";
case SELF_STUDY: return "Self Study";
case PROJECT: return "Project";
case CLIENT_PROJECT: return "Client Project";
default : return "";
}
}
public moduleType getType() {
return type;
}
public void setType(moduleType type) {
this.type = type;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public int getLevel() {
return level;
}
public void setLevel(int level) {
this.level = level;
}
}
RESULT Class
public class Result {
private Module module;
private Grade grade;
@Override
public String toString() {
return "Result [module=" + module.toString() + ", grade=" + grade.getGrade() + "]";
}
public Module getModule() {
return module;
}
public void setModule(Module module) {
this.module = module;
}
public Grade getGrade() {
return grade;
}
public void setGrade(Grade grade) {
this.grade = grade;
}
public Result(Module module, Grade grade) {
super();
this.module = module;
this.grade = grade;
}
}
STUDENT CLASS
public class Student {
private Result[] transcript;
private int nResults;
private String name;
private static final int MAX_TRANSCRIPT_LENGTH =20;
public Student(String name) {
super();
this.name = name;
this.transcript=new Result[MAX_TRANSCRIPT_LENGTH];
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Result[] getTranscript() {
return transcript;
}
public void setTranscript(Result[] transcript) {
this.transcript = transcript;
}
public int getnResults() {
return nResults;
}
public void setnResults(int nResults) {
this.nResults = nResults;
}
public void addResultToTranscript(Module m, Grade g){
if(nResults<=20){
transcript[nResults-1]=new Result(m, g);
nResults++;
}
}
public Result[] getTranscipt(){
Result[] retArr=new Result[nResults];
for(int i=0;i<nResults;i++)
{
retArr[i]=transcript[i];
}
return retArr;
}
}
TECHNICAL SCHOOL Class
public class TechnicalSchool {
private Module[] offerings;
public TechnicalSchool() {
this.offerings = semesterOneModuleOfferings();
}
public Module[] getOfferings() {
return offerings;
}
public void setOfferings(Module[] offerings) {
this.offerings = offerings;
}
public static Module[] semesterOneModuleOfferings(){
Module m1=new Module(Module.moduleType.TAUGHT, "Programming", "PROG101", 1);
Module m2=new Module(Module.moduleType.TAUGHT, "Statistics", "STAT102", 1);
Module m3=new Module(Module.moduleType.TAUGHT, "Database Design", "Data222", 2);
Module m4=new Module(Module.moduleType.TAUGHT, "Object-Oriented Programming", "PROG102", 2);
Module m5=new Module(Module.moduleType.TAUGHT, "Information Systems", "INSY313", 3);
Module m6=new Module(Module.moduleType.TAUGHT, "Web Services", "WEBS332", 3);
Module m7=new Module(Module.moduleType.SELF_STUDY, "Technology Applications", "TECH103", 1);
Module m8=new Module(Module.moduleType.SELF_STUDY, "Theory of Computation", "THEO111", 1);
Module m9=new Module(Module.moduleType.SELF_STUDY, "Module Checking", "MODC233", 2);
Module m10=new Module(Module.moduleType.SELF_STUDY, "Topology", "TOPG233", 2);
Module m11=new Module(Module.moduleType.SELF_STUDY, "Logic", "LOGI321", 3);
Module m12=new Module(Module.moduleType.PROJECT, "WebApp Dev", "PROJ399", 3);
Module m13=new Module(Module.moduleType.CLIENT_PROJECT, "Great Code Company", "EXTO396", 3);
Module[] arr=new Module[13];
arr[0]=m1;
arr[1]=m2;
arr[2]=m3;
arr[3]=m4;
arr[4]=m5;
arr[5]=m6;
arr[6]=m7;
arr[7]=m8;
arr[8]=m9;
arr[9]=m10;
arr[10]=m11;
arr[11]=m12;
arr[12]=m13;
return arr;
}
public Module lookup(String code){
for(Module m: this.offerings)
{
if(m.getCode().equals(code))
return m;
}
return null;
}
public boolean isCertified(Student s){
int c1=0,c2_o=0,c2_ss=0,c3_t=0,c3_o=0,cp=0;
for(Result r:s.getTranscipt())
{
if(r.getModule().getType().equals(Module.moduleType.PROJECT) && !r.getGrade().equals(Grade.D))
cp++;
if((r.getModule().getType().equals(Module.moduleType.TAUGHT) || r.getModule().getType().equals(Module.moduleType.SELF_STUDY)) && r.getModule().getLevel()==1 && !r.getGrade().equals(Grade.D))
c1++;
if((r.getModule().getType().equals(Module.moduleType.SELF_STUDY)) && r.getModule().getLevel()==2 && !r.getGrade().equals(Grade.D))
c2_ss++;
if(!(r.getModule().getType().equals(Module.moduleType.SELF_STUDY)) && r.getModule().getLevel()==2 && !r.getGrade().equals(Grade.D))
c2_o++;
if((r.getModule().getType().equals(Module.moduleType.TAUGHT)) && r.getModule().getLevel()==3 && !r.getGrade().equals(Grade.D))
c3_t++;
if(!(r.getModule().getType().equals(Module.moduleType.TAUGHT)) && r.getModule().getLevel()==3 && !r.getGrade().equals(Grade.D))
c3_o++;
}
boolean l1,l2,l3,p;
l1=(c1>=3);
l2=(c2_ss==1 && ((c2_ss+c2_o)>=3));
l3=(c3_t==2 && ((c3_t+c3_o)>=4));
p=(cp>=1);
return l1 && l2 && l3 && p;
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.