PRO192_-_FA_2024_-_Block_5_-_PE_3211.webp
Yuki1

PRO192_-_FA_2024_-_Block_5_-_PE_3211.webp

  • Media owner Yuki1
  • Ngày thêm
Question 1:
(2 marks) Read PE instructions at the bottom of the exam paper.
Do not pay attention to real meaning of objects, variables and their values in the questions below.
Write a class named Dove with the following information:
Dove
Where:
-origin: String
Dove() - default constructor.
-age:int
Dove(origin: String, age:int) constructor, which sets values to origin and age.
+Dove()
+Dove(origin: String, age:int)
getOrigin():String returns a string s, which is obtained by concatenating the age before the original string.
+getOrigin():String
+getAge():int
+setAge(age:int):void
getAge():int-return age.
setAge(age:int):void - update age=new age / 2.
Do not format the result.
The program output might look something like:
Enter origin: dove
Enter age: 1
Enter origin: dove
1. Test getOrigin()
Enter age: 1
1. Test getOrigin()
2. Test setAge()
2. Test setAge()
Enter TC (1 or 2): 1
Enter TC (1 or 2): 2
Zoom
+ 100%
Close
Chưa có bình luận nào.

Thông tin

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

Image metadata

Filename
PRO192_-_FA_2024_-_Block_5_-_PE_3211.webp
File size
182 KB
Dimensions
1920px x 813px

Share this media

Back
Bên trên Bottom