PRO192_-_PE01_-_SU_2024_2179.webp
Vân Anh1

PRO192_-_PE01_-_SU_2024_2179.webp

2 of 3
Paper No: 1
-current:int
+ElectricMotor()
+ElectricMotor(name: String, voltage:int,current:int)
+getName():String
+getPower():int
+setVoltage(voltage:int): void
+toString():String
ElectricMotor(name:String, voltage:int,current:int) parameterized constructor,which sets values to name, voltage and current of the electric motor. If the voltage is greater than 220 or less than 110, set it to 120. If the current is less or equal to 0, set it to 1
getName(): String - return the name
getPower(): int return the motor power,with the power = voltage * current
setVoltage(voltage:int):void update the
voltage if the voltage is from 110 to 220 toString():String: return a string format that contains all the information of the ElectricMotor: name, voltage, current,power. The name in uppercase
Do not format the result.
The main class is ready to test the program. The program output might look something like:
Enter name:toshiba
Enter name:toshiba
Enter name:toshiba
Enter name:toshiba
Enter voltage:220
Enter voltage:220
Enter voltage:240
Enter current:0
1. Test toString
Enter voltage:220
Enter current:2
1. Test toString
Enter current:2
1. Test toString
2. Test getPower
Enter current:2
1. Test toString
2. Test getPower
2. Test getPower
2. Test getPower
3. Test set Voltage
3. Test set Voltage
3. Test set Voltage
3. Test set Voltage TO
Zoom
Close
+ 100%
Chưa có bình luận nào.

Thông tin

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

Image metadata

Filename
PRO192_-_PE01_-_SU_2024_2179.webp
File size
262.1 KB
Dimensions
1920px x 990px

Share this media

Back
Bên trên Bottom