Question: Hello, in Java please. (My IDE is Eclipse) Problem 1: 1) Define the class Publication that contains The private properties title of type String, year
Hello, in Java please. (My IDE is Eclipse)
Problem 1:
1) Define the class Publication that contains
The private properties title of type String, year of type int, authors of type String, and
publisher of type String
An empty no-arg constructor
A constructor that takes four parameters and sets the instance variables accordingly
A getter and setter methods for each instance variable
The instance method toString that does not take any parameter and returns a string. The
returned string is a string representation of the four instance variables. The format is of
your choice.
.
2) Define the class Conference that extends the class Publication and contains
The private properties name of type String, pages of type String, location of type String, and fee of type double.
An empty no-arg constructor
A constructor that takes four parameters and sets the instance variables of the class
Conference accordingly
A constructor that takes eight parameters and sets the instance variables of the class
Conference and the class Publication accordingly. You may use the setter methods to set the
values of the private instance variables of the class Publication.
A setter and getter methods for each instance variable
The instance method toString that does not take any parameter and returns a string. The
returned string is a string representation of the eight instance variables (four defined in
Conference and four defined in Publication). The format is of your choice.
.
Problem 2: A String contains the information of students in the following format.
String dataBase = FirstName1 LastName1 birthYear1 id1 gpa1,FirstName2 LastName2 birthYear2 id2
gpa2,
birthYear and id are stored as integer values and gpa as a double value.
.
A. Write a method named averageAge that takes a string in the above format and returns the
average age of the students. The methods header is as follows:
public static double averageAge(String s) { }
.
B. Write a method named averageGPA that takes a string in the above format and returns the
average age of all the students. The methods header is as follows:
public static double averageGPA(String s) { }
.
C. Write a method named studentInfo that takes two arguments: A string in
the above format and an integer value. The information of the student whose ID is provided as
the second argument is displayed. The header of the method is as follows:
public static void employeeInfo(String s, int id) { }
The method displays Record unfound if the second argument does not match any students ID
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
