SlideShare a Scribd company logo
1 of 11
Download to read offline
please help with java questions
JAVA CODE
please check my code and help my questions
CLASS ADDRESS
public class Address{
private int streetNumber;
private String streetName;
private String city;
private String state;
private String country;
// streetNumber
// streetName
// city
// state
// country
public Address(int streetNumber, String streetName, String city, String state, String country) {
this.streetNumber = streetNumber;
this.streetName = streetName;
this.city = city;
this.state = state;
this.country = country;
}
//return the streetNumber
public int getStreetNumber() {
return streetNumber;
}
// set street number
public void setStreetNumber(int streetNumber) {
this.streetNumber = streetNumber;
}
//return the streetName
public String getStreetName() {
return streetName;
}
// set street name
public void setStreetName(String streetName) {
this.streetName = streetName;
}
//return the city
public String getCity() {
return city;
}
//set the city
public void setCity(String city) {
this.city = city;
}
//return the state
public String getState() {
return state;
}
//the state to set
public void setState(String state) {
this.state = state;
}
// return the country
public String getCountry() {
return country;
}
// tset country
public void setCountry(String country) {
this.country = country;
}
// see java.lang.Object#toString()
@Override
public String toString() {
return " [streetNumber=" + streetNumber + ", streetName=" + streetName
+ ", city=" + city + ", state=" + state + ", country="
+ country + "]";
}
}
////////////////////////////////////////////////////////////////////////////////////////
CLASS PERSON
public class Person extends Address {
private String name;
public Person (int streetNumber, String streetName, String city, String state, String country,
String name) {
super(streetNumber, streetName, city, state, country);
this.name = name;
}
//retuurn name
public String getName() {
return name;
}
// set name
public void setName(String name) {
this.name = name;
}
//see java.lang.Object#toString()
@Override
public String toString() {
return "Person [name=" + name + ", getStreetNumber()="
+ getStreetNumber() + ", getStreetName()=" + getStreetName()
+ ", getCity()=" + getCity() + ", getState()=" + getState()
+ ", getCountry()=" + getCountry() + ", toString()="
+ super.toString() + ", getClass()=" + getClass()
+ ", hashCode()=" + hashCode() + "]";
}
}
/////////////////////////////////////////////////////////////////
CLASS STUDENT
import java.util.ArrayList;
import java.util.List;
public class Student extends Person {
private String CIN;
List courses;
public Student(int streetNumber, String streetName, String city, String state, String country,
String name, String CIN) {
super(streetNumber, streetName, city, state, country, name);
// Auto-generated constructor stub
this.CIN = CIN;
courses = new ArrayList();
}
// reutrn cin
public String getCIN() {
return CIN;
}
// set cin
public void setCIN(String cIN) {
CIN = cIN;
}
public void addCourse(classCourse c) {
courses.add(c);
}
@Override
public String toString() {
return "Student [CIN=" + CIN + ", courses=" + courses + ", getName()="
+ getName() + ", toString()=" + super.toString()
+ ", getStreetNumber()=" + getStreetNumber()
+ ", getStreetName()=" + getStreetName() + ", getCity()="
+ getCity() + ", getState()=" + getState() + ", getCountry()="
+ getCountry() + ", getClass()=" + getClass() + ", hashCode()="
+ hashCode() + "]";
}
}
/////////////////////////////////////////////////////
CLASS FACULTYMEMBER
import java.util.ArrayList;
import java.util.List;
public class FacultyMember extends Address {
String employeeId;
List schedule;
// streetNumber
//streetName
// city
// state
// country
// name
// employeeId
public FacultyMember(int streetNumber, String streetName, String city, String state, String
country, String name, String employeeId) {
super(streetNumber, streetName, city, state, country, name);
this.employeeId = employeeId;
schedule = new ArrayList();
}
//return employeeid
public String getEmployeeId() {
return employeeId;
}
//set employeeid
public void setEmployeeId(String employeeId) {
this.employeeId = employeeId;
}
public void addSchedule(classCourse c) {
schedule.add(c);
}
// @see java.lang.Object#toString()
@Override
public String toString() {
return "FacultyMember [employeeId=" + employeeId + ", schedule="
+ schedule + ", getName()=" + getName() + ", toString()="
+ super.toString() + ", getStreetNumber()=" + getStreetNumber()
+ ", getStreetName()=" + getStreetName() + ", getCity()="
+ getCity() + ", getState()=" + getState() + ", getCountry()="
+ getCountry() + ", getClass()=" + getClass() + ", hashCode()="
+ hashCode() + "]";
}
}
//////////////////////////////////////////////////////////
CLASS CLASSCOURSE
public class classCourse {
String identifier;
String courseTitle;
// identifier
// courseTitle
public classCourse(String identifier, String courseTitle) {
this.identifier = identifier;
this.courseTitle = courseTitle;
}
//return identifier
public String getIdentifier() {
return identifier;
}
//identifier
// set identifier
public void setIdentifier(String identifier) {
this.identifier = identifier;
}
// return cousetitle
public String getCourseTitle() {
return courseTitle;
}
// courseTitle
// set consetitle
public void setCourseTitle(String courseTitle) {
this.courseTitle = courseTitle;
}
// @see java.lang.Object#toString()
@Override
public String toString() {
return "Course [identifier=" + identifier + ", courseTitle="
+ courseTitle + "]";
}
}
////////////////////////////////////////////////
MY QUESTION IS
why address class and person class
keep telling me that THE TYPE ADDRESS(PERSON) is alredy defined
and how to fix it
and
can you help me to do Drive Class
Write a Driver class that maintains lists of Students, Courses, and FacultyMembers and has a
menu that provides ways to list them and to create them and add them to the list. Provide ways to
delete Students and FacultyMembers and for Students and FacultyMembers to add and delete
Courses from their course schedules. However, you do not need to provide a way to delete a
Course from the list of Courses.
Include a method that can be called from main that will use your methods to add and delete some
hard-coded test data (several students, several faculty members, and several courses.) This will
let you code the lists and test the methods to add and delete items without using the user input
functions.
Do not create a new Course when a Student adds or when a faculty member is assigned to teach;
let the user choose a Course from the list.
Solution
You have provided an extra parameter to the constructor of Address in FacultyMember class.
It should be
super(streetNumber, streetName, city, state, country);
not
super(streetNumber, streetName, city, state, country, name);
as the Address class takes only 5 parameters.
And your driver class should look like below
import java.util.List;
public class Driver {
List students;
List courses;
List facultyMembers;
//Add
public void addStudent(Student s){
students.add(s);
}
public void addCourse(classCourse c){
courses.add(c);
}
public void addFacultyMember(FacultyMember f){
facultyMembers.add(f);
}
//Delete
public void deleteStudent(Student s){
students.remove(s);
}
public void deleteCourse(classCourse c){
courses.remove(c);
}
public void deleteFacultyMember(FacultyMember f){
facultyMembers.remove(f);
}
//Show
public void showStudents(){
for (Student s : students) {
System.out.println(s.getName());
}
}
public void showCourses(){
for (classCourse c : courses) {
System.out.println(c.getClass());
}
}
public void showFacultyMembers(){
for (FacultyMember f : facultyMembers) {
System.out.println(f.getName());
}
}
}
and in the Main function you can add Hard coded values to test the class.

More Related Content

Similar to please help with java questionsJAVA CODEplease check my code and.pdf

Hello. Im currently working on the last section to my assignment a.pdf
Hello. Im currently working on the last section to my assignment a.pdfHello. Im currently working on the last section to my assignment a.pdf
Hello. Im currently working on the last section to my assignment a.pdfirshadkumar3
 
Creat Shape classes from scratch DETAILS You will create 3 shape cla.pdf
Creat Shape classes from scratch DETAILS You will create 3 shape cla.pdfCreat Shape classes from scratch DETAILS You will create 3 shape cla.pdf
Creat Shape classes from scratch DETAILS You will create 3 shape cla.pdfaromanets
 
Getting the following errorsError 1 error C2436 {ctor} mem.pdf
Getting the following errorsError 1 error C2436 {ctor}  mem.pdfGetting the following errorsError 1 error C2436 {ctor}  mem.pdf
Getting the following errorsError 1 error C2436 {ctor} mem.pdfherminaherman
 
public class Person { private String name; private int age;.pdf
public class Person { private String name; private int age;.pdfpublic class Person { private String name; private int age;.pdf
public class Person { private String name; private int age;.pdfarjuncp10
 
How to fix this error- Exception in thread -main- q- Exit java-lang-.pdf
How to fix this error-   Exception in thread -main- q- Exit java-lang-.pdfHow to fix this error-   Exception in thread -main- q- Exit java-lang-.pdf
How to fix this error- Exception in thread -main- q- Exit java-lang-.pdfaarokyaaqua
 
define a class name Employee whose objects are records for employee..pdf
define a class name Employee whose objects are records for employee..pdfdefine a class name Employee whose objects are records for employee..pdf
define a class name Employee whose objects are records for employee..pdffashioncollection2
 
There is something wrong with my program-- (once I do a for view all t.pdf
There is something wrong with my program-- (once I do a for view all t.pdfThere is something wrong with my program-- (once I do a for view all t.pdf
There is something wrong with my program-- (once I do a for view all t.pdfaashienterprisesuk
 
Higher-Order Components — Ilya Gelman
Higher-Order Components — Ilya GelmanHigher-Order Components — Ilya Gelman
Higher-Order Components — Ilya Gelman500Tech
 
Circle.javaimport java.text.DecimalFormat;public class Circle {.pdf
Circle.javaimport java.text.DecimalFormat;public class Circle {.pdfCircle.javaimport java.text.DecimalFormat;public class Circle {.pdf
Circle.javaimport java.text.DecimalFormat;public class Circle {.pdfANJALIENTERPRISES1
 
The Future of JVM Languages
The Future of JVM Languages The Future of JVM Languages
The Future of JVM Languages VictorSzoltysek
 
TypeScript by Howard
TypeScript by HowardTypeScript by Howard
TypeScript by HowardLearningTech
 
Howard type script
Howard   type scriptHoward   type script
Howard type scriptLearningTech
 
I have the following code and I need to know why I am receiving the .pdf
I have the following code and I need to know why I am receiving the .pdfI have the following code and I need to know why I am receiving the .pdf
I have the following code and I need to know why I am receiving the .pdfezzi552
 
29. Code an application program that keeps track of student informat.pdf
29. Code an application program that keeps track of student informat.pdf29. Code an application program that keeps track of student informat.pdf
29. Code an application program that keeps track of student informat.pdfarishaenterprises12
 
TDC2016POA | Trilha .NET - CQRS e ES na prática com RavenDB
TDC2016POA | Trilha .NET - CQRS e ES na prática com RavenDBTDC2016POA | Trilha .NET - CQRS e ES na prática com RavenDB
TDC2016POA | Trilha .NET - CQRS e ES na prática com RavenDBtdc-globalcode
 
Type script by Howard
Type script by HowardType script by Howard
Type script by HowardLearningTech
 
[PL] O klasycznej, programistycznej elegancji
[PL] O klasycznej, programistycznej elegancji[PL] O klasycznej, programistycznej elegancji
[PL] O klasycznej, programistycznej elegancjiJakub Marchwicki
 
TDC2016SP - Trilha .NET
TDC2016SP - Trilha .NETTDC2016SP - Trilha .NET
TDC2016SP - Trilha .NETtdc-globalcode
 

Similar to please help with java questionsJAVA CODEplease check my code and.pdf (20)

Hello. Im currently working on the last section to my assignment a.pdf
Hello. Im currently working on the last section to my assignment a.pdfHello. Im currently working on the last section to my assignment a.pdf
Hello. Im currently working on the last section to my assignment a.pdf
 
Creat Shape classes from scratch DETAILS You will create 3 shape cla.pdf
Creat Shape classes from scratch DETAILS You will create 3 shape cla.pdfCreat Shape classes from scratch DETAILS You will create 3 shape cla.pdf
Creat Shape classes from scratch DETAILS You will create 3 shape cla.pdf
 
Getting the following errorsError 1 error C2436 {ctor} mem.pdf
Getting the following errorsError 1 error C2436 {ctor}  mem.pdfGetting the following errorsError 1 error C2436 {ctor}  mem.pdf
Getting the following errorsError 1 error C2436 {ctor} mem.pdf
 
public class Person { private String name; private int age;.pdf
public class Person { private String name; private int age;.pdfpublic class Person { private String name; private int age;.pdf
public class Person { private String name; private int age;.pdf
 
How to fix this error- Exception in thread -main- q- Exit java-lang-.pdf
How to fix this error-   Exception in thread -main- q- Exit java-lang-.pdfHow to fix this error-   Exception in thread -main- q- Exit java-lang-.pdf
How to fix this error- Exception in thread -main- q- Exit java-lang-.pdf
 
define a class name Employee whose objects are records for employee..pdf
define a class name Employee whose objects are records for employee..pdfdefine a class name Employee whose objects are records for employee..pdf
define a class name Employee whose objects are records for employee..pdf
 
There is something wrong with my program-- (once I do a for view all t.pdf
There is something wrong with my program-- (once I do a for view all t.pdfThere is something wrong with my program-- (once I do a for view all t.pdf
There is something wrong with my program-- (once I do a for view all t.pdf
 
Higher-Order Components — Ilya Gelman
Higher-Order Components — Ilya GelmanHigher-Order Components — Ilya Gelman
Higher-Order Components — Ilya Gelman
 
OOP Lab Report.docx
OOP Lab Report.docxOOP Lab Report.docx
OOP Lab Report.docx
 
Circle.javaimport java.text.DecimalFormat;public class Circle {.pdf
Circle.javaimport java.text.DecimalFormat;public class Circle {.pdfCircle.javaimport java.text.DecimalFormat;public class Circle {.pdf
Circle.javaimport java.text.DecimalFormat;public class Circle {.pdf
 
The Future of JVM Languages
The Future of JVM Languages The Future of JVM Languages
The Future of JVM Languages
 
TypeScript by Howard
TypeScript by HowardTypeScript by Howard
TypeScript by Howard
 
Howard type script
Howard   type scriptHoward   type script
Howard type script
 
I have the following code and I need to know why I am receiving the .pdf
I have the following code and I need to know why I am receiving the .pdfI have the following code and I need to know why I am receiving the .pdf
I have the following code and I need to know why I am receiving the .pdf
 
29. Code an application program that keeps track of student informat.pdf
29. Code an application program that keeps track of student informat.pdf29. Code an application program that keeps track of student informat.pdf
29. Code an application program that keeps track of student informat.pdf
 
TDC2016POA | Trilha .NET - CQRS e ES na prática com RavenDB
TDC2016POA | Trilha .NET - CQRS e ES na prática com RavenDBTDC2016POA | Trilha .NET - CQRS e ES na prática com RavenDB
TDC2016POA | Trilha .NET - CQRS e ES na prática com RavenDB
 
Type script by Howard
Type script by HowardType script by Howard
Type script by Howard
 
Scala 2 + 2 > 4
Scala 2 + 2 > 4Scala 2 + 2 > 4
Scala 2 + 2 > 4
 
[PL] O klasycznej, programistycznej elegancji
[PL] O klasycznej, programistycznej elegancji[PL] O klasycznej, programistycznej elegancji
[PL] O klasycznej, programistycznej elegancji
 
TDC2016SP - Trilha .NET
TDC2016SP - Trilha .NETTDC2016SP - Trilha .NET
TDC2016SP - Trilha .NET
 

More from arishmarketing21

A series RL circuit includes a 9.05-V battery, a resistance of R = 0.pdf
A series RL circuit includes a 9.05-V battery, a resistance of R = 0.pdfA series RL circuit includes a 9.05-V battery, a resistance of R = 0.pdf
A series RL circuit includes a 9.05-V battery, a resistance of R = 0.pdfarishmarketing21
 
What is the dangling pointer Explain with a proper example.Solut.pdf
What is the dangling pointer Explain with a proper example.Solut.pdfWhat is the dangling pointer Explain with a proper example.Solut.pdf
What is the dangling pointer Explain with a proper example.Solut.pdfarishmarketing21
 
Write a function in javascript that calculates the average element i.pdf
Write a function in javascript that calculates the average element i.pdfWrite a function in javascript that calculates the average element i.pdf
Write a function in javascript that calculates the average element i.pdfarishmarketing21
 
Which a not a likely location of a bacterial to be found Atheroscle.pdf
Which a not a likely location of a bacterial to be found  Atheroscle.pdfWhich a not a likely location of a bacterial to be found  Atheroscle.pdf
Which a not a likely location of a bacterial to be found Atheroscle.pdfarishmarketing21
 
What’s Love Got To Do With ItThe Evolution of Human MatingB.pdf
What’s Love Got To Do With ItThe Evolution of Human MatingB.pdfWhat’s Love Got To Do With ItThe Evolution of Human MatingB.pdf
What’s Love Got To Do With ItThe Evolution of Human MatingB.pdfarishmarketing21
 
What is the Surface characterization techniques of Fourier-transform.pdf
What is the Surface characterization techniques of Fourier-transform.pdfWhat is the Surface characterization techniques of Fourier-transform.pdf
What is the Surface characterization techniques of Fourier-transform.pdfarishmarketing21
 
What is the running time complexity and space complexity of the follo.pdf
What is the running time complexity and space complexity of the follo.pdfWhat is the running time complexity and space complexity of the follo.pdf
What is the running time complexity and space complexity of the follo.pdfarishmarketing21
 
A species has a diploid number of chromosomes of 6. If a cell from a.pdf
A species has a diploid number of chromosomes of 6. If a cell from a.pdfA species has a diploid number of chromosomes of 6. If a cell from a.pdf
A species has a diploid number of chromosomes of 6. If a cell from a.pdfarishmarketing21
 
What are the security requirements and challenges of Grid and Cloud .pdf
What are the security requirements and challenges of Grid and Cloud .pdfWhat are the security requirements and challenges of Grid and Cloud .pdf
What are the security requirements and challenges of Grid and Cloud .pdfarishmarketing21
 
Using the man command, determine which ls command option (flag) will.pdf
Using the man command, determine which ls command option (flag) will.pdfUsing the man command, determine which ls command option (flag) will.pdf
Using the man command, determine which ls command option (flag) will.pdfarishmarketing21
 
There a six seats in a bar. Your friend took the second seat from th.pdf
There a six seats in a bar. Your friend took the second seat from th.pdfThere a six seats in a bar. Your friend took the second seat from th.pdf
There a six seats in a bar. Your friend took the second seat from th.pdfarishmarketing21
 
The basic economic problem is that we only have so many resources, b.pdf
The basic  economic problem is that we only have so many resources, b.pdfThe basic  economic problem is that we only have so many resources, b.pdf
The basic economic problem is that we only have so many resources, b.pdfarishmarketing21
 
The organization of interrupted genes is often conserved between spe.pdf
The organization of interrupted genes is often conserved between spe.pdfThe organization of interrupted genes is often conserved between spe.pdf
The organization of interrupted genes is often conserved between spe.pdfarishmarketing21
 
The daisy has which inflorescence morphology type campanulte tubul.pdf
The daisy has which inflorescence morphology type  campanulte  tubul.pdfThe daisy has which inflorescence morphology type  campanulte  tubul.pdf
The daisy has which inflorescence morphology type campanulte tubul.pdfarishmarketing21
 
Suppose that CaO is present as an impurity to Li2O. The Ca2+ ion sub.pdf
Suppose that CaO is present as an impurity to Li2O. The Ca2+ ion sub.pdfSuppose that CaO is present as an impurity to Li2O. The Ca2+ ion sub.pdf
Suppose that CaO is present as an impurity to Li2O. The Ca2+ ion sub.pdfarishmarketing21
 
Resistance A primitive adaptive immune Zone of inhibition The ability.pdf
Resistance A primitive adaptive immune Zone of inhibition The ability.pdfResistance A primitive adaptive immune Zone of inhibition The ability.pdf
Resistance A primitive adaptive immune Zone of inhibition The ability.pdfarishmarketing21
 
Refer to my progress on this assignment belowIn this problem you w.pdf
Refer to my progress on this assignment belowIn this problem you w.pdfRefer to my progress on this assignment belowIn this problem you w.pdf
Refer to my progress on this assignment belowIn this problem you w.pdfarishmarketing21
 
Q1) Show what part of SSL that protects against the following attack.pdf
Q1) Show what part of SSL that protects against the following attack.pdfQ1) Show what part of SSL that protects against the following attack.pdf
Q1) Show what part of SSL that protects against the following attack.pdfarishmarketing21
 
public class Patient extends Person {=========== Properties ====.pdf
public class Patient extends Person {=========== Properties ====.pdfpublic class Patient extends Person {=========== Properties ====.pdf
public class Patient extends Person {=========== Properties ====.pdfarishmarketing21
 
8. A human T lymphocyte is infected by a HIV. The viral genome prese.pdf
8. A human T lymphocyte is infected by a HIV. The viral genome prese.pdf8. A human T lymphocyte is infected by a HIV. The viral genome prese.pdf
8. A human T lymphocyte is infected by a HIV. The viral genome prese.pdfarishmarketing21
 

More from arishmarketing21 (20)

A series RL circuit includes a 9.05-V battery, a resistance of R = 0.pdf
A series RL circuit includes a 9.05-V battery, a resistance of R = 0.pdfA series RL circuit includes a 9.05-V battery, a resistance of R = 0.pdf
A series RL circuit includes a 9.05-V battery, a resistance of R = 0.pdf
 
What is the dangling pointer Explain with a proper example.Solut.pdf
What is the dangling pointer Explain with a proper example.Solut.pdfWhat is the dangling pointer Explain with a proper example.Solut.pdf
What is the dangling pointer Explain with a proper example.Solut.pdf
 
Write a function in javascript that calculates the average element i.pdf
Write a function in javascript that calculates the average element i.pdfWrite a function in javascript that calculates the average element i.pdf
Write a function in javascript that calculates the average element i.pdf
 
Which a not a likely location of a bacterial to be found Atheroscle.pdf
Which a not a likely location of a bacterial to be found  Atheroscle.pdfWhich a not a likely location of a bacterial to be found  Atheroscle.pdf
Which a not a likely location of a bacterial to be found Atheroscle.pdf
 
What’s Love Got To Do With ItThe Evolution of Human MatingB.pdf
What’s Love Got To Do With ItThe Evolution of Human MatingB.pdfWhat’s Love Got To Do With ItThe Evolution of Human MatingB.pdf
What’s Love Got To Do With ItThe Evolution of Human MatingB.pdf
 
What is the Surface characterization techniques of Fourier-transform.pdf
What is the Surface characterization techniques of Fourier-transform.pdfWhat is the Surface characterization techniques of Fourier-transform.pdf
What is the Surface characterization techniques of Fourier-transform.pdf
 
What is the running time complexity and space complexity of the follo.pdf
What is the running time complexity and space complexity of the follo.pdfWhat is the running time complexity and space complexity of the follo.pdf
What is the running time complexity and space complexity of the follo.pdf
 
A species has a diploid number of chromosomes of 6. If a cell from a.pdf
A species has a diploid number of chromosomes of 6. If a cell from a.pdfA species has a diploid number of chromosomes of 6. If a cell from a.pdf
A species has a diploid number of chromosomes of 6. If a cell from a.pdf
 
What are the security requirements and challenges of Grid and Cloud .pdf
What are the security requirements and challenges of Grid and Cloud .pdfWhat are the security requirements and challenges of Grid and Cloud .pdf
What are the security requirements and challenges of Grid and Cloud .pdf
 
Using the man command, determine which ls command option (flag) will.pdf
Using the man command, determine which ls command option (flag) will.pdfUsing the man command, determine which ls command option (flag) will.pdf
Using the man command, determine which ls command option (flag) will.pdf
 
There a six seats in a bar. Your friend took the second seat from th.pdf
There a six seats in a bar. Your friend took the second seat from th.pdfThere a six seats in a bar. Your friend took the second seat from th.pdf
There a six seats in a bar. Your friend took the second seat from th.pdf
 
The basic economic problem is that we only have so many resources, b.pdf
The basic  economic problem is that we only have so many resources, b.pdfThe basic  economic problem is that we only have so many resources, b.pdf
The basic economic problem is that we only have so many resources, b.pdf
 
The organization of interrupted genes is often conserved between spe.pdf
The organization of interrupted genes is often conserved between spe.pdfThe organization of interrupted genes is often conserved between spe.pdf
The organization of interrupted genes is often conserved between spe.pdf
 
The daisy has which inflorescence morphology type campanulte tubul.pdf
The daisy has which inflorescence morphology type  campanulte  tubul.pdfThe daisy has which inflorescence morphology type  campanulte  tubul.pdf
The daisy has which inflorescence morphology type campanulte tubul.pdf
 
Suppose that CaO is present as an impurity to Li2O. The Ca2+ ion sub.pdf
Suppose that CaO is present as an impurity to Li2O. The Ca2+ ion sub.pdfSuppose that CaO is present as an impurity to Li2O. The Ca2+ ion sub.pdf
Suppose that CaO is present as an impurity to Li2O. The Ca2+ ion sub.pdf
 
Resistance A primitive adaptive immune Zone of inhibition The ability.pdf
Resistance A primitive adaptive immune Zone of inhibition The ability.pdfResistance A primitive adaptive immune Zone of inhibition The ability.pdf
Resistance A primitive adaptive immune Zone of inhibition The ability.pdf
 
Refer to my progress on this assignment belowIn this problem you w.pdf
Refer to my progress on this assignment belowIn this problem you w.pdfRefer to my progress on this assignment belowIn this problem you w.pdf
Refer to my progress on this assignment belowIn this problem you w.pdf
 
Q1) Show what part of SSL that protects against the following attack.pdf
Q1) Show what part of SSL that protects against the following attack.pdfQ1) Show what part of SSL that protects against the following attack.pdf
Q1) Show what part of SSL that protects against the following attack.pdf
 
public class Patient extends Person {=========== Properties ====.pdf
public class Patient extends Person {=========== Properties ====.pdfpublic class Patient extends Person {=========== Properties ====.pdf
public class Patient extends Person {=========== Properties ====.pdf
 
8. A human T lymphocyte is infected by a HIV. The viral genome prese.pdf
8. A human T lymphocyte is infected by a HIV. The viral genome prese.pdf8. A human T lymphocyte is infected by a HIV. The viral genome prese.pdf
8. A human T lymphocyte is infected by a HIV. The viral genome prese.pdf
 

Recently uploaded

CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerunnathinaik
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...M56BOOKSTORE PRODUCT/SERVICE
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxsocialsciencegdgrohi
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitolTechU
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxJiesonDelaCerna
 

Recently uploaded (20)

CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developer
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptx
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptx
 

please help with java questionsJAVA CODEplease check my code and.pdf

  • 1. please help with java questions JAVA CODE please check my code and help my questions CLASS ADDRESS public class Address{ private int streetNumber; private String streetName; private String city; private String state; private String country; // streetNumber // streetName // city // state // country public Address(int streetNumber, String streetName, String city, String state, String country) { this.streetNumber = streetNumber; this.streetName = streetName; this.city = city; this.state = state; this.country = country; } //return the streetNumber public int getStreetNumber() { return streetNumber;
  • 2. } // set street number public void setStreetNumber(int streetNumber) { this.streetNumber = streetNumber; } //return the streetName public String getStreetName() { return streetName; } // set street name public void setStreetName(String streetName) { this.streetName = streetName; } //return the city public String getCity() { return city; } //set the city public void setCity(String city) { this.city = city; }
  • 3. //return the state public String getState() { return state; } //the state to set public void setState(String state) { this.state = state; } // return the country public String getCountry() { return country; } // tset country public void setCountry(String country) { this.country = country; } // see java.lang.Object#toString() @Override public String toString() { return " [streetNumber=" + streetNumber + ", streetName=" + streetName
  • 4. + ", city=" + city + ", state=" + state + ", country=" + country + "]"; } } //////////////////////////////////////////////////////////////////////////////////////// CLASS PERSON public class Person extends Address { private String name; public Person (int streetNumber, String streetName, String city, String state, String country, String name) { super(streetNumber, streetName, city, state, country); this.name = name; } //retuurn name public String getName() { return name; } // set name public void setName(String name) { this.name = name; } //see java.lang.Object#toString() @Override public String toString() { return "Person [name=" + name + ", getStreetNumber()=" + getStreetNumber() + ", getStreetName()=" + getStreetName()
  • 5. + ", getCity()=" + getCity() + ", getState()=" + getState() + ", getCountry()=" + getCountry() + ", toString()=" + super.toString() + ", getClass()=" + getClass() + ", hashCode()=" + hashCode() + "]"; } } ///////////////////////////////////////////////////////////////// CLASS STUDENT import java.util.ArrayList; import java.util.List; public class Student extends Person { private String CIN; List courses; public Student(int streetNumber, String streetName, String city, String state, String country, String name, String CIN) { super(streetNumber, streetName, city, state, country, name); // Auto-generated constructor stub this.CIN = CIN; courses = new ArrayList(); } // reutrn cin public String getCIN() { return CIN; } // set cin public void setCIN(String cIN) { CIN = cIN;
  • 6. } public void addCourse(classCourse c) { courses.add(c); } @Override public String toString() { return "Student [CIN=" + CIN + ", courses=" + courses + ", getName()=" + getName() + ", toString()=" + super.toString() + ", getStreetNumber()=" + getStreetNumber() + ", getStreetName()=" + getStreetName() + ", getCity()=" + getCity() + ", getState()=" + getState() + ", getCountry()=" + getCountry() + ", getClass()=" + getClass() + ", hashCode()=" + hashCode() + "]"; } } ///////////////////////////////////////////////////// CLASS FACULTYMEMBER import java.util.ArrayList; import java.util.List; public class FacultyMember extends Address { String employeeId; List schedule; // streetNumber //streetName // city // state
  • 7. // country // name // employeeId public FacultyMember(int streetNumber, String streetName, String city, String state, String country, String name, String employeeId) { super(streetNumber, streetName, city, state, country, name); this.employeeId = employeeId; schedule = new ArrayList(); } //return employeeid public String getEmployeeId() { return employeeId; } //set employeeid public void setEmployeeId(String employeeId) { this.employeeId = employeeId; } public void addSchedule(classCourse c) { schedule.add(c); } // @see java.lang.Object#toString() @Override public String toString() { return "FacultyMember [employeeId=" + employeeId + ", schedule=" + schedule + ", getName()=" + getName() + ", toString()="
  • 8. + super.toString() + ", getStreetNumber()=" + getStreetNumber() + ", getStreetName()=" + getStreetName() + ", getCity()=" + getCity() + ", getState()=" + getState() + ", getCountry()=" + getCountry() + ", getClass()=" + getClass() + ", hashCode()=" + hashCode() + "]"; } } ////////////////////////////////////////////////////////// CLASS CLASSCOURSE public class classCourse { String identifier; String courseTitle; // identifier // courseTitle public classCourse(String identifier, String courseTitle) { this.identifier = identifier; this.courseTitle = courseTitle; } //return identifier public String getIdentifier() { return identifier; } //identifier // set identifier public void setIdentifier(String identifier) {
  • 9. this.identifier = identifier; } // return cousetitle public String getCourseTitle() { return courseTitle; } // courseTitle // set consetitle public void setCourseTitle(String courseTitle) { this.courseTitle = courseTitle; } // @see java.lang.Object#toString() @Override public String toString() { return "Course [identifier=" + identifier + ", courseTitle=" + courseTitle + "]"; } } //////////////////////////////////////////////// MY QUESTION IS why address class and person class keep telling me that THE TYPE ADDRESS(PERSON) is alredy defined and how to fix it and can you help me to do Drive Class Write a Driver class that maintains lists of Students, Courses, and FacultyMembers and has a menu that provides ways to list them and to create them and add them to the list. Provide ways to delete Students and FacultyMembers and for Students and FacultyMembers to add and delete Courses from their course schedules. However, you do not need to provide a way to delete a
  • 10. Course from the list of Courses. Include a method that can be called from main that will use your methods to add and delete some hard-coded test data (several students, several faculty members, and several courses.) This will let you code the lists and test the methods to add and delete items without using the user input functions. Do not create a new Course when a Student adds or when a faculty member is assigned to teach; let the user choose a Course from the list. Solution You have provided an extra parameter to the constructor of Address in FacultyMember class. It should be super(streetNumber, streetName, city, state, country); not super(streetNumber, streetName, city, state, country, name); as the Address class takes only 5 parameters. And your driver class should look like below import java.util.List; public class Driver { List students; List courses; List facultyMembers; //Add public void addStudent(Student s){ students.add(s); } public void addCourse(classCourse c){ courses.add(c); } public void addFacultyMember(FacultyMember f){ facultyMembers.add(f); } //Delete public void deleteStudent(Student s){
  • 11. students.remove(s); } public void deleteCourse(classCourse c){ courses.remove(c); } public void deleteFacultyMember(FacultyMember f){ facultyMembers.remove(f); } //Show public void showStudents(){ for (Student s : students) { System.out.println(s.getName()); } } public void showCourses(){ for (classCourse c : courses) { System.out.println(c.getClass()); } } public void showFacultyMembers(){ for (FacultyMember f : facultyMembers) { System.out.println(f.getName()); } } } and in the Main function you can add Hard coded values to test the class.