По рисунку на верху страницы 13 учебника составь алгоритм тропинка к сосне
Ответы на вопрос:
для в допустим, что слева направо.
class birthdate{
private int day;
private int month;
private int year;
birthdate(int day, int month, int year){
this.day = day;
this.month = month;
this.year = year;
}
public int getday() {
return day;
}
public void setday(int day) {
this.day = day;
}
public int getmonth() {
return month;
}
public void setmonth(int month) {
this.month = month;
}
public int getyear() {
return year;
}
public void setyear(int year) {
this.year = year;
}
public boolean isolder(birthdate bd) {
return this.year > = bd.getyear() & & this.month > = bd.getmonth() & & this.day > bd.getday();
}
}
class human{
private birthdate birthdate;
private string name;
human(string name, birthdate birthdate){
this.birthdate = birthdate;
this.name = name;
}
public birthdate getbirthdate(){
return this.birthdate;
}
public void setbirthdate(birthdate bd) {
this.birthdate = bd;
}
public string getname(){
return this.name;
}
public void setname(string name) {
this.name = name;
}
}
public class task {
private static boolean issumnumbertwodecimal(int number) {
int sum = 0;
while(true) {
sum += number % 10;
number /= 10;
if(number < 1) {
break;
}
}
return sum < 100;
}
private static string whichseason(int month) {
if(month > = 1 & & month < = 2 & & month == 12) {
return "winter";
} else if(month > = 3 & & month < = 5) {
return "spring";
} else if(month > = 6 & & month < = 8) {
return "summer";
} else if(month > = 9 & & month < = 11){
return "autumn";
} else {
return "there's no such month";
}
}
private static boolean issamefirstandsecond(int number, int numeral){
string snbr = string.valueof(number).substring(0, 2);
return integer.valueof(snbr) == numeral;
}
private static boolean isolder(human h1, human h2) {
return h1.(h2.;
}
public static void main(string[] args) {
int number = 2939393;
system.out.println(issumnumbertwodecimal(number));
//month and date has correct values
int month = 10;
human vasya = new human("vasya", new birthdate(1, month, 1990));
human natalia = new human("natalia", new birthdate(1, month, 1989));
system.out.println(isolder(vasya, natalia));
system.out.println(whichseason(month));
system.out.println(issamefirstandsecond(number, 29));
}
}
Популярно: Информатика
-
длвшуаблв17.01.2020 11:01
-
000Данил11111111108.05.2023 01:39
-
Ксаныч23.04.2020 10:31
-
WaysWhite21.09.2020 12:01
-
romanenkoanna6603.08.2020 14:11
-
egoraga14210.06.2023 07:09
-
геймер3912.02.2021 23:52
-
elliaana09.09.2021 12:44
-
danilovairinka10.05.2020 20:46
-
идьме02.02.2022 13:52