same as question__2

PHOTO EMBED

Tue May 23 2023 14:14:50 GMT+0000 (Coordinated Universal Time)

Saved by @Mohamedshariif #java

public static void main(String[] args) {
//Question 1.
		//int[] array = {1,-2,3,0,5,6,7,8,100,10};
		Scanner scanner = new Scanner(System.in);
		System.out.println("Enter the rate of exchange: ");
		double exchange_rate = scanner.nextDouble();
		
		System.out.println("Press 0: to conver Dollar to Turkish Lira  \nPress 1: to conver Turkish Lira to Dollar" );
		int choice = scanner.nextInt();
		
		if(choice == 0) {
			System.out.println("Enter amount in Dollar: ");
			double amount = scanner.nextDouble();
			amount = amount * exchange_rate;
			
			System.out.printf("Your amount from Dollar to Turkish Lira is %.3f: " , amount , " Lira");
		}
		else if(choice == 1)
			System.out.println("Enter amount in Turkish Lira: ");
		    double amount = scanner.nextDouble();
		    amount = amount / exchange_rate;
		    
		    System.out.printf("Your amount from Turkish Lira to Dollar is %.3f: " , amount , " Dollar");
		}
	}
content_copyCOPY