Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions LAB JAVA LOOPS AND VERSION CONTROL/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"java.project.sourcePaths": ["src"],
"java.project.outputPath": "bin",
"java.project.referencedLibraries": [
"lib/**/*.jar"
]
}
18 changes: 18 additions & 0 deletions LAB JAVA LOOPS AND VERSION CONTROL/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
## Getting Started

Welcome to the VS Code Java world. Here is a guideline to help you get started to write Java code in Visual Studio Code.

## Folder Structure

The workspace contains two folders by default, where:

- `src`: the folder to maintain sources
- `lib`: the folder to maintain dependencies

Meanwhile, the compiled output files will be generated in the `bin` folder by default.

> If you want to customize the folder structure, open `.vscode/settings.json` and update the related settings there.
## Dependency Management

The `JAVA PROJECTS` view allows you to manage your dependencies. More details can be found [here](https://github.com/microsoft/vscode-java-dependency#manage-dependencies).
33 changes: 33 additions & 0 deletions LAB JAVA LOOPS AND VERSION CONTROL/src/Main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package src.java;
import java.lang.reflect.Array;
import java.util.Arrays;

class Main{
public static void main(String[] args){
System.out.println("Hello World");
}


//task 1
public static int difference(int[] arr){
Arrays.sort(arr);
return arr[arr.length-1] - arr[0];
}


//task 2
public static void smallest(int[] arr){
Arrays.sort(arr);

System.out.println(arr[0]);
System.out.println(arr[1]);
}

//task3

public static int expression(int x, int y){
return (int) (x*x + Math.pow((4*y/5)-x, 2));

}

}