Paracells / stage0-module4-conditions-taskFinal

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

FINAL MODULE TASK

1. Season determiner.

Implement the program that will print the season name to the console by the number of the month. If month is incorrect -> print "Wrong month number". Month will be passed as the method argument. (Example: "1" -> "Winter", 0 -> "Wrong month number")

 public class SeasonDeterminer {
    public void tellTheSeason(int monthNumber) {
    }
 }

2. Triangle sides validator.

Create a program that will consume 3 points as method arguments and will print to the console if those points can build up a valid triangle or not. (output when correct: "this is a valid triangle", otherwise : "it's not a triangle")

 public class TriangleValidator {
     public void validate(double firstSide, double secondSide, double thirdSide) {
     }
 }

3. Days in a month.

Create a program that will consume a year and a month (validation is required) and will print amount of days in this month considering also if a year is leap or not.(prints amount of days or else "invalid date", negative years are not accepted)

public class DaysInMonth {
    public void printDays(int year, int month) {

    }
}

4. Integer divider.

Create a program that will consume 2 integers from method args (dividend and divider) and will perform integer division of dividend be divider, save the value, and then will multiply result by divider and will if got value is equal to dividend will print:"can be divided completely", otherwise "cannot be divided completely" or "division by zero".

   public class IntegerDivider {
       public void printCompletelyDivided(int dividend, int divider) {
   
       }
   }

5. Coordinate Pane.

Create a program that will consume 2 integers from method args as data of a coordinate point in a XY coordinate system and determine in which quadrant the coordinate point lies(beginning with top right:"first", "second", "third", "fourth", "zero"):

   public class CoordinatePane {
       public void printQuadrant(int x, int y) {
   
       }
   }

6. Bitwise values swap.

Implement the program that will swap 2 variables without creating new variables or objects, using bitwise operators:

 public class BitwiseValuesSwap {
     public void swap(int first, int second) {
     }
 }

About


Languages

Language:Java 100.0%