Java program to find which department has highest placement program code example

Example: Java program to find which department has highest placement program

import java.util.Scanner;public class Main{public static void main (String[] args){Scanner sc=new Scanner(System.in);System.out.println("Enter no of students placed in Computer science");int Computerscience= sc.nextInt();System.out.println("Enter no of students placed in Electronics");int Electronics=sc.nextInt();System.out.println("Enter no of students placed in Mechanical");int Mechanical=sc.nextInt();if(Computerscience<0||Electronics<0||Mechanical<0){System.out.println("Enter the number properly");}else if(Computerscience==Electronics && Electronics==Mechanical){System.out.println("None of the department has got the highest placement");}else if(Computerscience==Electronics && Mechanical<Computerscience){System.out.println("Highest placement");System.out.println("Computer science");System.out.println("Electronics");}else if(Computerscience==Mechanical && Electronics<Mechanical){System.out.println("Highest placement");System.out.println("Computer science");System.out.println("Mechanical");}else if(Electronics==Mechanical && Computerscience<Mechanical){System.out.println("Highest placement");System.out.println("Electronics");System.out.println("Mechanical");}else if(Computerscience>Electronics&&Computerscience>Mechanical){System.out.println("Highest placement");System.out.println("Computer science");}else if(Electronics>Computerscience && Electronics>Mechanical){System.out.println("Highest placement");System.out.println("Electronics");}else if(Mechanical>Computerscience && Mechanical>Electronics){System.out.println("Highest placement");System.out.println("Mechanical");}}}

Tags:

Misc Example