diff --git a/Structures/src/AssignGrade.java b/Structures/src/AssignGrade.java index 8b8e871..5440627 100644 --- a/Structures/src/AssignGrade.java +++ b/Structures/src/AssignGrade.java @@ -6,7 +6,16 @@ public class AssignGrade { public static void main(String[] args) { Scanner scan = new Scanner(System.in); + System.out.println("Score: "); + int score = scan.nextInt(); + double grade = ((100 - score)/50.0) * 3 + 1; + + if (grade <= 4.0) { + System.out.println("Pass with grade: " + grade); + } else { + System.out.println("Fail with grade: " + grade); + } //todo: when executing the program you will be ask to write a score. //The program converts the score then into a grade and prints that grade (1.0, 1.3, 1.7, ...) //Note that the student passed when the student gets a score of 50.0 points (4.0) diff --git a/Structures/src/EvenOdd.java b/Structures/src/EvenOdd.java index 8a382c3..db1fbae 100644 --- a/Structures/src/EvenOdd.java +++ b/Structures/src/EvenOdd.java @@ -6,6 +6,16 @@ public class EvenOdd { public static void main(String[] args) { Scanner scan = new Scanner(System.in); + System.out.println("Number: "); + int number = scan.nextInt(); + + + for (int count = 0; count < number; count ++) { + if (count % 2 != 0) { + System.out.println(count); + } + } + //todo: The program takes a number as input. //It then goes through all integer values till reaching that value and prints all the odd ones.