i-mmantech / i-mmantech Goto Github PK
View Code? Open in Web Editor NEWThis is my First try
This is my First try
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanMe = new Scanner(System.in);
System.out.println(" This is a Calculator Sensor \n");
System.out.print("Enter the first Number: ");
double number1 = scanMe.nextDouble();
System.out.print("Enter the second Number: ");
double number2 = scanMe.nextDouble();
scanMe.nextLine();
System.out.println("What operation do you want to perform? ");
String operation = scanMe.nextLine();
// sum for addition
if (operation.equals("sum")) {
System.out.printf("%f + %f = %f", number1,number2, number1 + number2);
// sub for subtraction
} else if (operation.equals("sub")) {
System.out.printf("%f - %f = %f", number1,number2, number1 - number2);
// mul for multiplication
} else if (operation.equals("mul")) {
System.out.printf("%f * %f = %f", number1,number2, number1 * number2);
// div for division
} else if (operation.equals("div")) {
if (number2 == 0) {
System.out.println("can not divide by ZERO(0).");
} else {
System.out.printf("%f / %f = %f", number1,number2, number1 / number2);
}
} else{
System.out.printf("%s is not a supported operation! ", operation);
}
scanMe.close();
}
}
Multidimensional arrays
public class Main {
public static void main(String[] args) {
// 2D array = an array of arrays
String[][] cars = new String[3][3];
cars[0][0] = "Camaro";
cars[0][1] = "Corvette";
cars[0][2] = "Silverado";
cars[1][0] = "Mustang";
cars[1][1] = "G-Wagon";
cars[1][2] = "Ferrari";
cars[2][0] = "Lambo";
cars[2][1] = "Ranger";
cars[2][2] = "Tesla";
for(int i=0; i<cars.length; i++) {
System.out.println();
for(int j=0; j<cars[i].length; j++) {
System.out.print(cars[i][j] +" ");
}
}
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.