Skip to content

Commit 3494ccc

Browse files
committed
Completed till temperature converter
0 parents  commit 3494ccc

21 files changed

+365
-0
lines changed

.gitignore

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
### IntelliJ IDEA ###
2+
out/
3+
!**/src/main/**/out/
4+
!**/src/test/**/out/
5+
6+
### Eclipse ###
7+
.apt_generated
8+
.classpath
9+
.factorypath
10+
.project
11+
.settings
12+
.springBeans
13+
.sts4-cache
14+
bin/
15+
!**/src/main/**/bin/
16+
!**/src/test/**/bin/
17+
18+
### NetBeans ###
19+
/nbproject/private/
20+
/nbbuild/
21+
/dist/
22+
/nbdist/
23+
/.nb-gradle/
24+
25+
### VS Code ###
26+
.vscode/
27+
28+
### Mac OS ###
29+
.DS_Store

.idea/.gitignore

+3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/vcs.xml

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Java-Programming.iml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<module type="JAVA_MODULE" version="4">
3+
<component name="NewModuleRootManager" inherit-compiler-output="true">
4+
<exclude-output />
5+
<content url="file://$MODULE_DIR$">
6+
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
7+
</content>
8+
<orderEntry type="inheritedJdk" />
9+
<orderEntry type="sourceFolder" forTests="false" />
10+
</component>
11+
</module>
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package com.codewithsouma;
2+
3+
import java.util.Scanner;
4+
5+
public class AreaOfCircle {
6+
public static void main(String[] args){
7+
Scanner sc = new Scanner(System.in);
8+
System.out.print("Enter the radius: ");
9+
float radius = sc.nextFloat();
10+
float areaOfCircle = (float)(Math.PI * Math.pow(radius,2));
11+
System.out.println("Area of circle: "+areaOfCircle);
12+
}
13+
}
+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package com.codewithsouma;
2+
3+
import java.util.Scanner;
4+
5+
public class AreaOfTriangle {
6+
public static void main(String[] args){
7+
Scanner sc = new Scanner(System.in);
8+
System.out.print("Enter Base: ");
9+
float base = sc.nextFloat();
10+
System.out.print("Enter Height: ");
11+
float height = sc.nextFloat();
12+
13+
float areaOfTriangle = 0.5F * base * height;
14+
System.out.println("Area of Triangle: "+areaOfTriangle);
15+
16+
}
17+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package com.codewithsouma;
2+
3+
import java.util.Scanner;
4+
5+
public class ArithmeticOperator {
6+
public static void main(String[] args){
7+
Scanner sc = new Scanner(System.in);
8+
System.out.print("Enter number1: ");
9+
int number1 = sc.nextInt();
10+
System.out.print("Enter number2: ");
11+
int number2 = sc.nextInt();
12+
13+
System.out.println("Sum: "+ (number1 + number2));
14+
System.out.println("Sub: "+ (number1 - number2));
15+
System.out.println("Multiple: "+ (number1 * number2));
16+
System.out.println("Division: "+(number1 / number2));
17+
System.out.println("Remainder: "+ (number1 % number2));
18+
}
19+
}

src/com/codewithsouma/Assigment4.java

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package com.codewithsouma;
2+
3+
import java.util.Scanner;
4+
5+
public class Assigment4 {
6+
public static void main(String[] args){
7+
final int MONTHS_IN_THE_YEAR = 12;
8+
try(Scanner sc = new Scanner(System.in)){
9+
int phonePrice = 1800;//p
10+
System.out.print("Number of installments? ");
11+
int numberOfInstallment = sc.nextInt();
12+
System.out.print("Enter interest rate: ");
13+
float interestRate = sc.nextInt();
14+
15+
float monthlyInterest = interestRate / MONTHS_IN_THE_YEAR / 100;
16+
17+
double emi = phonePrice * monthlyInterest * (
18+
( Math.pow((1 + monthlyInterest), numberOfInstallment))
19+
/ (Math.pow((1 + monthlyInterest), numberOfInstallment) - 1)
20+
);
21+
22+
23+
double installmentPerMonth = (double) phonePrice / numberOfInstallment;
24+
System.out.println("Monthly installment Amount: "+emi + " euros");
25+
}
26+
}
27+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package com.codewithsouma;
2+
3+
public class AssigmentOperator {
4+
public static void main(String[] args){
5+
int x = 3;
6+
int y = 2;
7+
x += y; // 5
8+
System.out.println(x);
9+
10+
x-=y; // 3
11+
System.out.println(x);
12+
13+
x*=y; // 6
14+
System.out.println(x);
15+
16+
x/=y; // 3
17+
System.out.println(x);
18+
19+
x*=y; // 6
20+
System.out.println(x);
21+
22+
}
23+
}

src/com/codewithsouma/BioData.java

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package com.codewithsouma;
2+
3+
public class BioData {
4+
public static void main(String[] args){
5+
System.out.println("Soumadip Dey");
6+
System.out.print("8768454982");
7+
}
8+
9+
}

src/com/codewithsouma/Comment.java

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package com.codewithsouma;
2+
3+
public class Comment {
4+
public static void main(String[] args){
5+
// Comment are ignore by compiler
6+
//This is single line comment
7+
/*
8+
Soumadip Dey
9+
Comment demo
10+
08/03/2025
11+
*/
12+
System.out.println("Soumadip Dey");
13+
}
14+
}

src/com/codewithsouma/DataType.java

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package com.codewithsouma;
2+
3+
public class DataType {
4+
public static void main(String[] args){
5+
int i = 10;
6+
float f = 10.5f;
7+
double d = 123142.4;
8+
long l = 1231224L;
9+
char ch = 'A';
10+
byte byt = 10;
11+
short sh = 100;
12+
boolean bool = true;
13+
14+
System.out.println(i);
15+
System.out.println(f);
16+
System.out.println(d);
17+
System.out.println(l);
18+
System.out.println(ch);
19+
System.out.println(byt);
20+
System.out.println(sh);
21+
System.out.println(bool);
22+
23+
System.out.println("\nPrinting the variable using format specifier: ");
24+
System.out.printf("%d\n",i);
25+
System.out.printf("%.2f\n", f);
26+
System.out.printf("%.2f\n", d);
27+
System.out.printf("%d\n", l);
28+
System.out.printf("%c\n", ch);
29+
System.out.printf("%b\n", byt);
30+
System.out.printf("%d\n", sh);
31+
System.out.printf("%B\n", bool);
32+
33+
34+
}
35+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package com.codewithsouma;
2+
3+
public class EscapeSequence{
4+
public static void main(String[] args){
5+
System.out.println("Soumadip\n8768454982\nB.Tech in CSE.");
6+
System.out.println("\"Java programming\"");
7+
}
8+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package com.codewithsouma;
2+
3+
public class ExecutionSteps {
4+
public static void main(String[] args) {
5+
System.out.println("Hello World");
6+
}
7+
}

src/com/codewithsouma/Product.java

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package com.codewithsouma;
2+
3+
public class Product {
4+
public static void main(String[] args) {
5+
System.out.println("id: 101");
6+
System.out.println("title: iphone");
7+
System.out.println("1895 euros");
8+
System.out.println("description: perfect product with best image quality.");
9+
System.out.println("category: phone");
10+
11+
}
12+
}

src/com/codewithsouma/Product1.java

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package com.codewithsouma;
2+
3+
public class Product1 {
4+
public static void main(String[] args) {
5+
int id = 101;
6+
String title = "Iphone16";
7+
String price = "1895 euros";
8+
String description = "Perfect product with best image quality.";
9+
String category = "Phone";
10+
11+
System.out.println(id);
12+
System.out.println(title);
13+
System.out.println(price);
14+
System.out.println(description);
15+
System.out.println(category);
16+
17+
18+
19+
}
20+
}

src/com/codewithsouma/Product2.java

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package com.codewithsouma;
2+
3+
import java.util.Scanner;
4+
5+
public class Product2 {
6+
public static void main(String[] args){
7+
Scanner sc = new Scanner(System.in);
8+
System.out.print("Enter id: ");
9+
int id = sc.nextInt();
10+
sc.nextLine();
11+
System.out.print("Enter title: ");
12+
String title = sc.nextLine();
13+
System.out.print("Enter Price: ");
14+
String price = sc.nextLine();
15+
System.out.print("Enter description: ");
16+
String description = sc.nextLine();
17+
System.out.print("Enter category: ");
18+
String category = sc.nextLine();
19+
20+
System.out.println(id);
21+
System.out.println(title);
22+
System.out.println(price);
23+
System.out.println(description);
24+
System.out.println(category);
25+
}
26+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
package com.codewithsouma;
2+
3+
import java.io.IOException;
4+
import java.util.Scanner;
5+
6+
public class TemperatureConverter {
7+
public static double celsiusToFahrenheit(double celsius){
8+
return (((double) 9 / 5 * celsius) + 32);
9+
}
10+
11+
public static double fahrenheitToCelsius(double fahrenheit) {
12+
return ((double)5/9 * (fahrenheit - 32));
13+
}
14+
15+
16+
public static void main(String[] args){
17+
Scanner sc = new Scanner(System.in);
18+
int choice;
19+
label:
20+
while (true){
21+
System.out.println("1. Celsius to Fahrenheit");
22+
System.out.println("2. Fahrenheit to Celsius");
23+
System.out.println("3. Exit");
24+
System.out.print("Enter your choice: ");
25+
choice = sc.nextInt();
26+
switch (choice) {
27+
case 1:
28+
System.out.print("Enter celsius value: ");
29+
double celsius = sc.nextDouble();
30+
System.out.printf("Fahrenheit: %.2f\n" , celsiusToFahrenheit(celsius));
31+
break;
32+
case 2:
33+
System.out.print("Enter fahrenheit value: ");
34+
double fahrenheit = sc.nextDouble();
35+
System.out.printf("Celsius: %.2f\n" , fahrenheitToCelsius(fahrenheit));
36+
break;
37+
case 3:
38+
break label;
39+
default:
40+
System.out.println("Invalid Input");
41+
42+
}
43+
}
44+
}
45+
}

src/com/codewithsouma/UserInput.java

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package com.codewithsouma;
2+
3+
import java.util.Scanner;
4+
5+
public class UserInput {
6+
public static void main(String[] args){
7+
Scanner sc = new Scanner(System.in);
8+
System.out.println("Enter an integer: ");
9+
int number = sc.nextInt();
10+
System.out.println("Enter a float: ");
11+
float floatNumber = sc.nextFloat();
12+
System.out.println("Enter a Double: ");
13+
double doubleNumber = sc.nextDouble();
14+
System.out.println("Enter a Character: ");
15+
char character = sc.next().trim().charAt(0);
16+
sc.nextLine();
17+
System.out.println("Enter a string: ");
18+
String str = sc.nextLine();
19+
20+
System.out.println(number);
21+
System.out.println(floatNumber);
22+
System.out.println(doubleNumber);
23+
System.out.println(character);
24+
System.out.println(str);
25+
26+
}
27+
}

0 commit comments

Comments
 (0)