4 fetch
This commit is contained in:
parent
9c2367c761
commit
02eae37b14
@ -0,0 +1,31 @@
|
||||
package ru.ip.labworks.labworks.controller;
|
||||
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
public class UserController {
|
||||
|
||||
@GetMapping("/sum")
|
||||
public String workSum(@RequestParam Integer num1, @RequestParam Integer num2){
|
||||
return String.format("Result = %s", num1 + num2);
|
||||
}
|
||||
|
||||
@GetMapping("/split")
|
||||
public String workSprit(@RequestParam String str1, @RequestParam String str2){
|
||||
String[] array = str1.split(str2);
|
||||
return String.format("Result = %s", String.join(" ", array));
|
||||
}
|
||||
|
||||
@GetMapping("/upper")
|
||||
public String workUpper(@RequestParam String str){
|
||||
return String.format(str.toUpperCase());
|
||||
}
|
||||
|
||||
@GetMapping("/avg")
|
||||
public String workAvarage(@RequestParam Integer num1, @RequestParam Integer num2){
|
||||
return String.format("Min = %s Max = %s Avg = %s", Math.min(num1, num2), Math.max(num1, num2), (num1 + num2) / 2);
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user