rous59
15.11.2021 23:44

Составьте блок схемы для решения следующих задач:

1) Составьте блок-схему алгоритма y=5x+b при x>b и y=5b+x при других x.

2) Если а>7, то найдите сумму b и c, иначе - найдите их разность.

3) Рост Маши - a см, Вити - b см. Определите, кто из них выше.

4) Книга стоит d руб., журнал h руб. У покупателя денег S руб. Хватит ли их на 3 журнала и 2 книги?

5) Сколько денег должен сдать сдачи продавец ( или спросить еще) за покупку k журналов по a руб. и h книг по b руб., если покупатель дает S руб.?

6) Успеет ли пассажир доехать за M часов до города, расположенного за S км на автомобиле, который едет со скоростью 60 км/ч?

Нажмите на рекламу ниже и сразу увидите ответ
↓
Популярные вопросы:
Ответ:
Aliona200
08.02.2020 23:42

Для В допустим, что слева направо.

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.getBirthDate().isOlder(h2.getBirthDate());

}

 

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));

}

}

0,0(0 оценок)
Ответ:
DimkaNevidimka13
25.03.2021 00:55
Using System;using System.Collections.Generic;using System.Linq;using System.Text.RegularExpressions;
namespace Rextester{    public class Program    {        public static void Main(string[] args)        {
                       int distance = 10;             // дистанция в километрах            int loss_of_fuel = 5;         // расход литров бензина на километр            int available_fuel = 100;  // литров бензина в баке                                   if (available_fuel/loss_of_fuel < distance){                    Console.WriteLine("Не хватит");            }else{                    Console.WriteLine("Хватит");            }                    }    }}
0,0(0 оценок)
Полный доступ
Позволит учиться лучше и быстрее. Неограниченный доступ к базе и ответам от экспертов и ai-bota Оформи подписку
logo
Начни делиться знаниями
Вход Регистрация
Что ты хочешь узнать?
Спроси ai-бота