Delete lab1 directory
This commit is contained in:
		
							parent
							
								
									4924bbe62f
								
							
						
					
					
						commit
						1af299f8f7
					
				
							
								
								
									
										8
									
								
								lab1/FunctionCalculator/.idea/.gitignore
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										8
									
								
								lab1/FunctionCalculator/.idea/.gitignore
									
									
									
										generated
									
									
										vendored
									
									
								
							@ -1,8 +0,0 @@
 | 
			
		||||
# Default ignored files
 | 
			
		||||
/shelf/
 | 
			
		||||
/workspace.xml
 | 
			
		||||
# Editor-based HTTP Client requests
 | 
			
		||||
/httpRequests/
 | 
			
		||||
# Datasource local storage ignored files
 | 
			
		||||
/dataSources/
 | 
			
		||||
/dataSources.local.xml
 | 
			
		||||
							
								
								
									
										1
									
								
								lab1/FunctionCalculator/.idea/.name
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										1
									
								
								lab1/FunctionCalculator/.idea/.name
									
									
									
										generated
									
									
									
								
							@ -1 +0,0 @@
 | 
			
		||||
Main.java
 | 
			
		||||
							
								
								
									
										6
									
								
								lab1/FunctionCalculator/.idea/misc.xml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										6
									
								
								lab1/FunctionCalculator/.idea/misc.xml
									
									
									
										generated
									
									
									
								
							@ -1,6 +0,0 @@
 | 
			
		||||
<?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
<project version="4">
 | 
			
		||||
  <component name="ProjectRootManager" version="2" languageLevel="JDK_19" default="true" project-jdk-name="openjdk-19" project-jdk-type="JavaSDK">
 | 
			
		||||
    <output url="file://$PROJECT_DIR$/out" />
 | 
			
		||||
  </component>
 | 
			
		||||
</project>
 | 
			
		||||
							
								
								
									
										8
									
								
								lab1/FunctionCalculator/.idea/modules.xml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										8
									
								
								lab1/FunctionCalculator/.idea/modules.xml
									
									
									
										generated
									
									
									
								
							@ -1,8 +0,0 @@
 | 
			
		||||
<?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
<project version="4">
 | 
			
		||||
  <component name="ProjectModuleManager">
 | 
			
		||||
    <modules>
 | 
			
		||||
      <module fileurl="file://$PROJECT_DIR$/FunctionCalculator.iml" filepath="$PROJECT_DIR$/FunctionCalculator.iml" />
 | 
			
		||||
    </modules>
 | 
			
		||||
  </component>
 | 
			
		||||
</project>
 | 
			
		||||
@ -1,11 +0,0 @@
 | 
			
		||||
<?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>
 | 
			
		||||
										
											Binary file not shown.
										
									
								
							@ -1,51 +0,0 @@
 | 
			
		||||
import java.util.Scanner;
 | 
			
		||||
public class Main {
 | 
			
		||||
    public static void main(String[] args) {
 | 
			
		||||
        //C2 = 2501 % 2 = 1, і операція O1 буде відніманням (-).
 | 
			
		||||
        //C3 = 2501 % 3 = 2
 | 
			
		||||
        //C5 = 2501 % 5 = 1, і операція O2 буде діленням (/).
 | 
			
		||||
        //C7 = 2501 % 7 = 4, тип індексів i та j буде char.
 | 
			
		||||
        double result = 0;  // результат
 | 
			
		||||
        char i, j;
 | 
			
		||||
        char operation1 = '-';
 | 
			
		||||
        double constant = 2.0;
 | 
			
		||||
        Scanner scanner = new Scanner(System.in);
 | 
			
		||||
        System.out.print("Введіть значення n: ");
 | 
			
		||||
        int n = scanner.nextInt();
 | 
			
		||||
        System.out.print("Введіть значення m: ");
 | 
			
		||||
        int m = scanner.nextInt();
 | 
			
		||||
 | 
			
		||||
        // Обчислення значення функції S
 | 
			
		||||
        for (i = 'a'; i <= 'a' + n - 1; i++) {
 | 
			
		||||
            for (j = 'b'; j <= 'b' + m - 1; j++) {
 | 
			
		||||
                try {
 | 
			
		||||
                    double value = (double) i / applyOperation(j, operation1, constant);
 | 
			
		||||
                    result += value;
 | 
			
		||||
                } catch (ArithmeticException e) {
 | 
			
		||||
                    System.out.println("Ділення на нуль: " + e.getMessage());
 | 
			
		||||
                } catch (Exception e) {
 | 
			
		||||
                    System.out.println("Виникла помилка: " + e.getMessage());
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // Виведення результату
 | 
			
		||||
        System.out.println("Результат: " + result);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // Метод, який застосовує операцію О1 до двох чисел
 | 
			
		||||
    public static double applyOperation(char j, char operation, double constant) throws Exception {
 | 
			
		||||
        switch (operation) {
 | 
			
		||||
            case '-':
 | 
			
		||||
                return (double) j - constant;
 | 
			
		||||
            case '/':
 | 
			
		||||
                if (constant == 0.0) {
 | 
			
		||||
                    throw new ArithmeticException("C не може бути рівним нулю");
 | 
			
		||||
                } else {
 | 
			
		||||
                    return (double) j / constant;
 | 
			
		||||
                }
 | 
			
		||||
            default:
 | 
			
		||||
                throw new Exception("Непідтримувана операція: " + operation);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										
											BIN
										
									
								
								lab1/lab1.pdf
									
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								lab1/lab1.pdf
									
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user