Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

how to use share code

+9 votes
asked May 20 by Nizar (210 points)

3 Answers

0 votes
answered May 20 by Peter Minarik (88,520 points)
Click on the orange SHARE button. Then copy the URL after the "Share Code:" label and provide it to others so they'll be able to view a copy of your OnlineGDB project.
0 votes
answered May 22 by mohammed (190 points)
public class person {
    private String name;
    private int age;
    public person() {
        name = "no name yet";
        age = 0;
    }
        public person(String name, int age){
            this.name = name;
            this.age = age;
            
        }
public String getname(){
    return name;
}
public void setname(String name) {
    this.name=name;
}
public int getage(){
    return age;
}
public void setname(int age) {
    this.age=age;
}
@Override
public String toString(){
    return "name: "+ name +" , age: " + age;
}
@Override
public boolean equals(Object obj){
    person other = (person) obj;
    return this.name.equals(other.name) && this.age ==other.age;
}
}
0 votes
answered May 22 by mohammed (190 points)
public class Student extends person{
    private String studentID;
    private String major;
    public Student(){
        studentID="unknown";
        major="undeclared";
        
    }
    public Student(String name, int age, String studentID, String major){
        super(name,age);
        this.studentID=studentID;
        this.major=major;
    }
    public String getstudentID(){
    return getstudentID;
}
public void setgetstudentID(String getstudentID) {
    this.getstudentID=getstudentID;
}
public int getmajor(){
    return major;
}
public void setmajor(String major) {
    this.major=major;
}
@Override
public String toString(){
    return super.toString()+ "studentID: "+ studentID +" , major: " + major;
}
@Override
public boolean equals(Object obj){
    Student other = (Student) obj;
    return super.equals(obj) && studentID.equals(other.studentID) && major.equals(other.major);
}
}
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...