import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner= new Scanner(System.in);
while(true) {
System.out.println("The currency rates. Enter 1,2,3,4,5,6 to now your rate \n 1) EUR->UAH \n 2) UAH->EUR \n 3) UAH->USD \n 4) USD->UAH \n 5) CHF->USD \n 6) USD->CHF");
int currencyRate = scanner.nextInt();
if (currencyRate<7) {
System.out.println("Your amount:");
double cash = scanner.nextDouble();
switch (currencyRate) {
case 1 -> UAHToEUR(cash);
case 2 -> EURToUAH(cash);
case 3 -> UAHToUSD(cash);
case 4 -> USDToUAH(cash);
case 5 -> CHFToUSD(cash);
case 6 -> USDToCHF(cash);
}
}
else{
System.err.println("Not available option \nenter available option ;)\n \n \n \n \n \n\n");
}
}
}
public static void UAHToEUR(double UAH) {
double EUR = 0.0262;
System.out.println("UAH: " + UAH + " EUR: " + UAH * EUR);
}
public static void EURToUAH(double EUR) {
double UAH = 38.27;
System.out.println("EUR: " + EUR + " UAH: " + EUR * UAH);
}
public static void UAHToUSD(double UAH) {
double USD = 0.0303;
System.out.println("UAH: " + UAH + " USD: " + UAH * USD);
}
public static void USDToUAH(double USD) {
double UAH = 32.99;
System.out.println("USD: " + USD + " UAH: " + USD * UAH);
}
public static void CHFToUSD(double CHF) {
double USD = 1.08;
System.out.println("CHF: " + CHF + " USD: " + CHF * USD);
}
public static void USDToCHF(double USD) {
double CHF = 0.9259;
System.out.println("USD: " + USD + " CHF: " + USD * CHF);
}
}
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
// TODO: Replace examples and use TDD by writing your own tests
class SolutionTest {
@Test
void testSomething() {
// assertEquals("expected", "actual");
}
}
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner= new Scanner(System.in);
for(;;){
System.out.println("How old are you?");
System.out.println("Put your age.");
int number= scanner.nextInt();
if(number>23){
System.err.println("You can not pass!");
}
else if (number<23) {
System.out.println("Welcome to our grade checker");
System.out.println("What grade do you have?");
System.err.println("!!!IN MATH!!!");
System.out.println("");
System.out.println("");
System.out.println("Then put your grade in it!");
double grade = scanner.nextDouble();
if (grade < 7) {
if (grade < 3) {
System.out.println("Insufficient, you need to learn and not play all the time!");
} else if (grade < 5) {
System.out.println("Middle good grade, you can make it better!");
} else {
System.out.println("Your grade is high!");
for (int i = 0; i < 5; i++) {
Scanner scn = new Scanner(System.in);
System.out.println("Put 1 if you want to add,2 if -, 3 if *, 4 if/!");
System.out.println("Also you can the calculate 5 times, because you need to calculate with your MIND.3");
int answer = scn.nextInt();
System.out.println("Put 1. number");
double num1 = scn.nextInt();
System.out.println("Put 2. number");
double num2 = scn.nextInt();
switch (answer) {
case 1 -> {
System.out.println(num1 + "+" + num2 + "=" + (num1 + num2));
}
case 2 -> {
System.out.println(num1 + "-" + num2 + "=" + (num1 - num2));
}
case 3 -> {
System.out.println(num1 + "*" + num2 + "=" + (num1 * num2));
}
case 4 -> {
System.out.println(num1 + "/" + num2 + "=" + (num1 / num2));
}
default -> {
System.err.println("!!!ERROR you CAN'T put decimal numbers!!!");
}
}
}
}
} else {
System.err.println("Your grade must to be in diapason of 1 and 6. Try again!");
}
Scanner scn = new Scanner(System.in);
int nums [] = new int[5];
System.out.println("Enter 5 numbers which you want to see what is the biggest and smallest");
System.out.println("");
System.out.println("");
System.err.println("!!!IT CAN'T BE A LETTER!!!");
int min= Integer.MAX_VALUE;
for (int i = 0; i < nums.length; i++) {
nums [i] = scn.nextInt();
}
for (int i = 0; i < nums.length; i++) {
if (min>nums[i]){
min=nums[i];
}
}
int max= Integer.MIN_VALUE;
for (int i = 0; i < nums.length; i++) {
if (max<nums[i]){
max=nums[i];
}
}
System.out.println("Maximal number: " + max);
System.out.println("Minimal number: " + min);
}
}
}
}
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
// TODO: Replace examples and use TDD by writing your own tests
class SolutionTest {
@Test
void testSomething() {
// assertEquals("expected", "actual");
}
}