├── ATMExample.java ├── BMICalculatorInMetric.java ├── FeesManagementApp.java └── README.md /ATMExample.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | //create ATMExample class to implement the ATM functionality 4 | public class ATMExample 5 | { 6 | //main method starts 7 | public static void main(String args[] ) 8 | { 9 | //declare and initialize balance, withdraw, and deposit 10 | int balance = 100000, withdraw, deposit; 11 | 12 | //create scanner class object to get choice of user 13 | Scanner sc = new Scanner(System.in); 14 | 15 | while(true) 16 | { 17 | System.out.println("Automated Teller Machine"); 18 | System.out.println("Choose 1 for Withdraw"); 19 | System.out.println("Choose 2 for Deposit"); 20 | System.out.println("Choose 3 for Check Balance"); 21 | System.out.println("Choose 4 for EXIT"); 22 | System.out.print("Choose the operation you want to perform:"); 23 | 24 | //get choice from user 25 | int choice = sc.nextInt(); 26 | switch(choice) 27 | { 28 | case 1: 29 | System.out.print("Enter money to be withdrawn:"); 30 | 31 | //get the withdrawl money from user 32 | withdraw = sc.nextInt(); 33 | 34 | //check whether the balance is greater than or equal to the withdrawal amount 35 | if(balance >= withdraw) 36 | { 37 | //remove the withdrawl amount from the total balance 38 | balance = balance - withdraw; 39 | System.out.println("Please collect your money"); 40 | } 41 | else 42 | { 43 | //show custom error message 44 | System.out.println("Insufficient Balance"); 45 | } 46 | System.out.println(""); 47 | break; 48 | 49 | case 2: 50 | 51 | System.out.print("Enter money to be deposited:"); 52 | 53 | //get deposite amount from te user 54 | deposit = sc.nextInt(); 55 | 56 | //add the deposit amount to the total balanace 57 | balance = balance + deposit; 58 | System.out.println("Your Money has been successfully depsited"); 59 | System.out.println(""); 60 | break; 61 | 62 | case 3: 63 | //displaying the total balance of the user 64 | System.out.println("Balance : "+balance); 65 | System.out.println(""); 66 | break; 67 | 68 | case 4: 69 | //exit from the menu 70 | System.exit(0); 71 | } 72 | } 73 | } 74 | } -------------------------------------------------------------------------------- /BMICalculatorInMetric.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | 4 | public class BMICalculatorInMetric { 5 | 6 | public static void main(String[] args) throws Exception { 7 | calculateBMI(); 8 | } 9 | 10 | private static void calculateBMI() throws Exception { 11 | System.out.print("Please enter your weight in kg: "); 12 | Scanner s = new Scanner(System.in); 13 | float weight = s.nextFloat(); 14 | System.out.print("Please enter your height in cm: "); 15 | float height = s.nextFloat(); 16 | 17 | // multiplication by 100*100 for cm to m conversion 18 | float bmi = (100*100*weight)/(height*height); 19 | 20 | System.out.println("Your BMI is: "+bmi); 21 | printBMICategory(bmi); 22 | 23 | } 24 | 25 | // Prints BMI category 26 | private static void printBMICategory(float bmi) { 27 | if(bmi < 18.5) { 28 | System.out.println("You are underweight"); 29 | }else if (bmi < 25) { 30 | System.out.println("You are normal"); 31 | }else if (bmi < 30) { 32 | System.out.println("You are overweight"); 33 | }else { 34 | System.out.println("You are obese"); 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /FeesManagementApp.java: -------------------------------------------------------------------------------- 1 | import java.util.ArrayList; 2 | import java.util.List; 3 | import java.util.Scanner; 4 | 5 | class Student { 6 | private int id; 7 | private String name; 8 | private double totalFeesPaid; 9 | private double totalFeesDue; 10 | 11 | public Student(int id, String name, double totalFeesPaid, double totalFeesDue) { 12 | this.id = id; 13 | this.name = name; 14 | this.totalFeesPaid = totalFeesPaid; 15 | this.totalFeesDue = totalFeesDue; 16 | } 17 | 18 | public int getId() { 19 | return id; 20 | } 21 | 22 | public String getName() { 23 | return name; 24 | } 25 | 26 | public double getTotalFeesPaid() { 27 | return totalFeesPaid; 28 | } 29 | 30 | public double getTotalFeesDue() { 31 | return totalFeesDue; 32 | } 33 | 34 | public void makePayment(double amount) { 35 | if (amount > 0) { 36 | totalFeesPaid += amount; 37 | totalFeesDue -= amount; 38 | System.out.println("Payment of Rs. " + amount + " received from " + name); 39 | } else { 40 | System.out.println("Invalid payment amount."); 41 | } 42 | } 43 | 44 | @Override 45 | public String toString() { 46 | return "Student ID: " + id + "\nName: " + name + "\nTotal Fees Paid: Rs. " + totalFeesPaid 47 | + "\nTotal Fees Due: Rs. " + totalFeesDue; 48 | } 49 | } 50 | 51 | class FeesManagementSystem { 52 | private List students; 53 | 54 | public FeesManagementSystem() { 55 | students = new ArrayList<>(); 56 | } 57 | 58 | public void addStudent(Student student) { 59 | students.add(student); 60 | } 61 | 62 | public Student findStudentById(int id) { 63 | for (Student student : students) { 64 | if (student.getId() == id) { 65 | return student; 66 | } 67 | } 68 | return null; 69 | } 70 | } 71 | 72 | public class FeesManagementApp { 73 | public static void main(String[] args) { 74 | Scanner scanner = new Scanner(System.in); 75 | FeesManagementSystem system = new FeesManagementSystem(); 76 | 77 | while (true) { 78 | System.out.println("\tFEES MANAGEMENT SYSTEM"); 79 | System.out.println("1. Add Student"); 80 | System.out.println("2. Make Payment"); 81 | System.out.println("3. View Student Details"); 82 | System.out.println("4. Exit\n"); 83 | System.out.print("Enter your choice: "); 84 | 85 | int choice = scanner.nextInt(); 86 | scanner.nextLine(); 87 | 88 | switch (choice) { 89 | case 1: 90 | System.out.print("\nEnter Student ID: "); 91 | int id = scanner.nextInt(); 92 | scanner.nextLine(); 93 | System.out.print("Enter Student Name: "); 94 | String name = scanner.nextLine(); 95 | System.out.print("Enter Total Fees Paid: "); 96 | double totalFeesPaid = scanner.nextDouble(); 97 | System.out.print("Enter Total Fees Due: "); 98 | double totalFeesDue = scanner.nextDouble(); 99 | Student student = new Student(id, name, totalFeesPaid, totalFeesDue); 100 | system.addStudent(student); 101 | System.out.println("Student added successfully.\n"); 102 | break; 103 | case 2: 104 | System.out.print("Enter Student ID for payment: "); 105 | int paymentId = scanner.nextInt(); 106 | Student paymentStudent = system.findStudentById(paymentId); 107 | if (paymentStudent != null) { 108 | System.out.print("Enter Payment Amount: "); 109 | double paymentAmount = scanner.nextDouble(); 110 | paymentStudent.makePayment(paymentAmount); 111 | } else { 112 | System.out.println("Student not found.\n"); 113 | } 114 | break; 115 | case 3: 116 | System.out.print("Enter Student ID to view details: "); 117 | int viewId = scanner.nextInt(); 118 | Student viewStudent = system.findStudentById(viewId); 119 | if (viewStudent != null) { 120 | System.out.println(viewStudent); 121 | } else { 122 | System.out.println("Student not found.\n"); 123 | } 124 | break; 125 | case 4: 126 | System.out.println("\nExiting the program. Goodbye!"); 127 | scanner.close(); 128 | System.exit(0); 129 | default: 130 | System.out.println("\nInvalid choice. Please try again."); 131 | } 132 | } 133 | } 134 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # CodersCave-JavaDevelopmentIntern --------------------------------------------------------------------------------