public class Main {
public static void main(String[] args) {
Scanner In = new Scanner(System.in);
System.out.print("Введите a: ");
int A = In.nextInt();
System.out.print("Введите b: ");
int B = In.nextInt();
try {
sum(A, B);
}catch(ArithmeticException e) {
System.out.println(e.getMessage());
}
}
static int sum(int a,int b) /* не уверен, что нужно */ throws ArithmeticException {
if (a<0) {
throw new ArithmeticException("a меньше 0");
} else if (b<0) { // моя очепятка детектед.... чеккед и корректед
throw new ArithmeticException("b меньше 0");
}
return a+b;
}
/*
https://www.baeldung.com/spring-webflux-cors
https://www.baeldung.com/spring-cors
*/
package com.broadview.bvreportsgenerator.configuration;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.reactive.config.CorsRegistry;
import org.springframework.web.reactive.config.EnableWebFlux;
import org.springframework.web.reactive.config.WebFluxConfigurer;
@Configuration
@EnableWebFlux
public class CorsGlobalConfiguration implements WebFluxConfigurer {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**");
}
}
сам тащусь от программирования
value:
...
number
...
number
integer fraction exponent
public List<Receipt> buildTitle(List<ComServiceResponse> comServiceResponses) {
return comServiceResponses.stream()
.map(ComServiceResponse::getComment)
.map(Comment::getComs)
.filter(Objects::nonNull)
.flatMap(List::stream) // Collection::stream ?
.map(comService -> { // todo:: extract to mapping method
var date = calendarService.formatDate(comService.getPeriod()); // todo :: check for null here and below
var paymentStatus = isPayed(comService.getComment().getComs());
var totalAmount = calculateComServiceTotalAmount(comService.getComment().getComs());
var receipt = new Receipt(); // todo:: beter use fluent accessors or builder
receipt.setPeriod(date);
receipt.setPayed(paymentStatus);
receipt.setTotalAmount(totalAmount);
receipt.setAccount(comService.getAccount());
receipt.setServiceIcon(properties.getMyVillageIcon());
receipt.setName(comService.getComment().getComs().get(0).getOwner());
receipt.setAddress(comService.getComment().getComs().get(0).getAddress());
return receipt;
})
.toList();
}