Practice set 4
package com.company;
import java.sql.SQLOutput;
import java.util.Scanner;
public class CWH_PractiseSet04 {
public static void main(String[] args) {
// Question1
// int a= 10;
// if (a = 11) {
// System.out.println("I am 11");
//
// }
// else{
// System.out.println("I am not 11");
// }
// Question2
// Scanner sc= new Scanner(System.in);
// System.out.println("Enter the marks of maths: ");
// float m= sc.nextFloat();
// if(m>100){
// System.out.println("You are entering wrong number");
// }
// else {
// System.out.println("Enter the marks of chemistry:");
// float c = sc.nextFloat();
// if (c > 100) {
// System.out.println("You are entering wrong number");
// } else {
//
// System.out.println("Enter the marks of physics:");
// float p = sc.nextFloat();
// if (p > 100) {
// System.out.println("You are entering wrong number");
// } else {
// float average = (m + c + p) / 3f;
// System.out.println("average is" + average);
//
// if (m < 33 || p < 33 || c < 33 || average < 40) {
// System.out.println("Sorry You are fail!");
// } else {
// System.out.println("Hurreh You are pass!!!");
// }
// }
// }
// }
// Question3
// Scanner sc= new Scanner(System.in);
// System.out.println("Enter the amount in lacs");
// float amount= sc.nextFloat();
// float tax=0;
// System.out.println("The amount is "+ amount+" lacs");
// if(amount <2.5){
// System.out.println("Khush ho jayie no tax!!");
// }
// else if(2.5<=amount && amount<5) {
// tax=tax+0.05f*(amount-2.5f);
//
// }else if(5.0<=amount && amount<10.0){
// tax= tax+ 0.05f*2.5f;
// tax=tax+0.2f*(amount-5.0f);
// }
// else if(10<=amount){
// tax= tax+ 0.05f*2.5f;
// tax= tax+ 0.2f*5.0f;
// tax=tax+ 0.3f*(amount-10.0f);
// }
//
// System.out.println("The tax amount is "+tax+ " lacs");
// Question4
// Scanner sc= new Scanner(System.in);
// System.out.println("Enter the number");
// int n= sc.nextInt();
// if (n==0 || n>7){
// System.out.println("Bete aisa koi din nahi hota");
// }
// else if( n!=0){
// switch(n){
// case 1:
// System.out.println("Monday");
// break;
// case 2:
// System.out.println("Tuesday");
// break;
// case 3:
// System.out.println("wednesday");
// break;
// case 4:
// System.out.println("Thursday");
// break;
// case 5:
// System.out.println(" Friday");
// break;
// case 6:
// System.out.println("Saturday");
// break;
// case 7:
// System.out.println("Sunday");
// }
// }
/* Question5 */
Scanner sc= new Scanner (System.in);
System.out.println("Enter the year");
int year= sc.nextInt();
float a= year%4.0f;
float b= year%100.0f;
if(a==0.0 && (b!=0.0 || year%400==0)){
System.out.println("Leap year!");
}
else{
System.out.println("Not a leap year");
}
// Question 6
// Scanner sc= new Scanner ( System.in);
// System.out.println("Enter the site name");
// String str= sc.nextLine();
//
// if(str.endsWith(".com") || str.endsWith(".COM")){
// System.out.println("Commercial Websites");
// }
// else if( str.endsWith(".org") || str.endsWith(".ORG")){
// System.out.println("Organisation Website");
//
// }
// else if(str.endsWith(".in") || str.endsWith(".IN")){
// System.out.println("indian website");
// }
}
}
Comments
Post a Comment