Skip to content

Hello world #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Oct 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions resources/Brice/Arithmetic2/Arithmetic2.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package com.bryzz.dsc.arithmetic2;

import java.util.Scanner;
import java.math.*;

class Arithmetic2 {

private static Scanner scanner = new Scanner(System.in);
public static void main(String[] args) {
System.out.println("Enter two numbers: ");
int x = scanner.nextInt();
int y = scanner.nextInt();

int sum = x + y;
int dif = x - y;
if(dif<0) {
dif = y - x;
}
int pxt = x*y;
int div = x/y;
if(x == 0 ) {
div = 0;
}
if(y == 0 ) {
div = 0;
}
if(div < 1 ) {
div = y/x;
}

System.out.printf("\n\nSum = %d\nDifference = %d\nProduct = %d\nQuotient = %d", sum, dif, pxt, div);


}
}

/*
(Arithmetic) Write an application that asks the user to enter two integers, obtains them
from the user and prints their sum, product, difference and quotient (division).

Note that you should request a PR to this repo an your code will be merge in a branch with your name.
Also, the name of your file should be arithmetic2-15.java*/
Empty file.
12 changes: 12 additions & 0 deletions resources/Brice/CompareNumbers/CompareNumbers.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.bryzz.dsc.numbers;

import java.util.Scanner;


class Main {

private static Scanner scanner = new Scanner(System.in);
public static void main(String[] args) {

System.out.println("Enter two numbers:\n");
double x = scanner.nextDouble();
double y = scanner.nextDouble();
if(x > y) {
System.out.println(x + " Larger");
}else if(y > x) {
System.out.println(y + " Larger");
}else {
System.out.println("These numbers are equal");
}

}
}
12 changes: 12 additions & 0 deletions resources/Brice/DisplayNumbers/DisplayNumbers.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package com.bryzz.dsc;

public class DisplayNumbers {

public static void main(String[] args) {
System.out.println("\n1 - 4 using one System.out.println()");
onePrintln();

System.out.println("\n\n1 - 4 using four System.out.print()");
fourPrintln();

System.out.println("\n\n1 - 4 using four System.out.printf()");
printf();
}

public static void onePrintln() {
System.out.println("1 2 3 4");
}

public static void fourPrintln() {
int i = 1;
for(i=1; i<=4; i++) {
System.out.print(i + " ");
}

}

public static void printf() {
System.out.printf("%d %d %d %d",1, 2, 3, 4);
}
}

12 changes: 12 additions & 0 deletions resources/Brice/HelloWorld/HelloWorld.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.bryzz.dsc.hello;

public class HelloWorld {

public static void main(String[] args) {
System.out.println("Hello World!!!");
}
}
12 changes: 12 additions & 0 deletions resources/Brice/arithmetic3/arithmetic3.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
package com.bryzz.dsc.arithmetic3;


import java.util.Scanner;
import java.math.*;

class Main {

private static Scanner scanner = new Scanner(System.in);
public static void main(String[] args) {
System.out.println("Enter 10 numbers: ");
int[] list = new int[10];
int sum = 0;
int pxt = 1;
int average = 0;
int smallest = 0, largest = 0;


for(int i=0; i<list.length; i++) {
list[i] = scanner.nextInt();
}


for(int item: list) {
sum += item;
pxt *= item;
}

largest = list[1];
smallest = list[1];
int temp = 0;
for(int i=0; i<list.length; i++) {
int num = list[i];

if(num > largest) {
largest = num;
}

if(num < smallest) {
smallest = num;
}

}


average = sum/list.length;


System.out.printf("\n\nSum = %d\nAverage = %d\nProduct = %d\nSmallest = %d\nLargest = %d", sum, average, pxt, smallest, largest);


}


}

/*

Write an application that inputs a given amount of integers from the user and
displays the sum, average, product, smallest and largest of the numbers.
[Note: The calculation of the average in this exercise should result in an integer representation of the average.
So, if the sum of the values of 3 integers is 7, the average should be 2, not 2.3333….].

The name of your program file should be arithmethic3.java


*/