SlideShare a Scribd company logo
//Project .java
import java.util.*;
public class Project implements Comparable, Comparator {
int projectId;
boolean active;
String projectName;
String projectDescription;
public Project()
{
}
public Project(int id, String stat, String name,String des)
{
projectId=id;
if(stat.equals("A"))
active=true;
else
active=false;
projectName=name;
projectDescription=des;
}
public int getProjectID()
{
return projectId;
}
public String getProjectName()
{
return projectName;
}
public String getProjectDescription()
{
return projectDescription;
}
public boolean getActiveFlag()
{
return active;
}
public void display()
{
System.out.println("Project ID: "+projectId);
if(active==true)
System.out.println("Active flag: "+"A");
else
System.out.println("Active flag: "+"I");
System.out.println("Project Name: "+projectName);
System.out.println("Project Description: "+projectDescription);
}
@Override
public int compareTo(Project p) {
return (this.getProjectName().compareTo(p.getProjectName()));
}
@Override
public int compare(Project p1, Project p2) {
return p1.projectId - p2.projectId;
}
}
////////////////////////////////////////////////////////////////
//ProjectDAO.java
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.util.*;
public class ProjectDAO {
String fileName;
List projectList=new ArrayList<>();
public ProjectDAO(String file) throws FileNotFoundException
{
fileName=file;
Scanner infile=new Scanner(new FileReader(file));
while(infile.hasNextLine())
{
String str[]=infile.nextLine().split("|");
projectList.add(new Project(Integer.parseInt(str[0]),str[1],str[2],str[3]));
}
}
public Project getProject(int id)
{
return projectList.get(id);
}
public void sortByProjectID(List projectList) {
Collections.sort(projectList, new Project());
}
public void sortByProjectName(List projectList) {
Collections.sort(projectList);
}
public void PrintProjectDetails()
{
for(int i=0;i
Solution
//Project .java
import java.util.*;
public class Project implements Comparable, Comparator {
int projectId;
boolean active;
String projectName;
String projectDescription;
public Project()
{
}
public Project(int id, String stat, String name,String des)
{
projectId=id;
if(stat.equals("A"))
active=true;
else
active=false;
projectName=name;
projectDescription=des;
}
public int getProjectID()
{
return projectId;
}
public String getProjectName()
{
return projectName;
}
public String getProjectDescription()
{
return projectDescription;
}
public boolean getActiveFlag()
{
return active;
}
public void display()
{
System.out.println("Project ID: "+projectId);
if(active==true)
System.out.println("Active flag: "+"A");
else
System.out.println("Active flag: "+"I");
System.out.println("Project Name: "+projectName);
System.out.println("Project Description: "+projectDescription);
}
@Override
public int compareTo(Project p) {
return (this.getProjectName().compareTo(p.getProjectName()));
}
@Override
public int compare(Project p1, Project p2) {
return p1.projectId - p2.projectId;
}
}
////////////////////////////////////////////////////////////////
//ProjectDAO.java
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.util.*;
public class ProjectDAO {
String fileName;
List projectList=new ArrayList<>();
public ProjectDAO(String file) throws FileNotFoundException
{
fileName=file;
Scanner infile=new Scanner(new FileReader(file));
while(infile.hasNextLine())
{
String str[]=infile.nextLine().split("|");
projectList.add(new Project(Integer.parseInt(str[0]),str[1],str[2],str[3]));
}
}
public Project getProject(int id)
{
return projectList.get(id);
}
public void sortByProjectID(List projectList) {
Collections.sort(projectList, new Project());
}
public void sortByProjectName(List projectList) {
Collections.sort(projectList);
}
public void PrintProjectDetails()
{
for(int i=0;i

More Related Content

PDF
DnaAORC This protein is responsible for initiation of DNA replicat.pdf
PDF
Answer(19)Mary’s parents are normal, therefore her brother must.pdf
PDF
Answer Q1. Red mangroove is the last mangroove to colonise on the.pdf
PDF
An Arrhenius acid produces H+ ions insolutionA Bronsted-Lowry acid.pdf
PDF
Ans. One of the main disadvantage is chromatic aberrasion. A more li.pdf
PDF
A coordination problem occurs in situations where there is no Nash E.pdf
PDF
1. When an integrated F plasmid leaves the chromosome it may take so.pdf
PDF
1. A DNA molecule contains two strands of poly deoxyribonucleotide s.pdf
DnaAORC This protein is responsible for initiation of DNA replicat.pdf
Answer(19)Mary’s parents are normal, therefore her brother must.pdf
Answer Q1. Red mangroove is the last mangroove to colonise on the.pdf
An Arrhenius acid produces H+ ions insolutionA Bronsted-Lowry acid.pdf
Ans. One of the main disadvantage is chromatic aberrasion. A more li.pdf
A coordination problem occurs in situations where there is no Nash E.pdf
1. When an integrated F plasmid leaves the chromosome it may take so.pdf
1. A DNA molecule contains two strands of poly deoxyribonucleotide s.pdf

More from aquacosmossystems (20)

PDF
Ethyl 4-aminobenzoate is a basic organic compound. In basic and neut.pdf
PDF
draw a sphere and use raytracing on the sphere in OpenGL glut. .pdf
PDF
SnO2 (ore) is initially washed and dressed. then .pdf
PDF
d) Valine Note its side chain doesnt contain a.pdf
PDF
Amphiprotic. The preferred term is amphoteric. A .pdf
PDF
at equivalence point, Moles OH- added = moles H+.pdf
PDF
We Know that     Water is a Polar component as .pdf
PDF
molar mass of C2H5OH = 46.1 gmole moles of C2H5O.pdf
PDF
What property of PN code makes them suitable for use in spread spect.pdf
PDF
TLC can be used to help determine the number of components in a mixt.pdf
PDF
There may have some variables affect the model. So the error term wi.pdf
PDF
There are four major functional characteristics of skeletal muscle..pdf
PDF
The distinction is important due to the following reasons.The data.pdf
PDF
sequence Fnconverges to L hence by definition for given €    0 there.pdf
PDF
Our immune system will respond and protect our body from pathogens b.pdf
PDF
Different thermal conductivity of different materials causes damage .pdf
PDF
#include node1.h #include list.h #include cassert P.pdf
PDF
D is correct. Dual stack uses side-by-side protocol stacks on the de.pdf
PDF
More than one hundred radio-isotopes have been used to assist in a w.pdf
PDF
B. The two primary components of a DAC are file and data ownership, .pdf
Ethyl 4-aminobenzoate is a basic organic compound. In basic and neut.pdf
draw a sphere and use raytracing on the sphere in OpenGL glut. .pdf
SnO2 (ore) is initially washed and dressed. then .pdf
d) Valine Note its side chain doesnt contain a.pdf
Amphiprotic. The preferred term is amphoteric. A .pdf
at equivalence point, Moles OH- added = moles H+.pdf
We Know that     Water is a Polar component as .pdf
molar mass of C2H5OH = 46.1 gmole moles of C2H5O.pdf
What property of PN code makes them suitable for use in spread spect.pdf
TLC can be used to help determine the number of components in a mixt.pdf
There may have some variables affect the model. So the error term wi.pdf
There are four major functional characteristics of skeletal muscle..pdf
The distinction is important due to the following reasons.The data.pdf
sequence Fnconverges to L hence by definition for given €    0 there.pdf
Our immune system will respond and protect our body from pathogens b.pdf
Different thermal conductivity of different materials causes damage .pdf
#include node1.h #include list.h #include cassert P.pdf
D is correct. Dual stack uses side-by-side protocol stacks on the de.pdf
More than one hundred radio-isotopes have been used to assist in a w.pdf
B. The two primary components of a DAC are file and data ownership, .pdf

Recently uploaded (20)

PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PPTX
202450812 BayCHI UCSC-SV 20250812 v17.pptx
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
PDF
VCE English Exam - Section C Student Revision Booklet
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PPTX
GDM (1) (1).pptx small presentation for students
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PDF
Weekly quiz Compilation Jan -July 25.pdf
PDF
Complications of Minimal Access Surgery at WLH
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PDF
Trump Administration's workforce development strategy
PDF
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
PPTX
Orientation - ARALprogram of Deped to the Parents.pptx
PPTX
Cell Types and Its function , kingdom of life
PDF
A systematic review of self-coping strategies used by university students to ...
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PPTX
Lesson notes of climatology university.
DOC
Soft-furnishing-By-Architect-A.F.M.Mohiuddin-Akhand.doc
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
202450812 BayCHI UCSC-SV 20250812 v17.pptx
Final Presentation General Medicine 03-08-2024.pptx
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
VCE English Exam - Section C Student Revision Booklet
FourierSeries-QuestionsWithAnswers(Part-A).pdf
GDM (1) (1).pptx small presentation for students
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
Weekly quiz Compilation Jan -July 25.pdf
Complications of Minimal Access Surgery at WLH
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
human mycosis Human fungal infections are called human mycosis..pptx
Trump Administration's workforce development strategy
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
Orientation - ARALprogram of Deped to the Parents.pptx
Cell Types and Its function , kingdom of life
A systematic review of self-coping strategies used by university students to ...
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
Lesson notes of climatology university.
Soft-furnishing-By-Architect-A.F.M.Mohiuddin-Akhand.doc

Project .javaimport java.util.;public class Project impleme.pdf

  • 1. //Project .java import java.util.*; public class Project implements Comparable, Comparator { int projectId; boolean active; String projectName; String projectDescription; public Project() { } public Project(int id, String stat, String name,String des) { projectId=id; if(stat.equals("A")) active=true; else active=false; projectName=name; projectDescription=des; } public int getProjectID() { return projectId; } public String getProjectName() { return projectName; } public String getProjectDescription() { return projectDescription; } public boolean getActiveFlag()
  • 2. { return active; } public void display() { System.out.println("Project ID: "+projectId); if(active==true) System.out.println("Active flag: "+"A"); else System.out.println("Active flag: "+"I"); System.out.println("Project Name: "+projectName); System.out.println("Project Description: "+projectDescription); } @Override public int compareTo(Project p) { return (this.getProjectName().compareTo(p.getProjectName())); } @Override public int compare(Project p1, Project p2) { return p1.projectId - p2.projectId; } } //////////////////////////////////////////////////////////////// //ProjectDAO.java import java.io.FileNotFoundException; import java.io.FileReader; import java.util.*; public class ProjectDAO { String fileName; List projectList=new ArrayList<>(); public ProjectDAO(String file) throws FileNotFoundException { fileName=file; Scanner infile=new Scanner(new FileReader(file)); while(infile.hasNextLine()) {
  • 3. String str[]=infile.nextLine().split("|"); projectList.add(new Project(Integer.parseInt(str[0]),str[1],str[2],str[3])); } } public Project getProject(int id) { return projectList.get(id); } public void sortByProjectID(List projectList) { Collections.sort(projectList, new Project()); } public void sortByProjectName(List projectList) { Collections.sort(projectList); } public void PrintProjectDetails() { for(int i=0;i Solution //Project .java import java.util.*; public class Project implements Comparable, Comparator { int projectId; boolean active; String projectName; String projectDescription; public Project() { } public Project(int id, String stat, String name,String des) { projectId=id; if(stat.equals("A"))
  • 4. active=true; else active=false; projectName=name; projectDescription=des; } public int getProjectID() { return projectId; } public String getProjectName() { return projectName; } public String getProjectDescription() { return projectDescription; } public boolean getActiveFlag() { return active; } public void display() { System.out.println("Project ID: "+projectId); if(active==true) System.out.println("Active flag: "+"A"); else System.out.println("Active flag: "+"I"); System.out.println("Project Name: "+projectName); System.out.println("Project Description: "+projectDescription); } @Override public int compareTo(Project p) { return (this.getProjectName().compareTo(p.getProjectName())); }
  • 5. @Override public int compare(Project p1, Project p2) { return p1.projectId - p2.projectId; } } //////////////////////////////////////////////////////////////// //ProjectDAO.java import java.io.FileNotFoundException; import java.io.FileReader; import java.util.*; public class ProjectDAO { String fileName; List projectList=new ArrayList<>(); public ProjectDAO(String file) throws FileNotFoundException { fileName=file; Scanner infile=new Scanner(new FileReader(file)); while(infile.hasNextLine()) { String str[]=infile.nextLine().split("|"); projectList.add(new Project(Integer.parseInt(str[0]),str[1],str[2],str[3])); } } public Project getProject(int id) { return projectList.get(id); } public void sortByProjectID(List projectList) { Collections.sort(projectList, new Project()); } public void sortByProjectName(List projectList) { Collections.sort(projectList); } public void PrintProjectDetails() {