Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

For this assignment, you are going to write a program that stores and displays i

ID: 3882358 • Letter: F

Question

For this assignment, you are going to write a program that stores and displays information about a set of siblings.
You will need 3 separate files:
one for the Siblings class,
one for the SiblingsTester class, and
one for the Family class.

Siblings Class
This class will simulate a set of Siblings.
You will need 5 instance variables for:
User’s name
Number of brothers
Number of sisters
Names of brothers
Names of sisters.

You will need a getter and setter to access each of the instance variables (10 methods total).

You will need to include an argument constructor and a no-argument constructor to initialize the instance variables.

Siblings Tester Class
This class will test the methods and constructors of the Siblings Class.
Create 2 objects, one with the argument constructor and one with the no-argument constructor.

On the object constructed with the argument constructor, call all the getter methods to make sure
the instance variables were initialized correctly.

On the object constructed with the no-argument constructor, call all the setter methods and set
the instance variables to the values of your choosing. Then, call all the getter methods to make
sure the setters worked correctly.

FamilyTree Class
This class will use the Siblings class to simulate 3 sets of Siblings.
Below is the Siblinginformation you will use:

User Name
Num of Brothers
Brother Names
Num of Sisters
Sister Names

Create 2 objects of the Siblings class using the argument constructor and 1 object with the no argument constructor.

Set the values of the instance variables. to the information in the table.

Using the getter methods, display each set of Siblings’ information as a sentence, as shown below.

Explanation / Answer

Note: could u check the classes and output.If okay i will develop remaining code.Am asking this just for clarity and to develop exact output.thank you.

__________________

Siblings.java

public class Siblings {
private String usersName;
private int noOfBros;
private int noOfSis;
private String nameOfBros[];
private String nameOfSis[];
public Siblings(String usersName, int noOfBros, int noOfSis,
String[] nameOfBros, String[] nameOfSis) {
super();
this.usersName = usersName;
this.noOfBros = noOfBros;
this.noOfSis = noOfSis;
this.nameOfBros = nameOfBros;
this.nameOfSis = nameOfSis;
}
public Siblings() {

}
public String getUsersName() {
return usersName;
}
public void setUsersName(String usersName) {
this.usersName = usersName;
}
public int getNoOfBros() {
return noOfBros;
}
public void setNoOfBros(int noOfBros) {
this.noOfBros = noOfBros;
}
public int getNoOfSis() {
return noOfSis;
}
public void setNoOfSis(int noOfSis) {
this.noOfSis = noOfSis;
}
public String[] getNameOfBros() {
return nameOfBros;
}
public void setNameOfBros(String[] nameOfBros) {
this.nameOfBros = nameOfBros;
}
public String[] getNameOfSis() {
return nameOfSis;
}
public void setNameOfSis(String[] nameOfSis) {
this.nameOfSis = nameOfSis;
}

}

________________

SiblingsTester.java

public class SiblingsTester {

public static void main(String[] args) {

String usersName;
int noOfBros;
int noOfSis;
String nameOfBros[];
String nameOfSis[];

usersName = "Johnson";
noOfBros = 2;
noOfSis = 2;
nameOfBros = new String[noOfBros];
nameOfBros[0] = "Mills";
nameOfBros[1] = "Kelly";
nameOfSis = new String[noOfSis];
nameOfSis[0] = "Jenny";
nameOfSis[1] = "Lisa";
Siblings s1 = new Siblings(usersName, noOfBros, noOfSis, nameOfBros, nameOfSis);

usersName = "Mike";
noOfBros = 1;
noOfSis = 1;
nameOfBros = new String[1];
nameOfBros[0] = "Sachin";
nameOfSis = new String[1];
nameOfSis[0] = "Linda";
Siblings s2 = new Siblings(usersName, noOfBros, noOfSis, nameOfBros, nameOfSis);

Siblings s3 = new Siblings();
usersName = "Rick";
noOfBros = 1;
noOfSis = 1;
nameOfBros = new String[1];
nameOfBros[0] = "Jagan";
nameOfSis = new String[1];
nameOfSis[0] = "Milly";
s3.setUsersName(usersName);
s3.setNoOfBros(noOfBros);
s3.setNoOfSis(noOfSis);
s3.setNameOfBros(nameOfBros);
s3.setNameOfSis(nameOfSis);

System.out.print("User Name:" + s1.getUsersName() + " No of Bros:" + s1.getNoOfBros() + " No of Sis:" + s1.getNoOfSis());
String bnames[] = s1.getNameOfBros();
String snames[] = s1.getNameOfSis();
System.out.print(" Names of Bros:");
for (int i = 0; i < bnames.length; i++) {
System.out.print(bnames[i] + " ");
}
System.out.print(" Names of Sis:");
for (int i = 0; i < snames.length; i++) {
System.out.print(snames[i] + " ");
}

}

}

_____________________

Output:

User Name:Johnson
No of Bros:2
No of Sis:2
Names of Bros:Mills
Kelly

Names of Sis:Jenny
Lisa

_____________

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote