Skip to content
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

Unit3.5 #1

Merged
merged 2 commits into from
Oct 14, 2023
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
7 changes: 7 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
{
"configurations": [
{
"type": "java",
"name": "U3_L5_Activity_Two",
"request": "launch",
"mainClass": "Unit3.U3_L5_Activity_Two",
"projectName": "my-app"
},
{
"type": "java",
"name": "U3_L4_Activity_Three",
Expand Down
18 changes: 18 additions & 0 deletions src/main/java/Unit3/U3_L5_Activity_One.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/* Lesson 5 Coding Activity Question 1 */
package Unit3;
import java.util.Scanner;

public class U3_L5_Activity_One {
public static void main(String[] args) {

Scanner scan = new Scanner(System.in);
System.out.println("Enter 2 integers:");
int x = scan.nextInt();
double y = scan.nextDouble();
double ratio = x / y;
if (ratio <= 8 && ratio > 1)
System.out.println("Ratio OK");

scan.close();
}
}
23 changes: 23 additions & 0 deletions src/main/java/Unit3/U3_L5_Activity_Two.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/* Lesson 5 Coding Activity Question 2 */
package Unit3;

import java.util.Scanner;

public class U3_L5_Activity_Two {
public static void main(String[] args) {

Scanner scan = new Scanner(System.in);
System.out.println("Enter two numbers:");
int a = scan.nextInt();
int b = scan.nextInt();

if (b == 0)
System.out.println(b + " is not a factor of " + a);
else if (a % b == 0)
System.out.println(b + " is a factor of " + a);
else
System.out.println(b + " is not a factor of " + a);

scan.close();
}
}
Loading