Answered step by step
Verified Expert Solution
Question
1 Approved Answer
public class Student { //Data members static private int studentId; private String name; private String address; private String college; /** * Default constructor */ public
public class Student {
//Data members
static private int studentId;
private String name;
private String address;
private String college;
/**
* Default constructor
*/
public Student() {
studentId=studentId+1;
name="XXX";
address="UNKNOWN";
college="UNKNOWN";
}
/**
* @param name
* @param address
* @param college
*/
public Student(String name, String address, String college) {
this.name = name;
this.address = address;
this.college = college;
studentId=studentId+1;
}
/**
* @return the name
*/
public String getName() {
return name;
}
/**
* @param name the name to set
*/
public void setName(String name) {
this.name = name;
}
/**
* @return the address
*/
public String getAddress() {
return address;
}
/**
* @param address the address to set
*/
public void setAddress(String address) {
this.address = address;
}
/**
* @return the college
*/
public String getCollege() {
return college;
}
/**
* @param college the college to set
*/
public void setCollege(String college) {
this.college = college;
}
/**
* @return the studentId
*/
public static int getStudentId() {
return studentId;
}
@Override
public String toString() {
return "Student1 [studentId=" + studentId + ", name=" + name + ", address=" + address + ", college=" + college
+ "]";
}
public static void main(String[] args) {
//Create an object of Student
Student student = new Student("Neena", "Cochin", "AMAL JYOTHI COLLEDGE");
//Call toString method
System.out.println(student.toString());
//Create an object of Student using default constructor
Student student1 = new Student();
//Call setters
student1.setCollege("AMAL JYOTHI COLLEDGE OF ENGINEERING");
student1.setAddress("COCHIN 345, ANGAMALLY");
student1.setName("Teena");
//Call getters
System.out.println(Student.getStudentId());
System.out.println(student1.getName());
System.out.println(student1.getCollege());
System.out.println(student1.getAddress());
}
}
UML DIAGRAM
please do the first two bullet points on the first picture with the code i sent. ignore the last two diagram pictures
Continue from the previous Lab Exercise, add at least two more classes related to the class you designed in Lab Exercise 4 Include at least three instance variables, one static variable, and two instance methods and one static method in each class design Create the UML diagram, UMTemplateClassRe.docx (download the template file) Implement the (class_name].java files for all classes (required) (optional) Write a driver function (the main function) in the class_name].java file to create at least one object and invoke all methods you created. UML diagram with class relationship [Class1 Name] Private data attributes + constructors and member methods.. I [Class 2 Name] Private data attributes... + constructors and member methods.. numbers [Class 2 Name] Private data attributes.. I constructors and member methods.. numbers relationship numbers relationship numbers Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started