Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JUST DO LAB 5 SOURCE CODE IS FROM LAB 4 Continue from the previous Lab Exercise, add at least two more classes related to the

  • JUST DO LAB 5 SOURCE CODE IS FROM LAB 4

  • 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

    Actions

    (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.

Submit the UML diagram file with at least three classes with the java files (required) and the driver program file (optional). Include programmer's name and ID in all the java source files and UML file.

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------LAST LAB

  • Pick up one object in real world, and design a class to generate this type of objects.
  • Include at least two instance variables, one static variable, and two instance methods in the class design
  • Include the public, private, static and this keywords in the class definition
  • Create the UML diagram, UMLdiagramTemplate.docx

    Actions

    (download the template file)
  • Implement the [class_name].java file
  • Write a driver function (the main method) in the [class_name].java file to create at least one object and invoke all methods you created.

Submit the source file ([className].java) and UML diagram file ([className]UML.docx) and screenshot of the test run. Include both programmers' names and IDs in both the java source file and UML file.

source code

public class Student {

public static void main1(String[] args) {

}

//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("John", "Mathers", "HARVARD COLLEGE");

//Call toString method

System.out.println(student.toString());

//Create an object of Student using default constructor

Student student1 = new Student();

//Call setters

student1.setCollege(" COLLEGE OF ENGINEERING");

student1.setAddress("MATHERS 345, ANGAMALLY");

student1.setName("John");

//Call getters

System.out.println(Student.getStudentId());

System.out.println(student1.getName());

System.out.println(student1.getCollege());

System.out.println(student1.getAddress());

}

}

for lab 4

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

How To Build A Million Dollar Database

Authors: Michelle Bergquist

1st Edition

0615246842, 978-0615246840

More Books

Students also viewed these Databases questions