Skip to content

Commit 504dd62

Browse files
authored
Merge pull request #7 from DBryzz/Brice
Hello world
2 parents 77f3186 + a628886 commit 504dd62

File tree

12 files changed

+232
-0
lines changed

12 files changed

+232
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
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>
12+
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
package com.bryzz.dsc.arithmetic2;
2+
3+
import java.util.Scanner;
4+
import java.math.*;
5+
6+
class Arithmetic2 {
7+
8+
private static Scanner scanner = new Scanner(System.in);
9+
public static void main(String[] args) {
10+
System.out.println("Enter two numbers: ");
11+
int x = scanner.nextInt();
12+
int y = scanner.nextInt();
13+
14+
int sum = x + y;
15+
int dif = x - y;
16+
if(dif<0) {
17+
dif = y - x;
18+
}
19+
int pxt = x*y;
20+
int div = x/y;
21+
if(x == 0 ) {
22+
div = 0;
23+
}
24+
if(y == 0 ) {
25+
div = 0;
26+
}
27+
if(div < 1 ) {
28+
div = y/x;
29+
}
30+
31+
System.out.printf("\n\nSum = %d\nDifference = %d\nProduct = %d\nQuotient = %d", sum, dif, pxt, div);
32+
33+
34+
}
35+
}
36+
37+
/*
38+
(Arithmetic) Write an application that asks the user to enter two integers, obtains them
39+
from the user and prints their sum, product, difference and quotient (division).
40+
41+
Note that you should request a PR to this repo an your code will be merge in a branch with your name.
42+
Also, the name of your file should be arithmetic2-15.java*/

resources/Brice/CompareNumbers/.attach_pid18990

Whitespace-only changes.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
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>
12+
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package com.bryzz.dsc.numbers;
2+
3+
import java.util.Scanner;
4+
5+
6+
class Main {
7+
8+
private static Scanner scanner = new Scanner(System.in);
9+
public static void main(String[] args) {
10+
11+
System.out.println("Enter two numbers:\n");
12+
double x = scanner.nextDouble();
13+
double y = scanner.nextDouble();
14+
if(x > y) {
15+
System.out.println(x + " Larger");
16+
}else if(y > x) {
17+
System.out.println(y + " Larger");
18+
}else {
19+
System.out.println("These numbers are equal");
20+
}
21+
22+
}
23+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
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>
12+
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package com.bryzz.dsc;
2+
3+
public class DisplayNumbers {
4+
5+
public static void main(String[] args) {
6+
System.out.println("\n1 - 4 using one System.out.println()");
7+
onePrintln();
8+
9+
System.out.println("\n\n1 - 4 using four System.out.print()");
10+
fourPrintln();
11+
12+
System.out.println("\n\n1 - 4 using four System.out.printf()");
13+
printf();
14+
}
15+
16+
public static void onePrintln() {
17+
System.out.println("1 2 3 4");
18+
}
19+
20+
public static void fourPrintln() {
21+
int i = 1;
22+
for(i=1; i<=4; i++) {
23+
System.out.print(i + " ");
24+
}
25+
26+
}
27+
28+
public static void printf() {
29+
System.out.printf("%d %d %d %d",1, 2, 3, 4);
30+
}
31+
}
32+
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
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>
12+
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package com.bryzz.dsc.hello;
2+
3+
public class HelloWorld {
4+
5+
public static void main(String[] args) {
6+
System.out.println("Hello World!!!");
7+
}
8+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
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>
12+
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
package com.bryzz.dsc.arithmetic3;
2+
3+
4+
import java.util.Scanner;
5+
import java.math.*;
6+
7+
class Main {
8+
9+
private static Scanner scanner = new Scanner(System.in);
10+
public static void main(String[] args) {
11+
System.out.println("Enter 10 numbers: ");
12+
int[] list = new int[10];
13+
int sum = 0;
14+
int pxt = 1;
15+
int average = 0;
16+
int smallest = 0, largest = 0;
17+
18+
19+
for(int i=0; i<list.length; i++) {
20+
list[i] = scanner.nextInt();
21+
}
22+
23+
24+
for(int item: list) {
25+
sum += item;
26+
pxt *= item;
27+
}
28+
29+
largest = list[1];
30+
smallest = list[1];
31+
int temp = 0;
32+
for(int i=0; i<list.length; i++) {
33+
int num = list[i];
34+
35+
if(num > largest) {
36+
largest = num;
37+
}
38+
39+
if(num < smallest) {
40+
smallest = num;
41+
}
42+
43+
}
44+
45+
46+
average = sum/list.length;
47+
48+
49+
System.out.printf("\n\nSum = %d\nAverage = %d\nProduct = %d\nSmallest = %d\nLargest = %d", sum, average, pxt, smallest, largest);
50+
51+
52+
}
53+
54+
55+
}
56+
57+
/*
58+
59+
Write an application that inputs a given amount of integers from the user and
60+
displays the sum, average, product, smallest and largest of the numbers.
61+
[Note: The calculation of the average in this exercise should result in an integer representation of the average.
62+
So, if the sum of the values of 3 integers is 7, the average should be 2, not 2.3333….].
63+
64+
The name of your program file should be arithmethic3.java
65+
66+
67+
*/

0 commit comments

Comments
 (0)