oaip
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
### IntelliJ IDEA ###
|
||||
out/
|
||||
!**/src/main/**/out/
|
||||
!**/src/test/**/out/
|
||||
.kotlin
|
||||
|
||||
### Eclipse ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
.settings
|
||||
.springBeans
|
||||
.sts4-cache
|
||||
bin/
|
||||
!**/src/main/**/bin/
|
||||
!**/src/test/**/bin/
|
||||
|
||||
### NetBeans ###
|
||||
/nbproject/private/
|
||||
/nbbuild/
|
||||
/dist/
|
||||
/nbdist/
|
||||
/.nb-gradle/
|
||||
|
||||
### VS Code ###
|
||||
.vscode/
|
||||
|
||||
### Mac OS ###
|
||||
.DS_Store
|
||||
Generated
+3
@@ -0,0 +1,3 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
Generated
+6
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_25" default="true" project-jdk-name="openjdk-25" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
||||
Generated
+8
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/laba3.iml" filepath="$PROJECT_DIR$/laba3.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -0,0 +1,66 @@
|
||||
import java.lang.runtime.SwitchBootstraps;
|
||||
import java.util.Scanner;
|
||||
import static java.lang.Math.*;
|
||||
public class Main {
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
Scanner in = new Scanner(System.in);
|
||||
System.out.println("Введите координаты точки x и y:");
|
||||
System.out.print("x=");
|
||||
double x = in.nextDouble();
|
||||
System.out.print("y=");
|
||||
double y = in.nextDouble();
|
||||
String s = "";
|
||||
int i = 0;
|
||||
double pl = 0;
|
||||
String S;
|
||||
if (x == 0 && y == 0) {
|
||||
S = "в начале координат";
|
||||
System.out.println(S);
|
||||
} else if ((pow(x - 1, 2) + pow(y, 2) > 1) && (x > 0) && (pow(x, 2) + pow(y, 2) > 1) && (pow(x, 2) + pow(y - 1, 2) < 1)) {
|
||||
String $ = "В области M1";
|
||||
i = 1;
|
||||
} else if ((pow(x + 1, 2) + pow(y, 2) < 1) && (pow(x, 2) + pow(y - 1, 2) < 1)) {
|
||||
S = "В области M2";
|
||||
i = 2;
|
||||
System.out.println(S);
|
||||
}else if((y>0)&&(pow(x,2)+pow(y-1,2)>1)&&(pow(x-1,2)+pow(y,2)<1)) {
|
||||
S = "В области M3";
|
||||
i = 3;
|
||||
System.out.println(S);
|
||||
}else if ((y<0)&&(pow(x+1,2)+pow(y,2)>1&&(pow(x-1,2))+pow(y,2)>1)&&(pow(x,2)+pow(y,2)<1)) {
|
||||
S = "В области M4";
|
||||
i = 4;
|
||||
System.out.println(S);
|
||||
}else if ((pow(x,2)+pow(y+1,2)>1)&&(x>-2)&&(x<0)&&(y>-2)&&(y<-1)) {
|
||||
S = "В области M5";
|
||||
i = 5;
|
||||
System.out.println(S);
|
||||
}else {
|
||||
S = "вне всех обозначенных областей";
|
||||
System.out.println(S);
|
||||
}
|
||||
System.out.println("Положение точки:"+s);
|
||||
switch(i) {
|
||||
case 1:
|
||||
pl = pl / 4 + 1 - pl / 6 - sqrt(3) / 4;
|
||||
break;
|
||||
case 2:
|
||||
pl = (pl / 2 - 1);
|
||||
break;
|
||||
case 3:
|
||||
pl = 1 - pl / 4 + pl / 4;
|
||||
break;
|
||||
case 4:
|
||||
pl = (sqrt(3) / 4 - pl / 12) * 2;
|
||||
break;
|
||||
case 5:
|
||||
pl = 1 + 1 - pl / 4;
|
||||
break;
|
||||
}
|
||||
if(i!=0)
|
||||
System.out.printf("Площадь M% d:%.3f",i,pl);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user