PRO192_-_FA_2024_-_PE_2884.webp
T

PRO192_-_FA_2024_-_PE_2884.webp

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 Crow with the following information:
Crow
Where:
-origin:String
Crow() - default constructor.
-weight:int
+Crow()
Crow(origin:String, weight:int) constructor, which sets values to origin and weight.
+Crow(origin:String, weight:int)
getOrigin():String returns a string s, which is obtained by concatenating the weight before the original string.
+getOrigin():String
+getWeight():int
getWeight():int- return weight.
+setWeight(weight:int):void
setWeight(weight:int):void weight + 3.update weight=new
Do not format the result.
The program output might look something like:
Enter origin: crow
Enter origin: crow
Enter weight: 2
Enter weight: 1
1. Test getOrigin()
1. Test getOrigin()
2. Test setWeight()
2. Test setWeight()
Zoom
Close
+ 100%
Chưa có bình luận nào.

Thông tin

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

Image metadata

Filename
PRO192_-_FA_2024_-_PE_2884.webp
File size
187.1 KB
Dimensions
1920px x 803px

Share this media

Back
Bên trên Bottom