Skip to content

Commit 68fe65e

Browse files
author
Harshilbhardwaj47
committed
day 1
1 parent 1c60481 commit 68fe65e

File tree

9 files changed

+195
-1
lines changed

9 files changed

+195
-1
lines changed

DAY1/HELLOWORLD/helloworld.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package DAY1;
2+
3+
public class helloworld {
4+
public static void main(String[] args) {
5+
System.out.println("HELLO WORLD");// here System.out.println is a out put statement like cout or printf in cpp
6+
// and c respectively
7+
}
8+
9+
}
10+
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package DAY1;
2+
3+
public class first {
4+
public static void main(String[] args) {
5+
System.out.println("HELLO");// first statement
6+
// here if you see print is occupied with ln
7+
// it means that it will automatically switch or change lines after first
8+
// statement
9+
// and will print second statement
10+
System.out.println("WORLD");
11+
// so your OUTPUT WILL BE
12+
// HELLO
13+
// WORLD
14+
// like this
15+
}
16+
}
17+
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
2+
3+
package DAY1;
4+
5+
public class second {
6+
public static void main(String[] args) {
7+
System.out.println("HELLO");// first statement
8+
// here after reading and seeing the first.java file you must have realized by
9+
// know that after printing HELLO java will change and start printing from next
10+
// line
11+
// first it will print -> HELLO
12+
System.out.print("***");// second statement
13+
// now if you see second statement do not have ln after print so her it will not
14+
// change line and start printing the third statement after the second statement
15+
// second it will be-> HELLO
16+
// ***
17+
System.out.println("WORLD");// third statement
18+
// and now the third statement will execute and start printing the statement
19+
// from the same line from where it left the second statement
20+
// third will be->HELLO
21+
// ***WORLD
22+
// now it will change line to print the fourth statement but its not there
23+
// so the program will terminate and this is how the output will be printed
24+
}
25+
}
26+
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package DAY1;
2+
3+
public class third {
4+
public static void main(String[] args) {
5+
System.out.printf("HELLO %s!%n", "WORLD");
6+
// A bonus formating statement
7+
// here you can see that i have putten ! between HELLO and WORLD but
8+
// here is the surprise the output will be
9+
// -> HELLO WORLD!
10+
// we will discuss on this formating statement in future because its pretty
11+
// complex in java
12+
// so till them try to find about it more that why i called it a bonus
13+
}
14+
}
15+

DAY1/Task/task1.txt

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
Objective
2+
In this challenge, you'll work with arithmetic operators. Check out the Tutorial tab for learning materials and an instructional video!
3+
4+
Task
5+
Given the meal price (base cost of a meal), tip percent (the percentage of the meal price being added as tip), and tax percent (the percentage of the meal price being added as tax) for a meal, find and print the meal's total cost.
6+
7+
Note: Be sure to use precise values for your calculations, or you may end up with an incorrectly rounded result!
8+
9+
Input Format
10+
11+
There are lines of numeric input:
12+
The first line has a double,MEALCOST(the cost of the meal before tax and tip).
13+
The second line has an integer,TIPPERCENT(the percentage of MEALCOST being added as tip).
14+
The third line has an integer,TACPERCENT(the percentage of MEALCOST being added as tax).
15+
16+
Output Format
17+
18+
Print the total MEALCOST, where TOTALCOST is the rounded integer result of the entire bill (MEALCOST with added tax and tip).
19+
20+
Sample Input
21+
22+
12.00
23+
20
24+
8
25+
Sample Output
26+
27+
15

DAY1/VARIABLES/variable1.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package DAY1;
2+
3+
public class variable1 {
4+
5+
public static void main(String[] args) {
6+
int xyz = 21;// we all know about int here xyz is variable that holds 21
7+
String abc = "HELLO WORLD";// here String abc holds HELLO WORLD
8+
long A = 2;// long hnn this might be new for you all this is used n place of int because
9+
// Sometimes the numbers are so large that exceeds so long is used to take care
10+
// of that
11+
System.out.println(A);
12+
// first statement prints the value stored in long
13+
System.out.print(abc);
14+
// second statement is used to print the value stored in the String
15+
System.out.println(xyz);
16+
// third statement is used to print value stored in int
17+
// NOTE:- JAVA is a case sensitive language so S must be capital in the printing
18+
// Statements as well as in String in future you all will get to know that
19+
// leaving this where you have to type in caps
20+
}
21+
}
22+

DAY1/VARIABLES/variable2.java

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package DAY1;
2+
3+
public class variable2 {
4+
public static void main(String[] args) {
5+
int a = 21, b = 21, c = 3, j = 89;
6+
// this is how you can declare multiple variables of same type
7+
String firstname = "harshil", lastname = "bhardwaj";
8+
// same goes with every datatype
9+
// now we will be performing some operations on them +,*,/and-
10+
// and with the String we will concatinate String and the out put
11+
int sum = a + b;
12+
// we declared the sum and applied + operations on a and b to give sum its value
13+
int mul = c * j;
14+
// we declared the sum and applied * operations on c and j to give sum its value
15+
int minus = j - a;
16+
// we declared the sum and applied - operations on a and j to give sum its value
17+
int div = b / c;
18+
// we declared the sum and applied / operations on b and c to give sum its value
19+
System.out.println("SUM IS: " + sum);
20+
System.out.println("PRODUCT IS: " + mul);
21+
System.out.println("DIFFERENCE IS: " + minus);
22+
System.out.println("QUESTIENT IS: " + div);
23+
System.out.println(firstname + " " + lastname);
24+
// here we concatenated the out put with + sign so that we can manipulate our
25+
// out put statement
26+
// our out put will be
27+
// SUM IS: 42
28+
// PRODUCT IS: 267
29+
// DIFFERENCE IS: 68
30+
// QUESTIENT IS: 7
31+
// harshil bhardwaj
32+
// so this is how we concatenate out put statements
33+
}
34+
}
35+

DAY1/VARIABLES/variable3.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package DAY1;
2+
3+
public class variable3 {
4+
public static void main(String[] args) {
5+
// in previous tutorial file we saw that we used int while doing division
6+
// but what if the things are not completely divisible
7+
// lets see
8+
int num1 = 23, num2 = 12;
9+
double num3 = 23, num4 = 12;
10+
// now instead for first applying and operation then printing the value we will
11+
// directly print the values and lets see the difference between int and double
12+
System.out.println(num1 / num2);// first statement
13+
// now if you see that num1 and num2 are int data types so there result will
14+
// also be int so the and they both are not fully divisible the answer should be
15+
// 1.something
16+
// but this first statement will give us only 1 the roundoff value
17+
// output of first statement-> 1
18+
System.out.println(num3 / num4);// second statement
19+
// now if you see here the second statement gives you the out put in double a
20+
// perfect decimal digit
21+
// output of second statement -> 1.9166666666666667
22+
}
23+
}
24+

README.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,19 @@
1-
# 30DaysOfJava
1+
# java-for-dummies
2+
Keep the track of tutorial files uploaded daywise and learn java
3+
# Setting up JDK
4+
https://www.oracle.com/java/technologies/javase-jdk13-downloads.html
5+
1) visit this site and download the latest version of jdk
6+
2) Second go to you system enviorment settings and copy paste the past of your jdk folder till bin there
7+
3) to check run java command on command promt if it runs you are good to goo
8+
# Setting up an IDE (ECLIPSE)
9+
I personally prefer ECPLISE IDE
10+
https://www.eclipse.org/downloads/
11+
1) visit this website and download the ide for free
12+
2) while downloading choose java devloper option that would be sufficient for beginner level
13+
3) After downloading go to new and select new project (JAVA)
14+
4) Create a new java class with a specific pakage name
15+
5 ) start coding you are good to go
16+
# java ?
17+
Java is a general-purpose programming language that is class-based, object-oriented, and designed to have as few implementation dependencies as possible.
18+
# Stable release: Java SE 14 / March 17, 2020;
19+

0 commit comments

Comments
 (0)