diff --git a/Task1StarterProject/.idea/.gitignore b/Task1StarterProject/.idea/.gitignore new file mode 100644 index 0000000..440e4c5 --- /dev/null +++ b/Task1StarterProject/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Datasource local storage ignored files +/../../../../:\WorkProjects\Task1StarterProject\.idea/dataSources/ +/dataSources.local.xml +# Editor-based HTTP Client requests +/httpRequests/ diff --git a/Task1StarterProject/.idea/misc.xml b/Task1StarterProject/.idea/misc.xml new file mode 100644 index 0000000..0548357 --- /dev/null +++ b/Task1StarterProject/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Task1StarterProject/.idea/modules.xml b/Task1StarterProject/.idea/modules.xml new file mode 100644 index 0000000..53d95c1 --- /dev/null +++ b/Task1StarterProject/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/Task1StarterProject/.idea/vcs.xml b/Task1StarterProject/.idea/vcs.xml new file mode 100644 index 0000000..6c0b863 --- /dev/null +++ b/Task1StarterProject/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Task1StarterProject/Task1StarterProject.iml b/Task1StarterProject/Task1StarterProject.iml new file mode 100644 index 0000000..c90834f --- /dev/null +++ b/Task1StarterProject/Task1StarterProject.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/Task1StarterProject/src/com/task1/Task1.java b/Task1StarterProject/src/com/task1/Task1.java new file mode 100644 index 0000000..edc8df4 --- /dev/null +++ b/Task1StarterProject/src/com/task1/Task1.java @@ -0,0 +1,64 @@ +package com.task1; + +/* +TODO Task Hint: + copy this line to be able to define Scanner object to Take input from user + Scanner input = new Scanner(System.in); +*/ +public class Task1 { + + public static void main(String[] args) { + + } + + /* + TODO: Question 1: (Sum the digits in an integer) Write a method that computes the sum of the digits in an long. + * Use the following method header: + public static long sumDigits(long n) + --------------------------------------------- + * Explanation: + For example, sumDigits(234) returns 9 (= 2 + 3 + 4). + (Hint: Use the % operator to extract digits and the / operator to remove the extracted digit. For instance, + to extract 4 from 234, use 234 % 10 (= 4 ). To remove 4 from 234, use 234 / 10 + (= 2 3 ). Use a loop to repeatedly extract and remove the digit until all the digits + are extracted. + > Bonus : Learn more about Math.abs() method and try to use it in the task through it's documentation + ---------------------------------------------- + * Write a method that prompts the user to enter an long then displays the sum of all its digits and call + this method in main + method to test the program. + + */ + + //TODO Write Answer for Question 1 Here + + + //-----------------------------------------------------------------------// + + /* + TODO: Question 2: (Sort three numbers) Write a method with the following header to display three + numbers in decreasing order: + --------------------- + public static void displaySortedNumbers(double num1, double num2, double num3) + --------------------- + Write a test program that prompts the user to enter three numbers and invokes the + method to display them in decreasing order. + */ + + //TODO Write Answer for Question 2 Here + + + //-----------------------------------------------------------------------// + + /* + TODO: Question 3: Write a method that prompts a student to enter a score. + If the score is greater or equal to 60, display “you pass the exam”; + otherwise, display “you don’t pass the exam”. Your program ends with input -1. + */ + + //TODO Write Answer for Question 3 Here + + + //-----------------------------------------------------------------------// + +} diff --git a/Task1StarterProject/src/com/task1/student_info.txt b/Task1StarterProject/src/com/task1/student_info.txt new file mode 100644 index 0000000..a47f2bc --- /dev/null +++ b/Task1StarterProject/src/com/task1/student_info.txt @@ -0,0 +1,3 @@ +Name: +------------------------------------- +Group: \ No newline at end of file