firstLabwork
This commit is contained in:
parent
cd7a0fe3d5
commit
69c307f081
@ -3,6 +3,7 @@ package LabWork.DozorovaLabWork;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@SpringBootApplication
|
||||
@ -14,8 +15,34 @@ public class DozorovaLabWorkApplication {
|
||||
}
|
||||
|
||||
@GetMapping("/")
|
||||
public String Hello()
|
||||
{
|
||||
public String Hello() {
|
||||
return "Hello, user";
|
||||
}
|
||||
|
||||
@GetMapping("/sum")
|
||||
public String Sum(@RequestParam(required = false, defaultValue = "0") float first,
|
||||
@RequestParam(required = false, defaultValue = "0") float second) {
|
||||
return Float.toString(first + second);
|
||||
}
|
||||
|
||||
@GetMapping("/ras")
|
||||
public String Ras(@RequestParam(required = false, defaultValue = "0") float first,
|
||||
@RequestParam(required = false, defaultValue = "0") float second) {
|
||||
return Float.toString(first - second);
|
||||
}
|
||||
|
||||
@GetMapping("/pros")
|
||||
public String Pros(@RequestParam(required = false, defaultValue = "1") float first,
|
||||
@RequestParam(required = false, defaultValue = "1") float second) {
|
||||
return Float.toString(first * second);
|
||||
}
|
||||
@GetMapping("/del")
|
||||
public String Del(@RequestParam(required = false, defaultValue = "1") float first,
|
||||
@RequestParam(required = false, defaultValue = "1") float second) {
|
||||
if(second == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return Float.toString(first/second);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user