Posts

Showing posts from August, 2024

employee

import java.util.*; class Employee { String empName; String empId; int Salary;   Scanner sc=new Scanner(System.in); void setempName(String n) { empName=n; } void setempId(String Id) { empId=Id; } void setSalary(int s) { Salary=s; } String getempName() { return empName; } int getSalary() { return Salary; } String getempId() { return empId; } void incrementSalary() { Salary=(int)Salary+(int)(Salary*0.2); } } class emp { public static void main(String agrs[]) { Employee e=new Employee(); e.setempName("Sanket Koshti"); e.setempId("1234abcd"); e.setSalary(20000); System.out.println("Name :"+e.getempName()); System.out.println("Employee ID :"+e.getempId()); System.out.println("EMployee Salary :"+e.getSalary()); System.out.println("After incrementing the salary :"); e.incrementSalary(); System.out.println("Name :"+e.getempName()); System.out.println(...

calendar

public class Date {     public static boolean isLeapYear(int year) {         return (year % 4 == 0 && year % 100 != 0) || (year % 400 == 0);     }     public static boolean isValidDate(int date, int month, int year) {         if (year < 1) {             return false;         }         if (month < 1 || month > 12) {             return false;         }         int[] daysInMonth = {31, isLeapYear(year) ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};         return date > 0 && date <= daysInMonth[month - 1];     }     public static String getDayOfWeek(int date, int month, int year) {         if (month == 1 || month == 2) {             month += 12;    ...