PRO192_-_PE01_-_SU_2025_4004.webp
white_cloud1

PRO192_-_PE01_-_SU_2025_4004.webp

✓ Kizspy.me -
Question 1: (2 marks)
Do not pay attention to the real meaning of objects, variables, and their values in the questions below.
Write a class Restaurant (in the default package of the NetBeans) with the following information:
Restaurant
-restaurantName: String
-city: String
-seatedGuests: int
- guestCapacity: int
+ Restaurant(restaurantName: String,
city: String, seatedGuests: int,
guestCapacity: int)
+ getRestaurantName(): String
+ getAvailableSeating(): int
+toString(): String
Where:
Restaurant (restaurantName: String, city: String,
seatedGuests: int, guestCapacity: int)-
parameterized constructor, which sets values to
restaurantName, city, seatedGuests, and
guestCapacity.
⚫ getRestaurantName(): String If the restaurant
name is longer than 10 characters, only return the
first 10 characters of the name in uppercase. If it's
10 characters or fewer, return the entire name in
uppercase. (Hints: use the substring method)
⚫ getAvailableSeating(): int returns the available
seating with the available seating guestCapacity -
seated Guests. If the available seating <0 then
returns 0.
. Override toString():String return a string that
contains all the information of the restaurant:
restaurantName-city-seated Guests-guestCapacity
Zoom
+100%
Close
Chưa có bình luận nào.

Thông tin

Category
PRO192
Thêm bởi
white_cloud1
Ngày thêm
Lượt xem
2,992
Lượt bình luận
0
Rating
0.00 star(s) 0 đánh giá

Share this media

Back
Bên trên Bottom