Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

person.java public class Person { String name; int age; Person(String nam,int a) { name=nam; age=a; } public int getAge() { return age; } } student.java

image text in transcribed

person.java

public class Person {

String name;

int age;

Person(String nam,int a)

{

name=nam;

age=a;

}

public int getAge()

{

return age;

}

}

student.java

public class Student extends Person{

String course;

public Student()

{

super("", 0);

course="";

}

public Student(String nam, int a,String c) {

super(nam, a);

course=c;

}

public String getCourse()

{

return course;

}

public String getName()

{

return this.name;

}

}

group.java

import java.util.Scanner;

public class group {

String groupName;

Student students[];

public group(String gname)

{

groupName=gname;

students=new Student[4];

}

public void setStudents()

{

Scanner scan=new Scanner(System.in);

for(int i=0;i

{

System.out.println("Enter the details for student "+(i+1));

System.out.println("Enter Name:");

String name=scan.nextLine();

System.out.println("Enter Age:");

int age=scan.nextInt();

scan.nextLine();

System.out.println("Enter Course:");

String course=scan.nextLine();

students[i]=new Student(name,age,course);

}

}

public void display()

{

System.out.println("Group Details:");

System.out.println("Group Name: "+groupName);

System.out.println("Name of the students in the group:");

for(int i=0;i

{

students[i].getName();

}

}

}

app.java

public class App {

group g;

App(String gname)

{

g=new group(gname);

}

public void createGroup()

{

g.setStudents();

}

public void whatsUp()

{

System.out.println("Details of the third student in the group");

System.out.println(g.students[2].getName()+" is doing" +g.students[2].getCourse());

}

public void displayGroup()

{

g.display();

}

}

whatsapp.java

import java.util.Scanner;

public class Whatsapp {

public static void main(String[] args) {

Scanner scan=new Scanner(System.in);

System.out.println("Enter Group Name:");

String gname=scan.nextLine();

App whatsApp=new App(gname);

whatsApp.createGroup();

whatsApp.displayGroup();

whatsApp.whatsUp();

}

}

If you can complete the required tasks for the assignment without my code that will work. Thanks

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

Database Design Application Development And Administration

Authors: Michael V. Mannino

3rd Edition

0071107010, 978-0071107013

More Books

Students also viewed these Databases questions

Question

What are the best practices for managing a large software project?

Answered: 1 week ago

Question

How does clustering in unsupervised learning help in data analysis?

Answered: 1 week ago

Question

How do Data Types perform data validation?

Answered: 1 week ago

Question

How does Referential Integrity work?

Answered: 1 week ago