You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// And from Jesus Christ, [who is] the faithful witness, [and] the first begotten of the dead, and the prince of the kings of the earth. Unto him that loved us, and washed us from our sins in his own blood (Revelation 1:5)
packagecom.javarush.task.task25.task2515;
publicclassRocketextendsBaseObject {
publicRocket(doublex, doubley) {
super(x, y, 1);
}
publicvoidmove() {y--;}
publicvoiddraw(Canvascanvas) {
canvas.setPoint(x, y, 'R');
}
}
/*
Space (11)
Теперь напишем класс Rocket.
Практически совпадает с классом Bomb.
Только:
а) Ракета летит вверх (т.е. y уменьшается на 1);
б) Рисуем не букву "B", а букву "R".
Требования:
1. В классе Rocket конструктор должен принимать координаты, а радиус выставлять всегда равным 1.
2. В классе Rocket напиши метод move(), который уменьшает координату y на единицу.
3. В классе Rocket напиши метод draw(Canvas canvas), который для canvas будет ставить символ 'R' в координатах x, y.