PRO192_-_PE01_-_FA_2024_2886.webp
H

PRO192_-_PE01_-_FA_2024_2886.webp

(2 marks)
Write a class named Journal with the following information:
Journal
-id: int
Where:
Journal() - default constructor
-publisher: String
Journal(id: int, publisher: String,price:double) parameterized constructor
-price: double
+ Journal ()
+ journal(id: int, publisher:String,
that set values to the id, publisher and price
price: double)
+Getters & Setters
Getters & Setters write the setters and getters of all the fields
+toString(): String
toString(): String-return a string format that contains all the information of the Journal:id, publisher, price. The price is formatted with two decimal places and the publisher in uppercase format.
Write a class JournalList which extends from ArrayList (ArrayList is a collection) with the following
information:
JournalList
Where:
5 of 6 Paper No: 1
+addJournal(journal: Journal):void
+getJournal PublisherByld (id:int): String
addJournal (journal: Journal):void - add
+getAverage Price ():double
new journal into the JournalList
get burnal PublisherByld(id: int): String return the publisher in uppercase of the journal by id. If not found matching data,return "N/A"
getAveragePrice():double return the
average of price of the journals in the Journal List

Hints: to declare the JournalList class, you can use the following statement:
+ 100%
Zoom
Close
Chưa có bình luận nào.

Thông tin

Category
PRO192
Thêm bởi
Hương Mai
Ngày thêm
Lượt xem
3,868
Lượt bình luận
0
Rating
0.00 star(s) 0 đánh giá

Image metadata

Filename
PRO192_-_PE01_-_FA_2024_2886.webp
File size
236.4 KB
Dimensions
1920px x 1009px

Share this media

Back
Bên trên Bottom