Skip to content

Commit a628886

Browse files
BryzzBryzz
Bryzz
authored and
Bryzz
committed
new directory Brice created. closes DSC-UB#2, closes DSC-UB#3, closes DSC-UB#4, closes DSC-UB#5
1 parent ad1e9d2 commit a628886

File tree

12 files changed

+114
-0
lines changed

12 files changed

+114
-0
lines changed

resources/Brice/CompareNumbers/.attach_pid18990

Whitespace-only changes.
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: 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)