🌙 DARK

Wrapper Class Java Program

 

Equals & == in String
 

 
Write a program to validating the Email ids of two customers by using equals & equalsIgnoreCase methods.
 
Consider class Customer with the following private attributes.
Data TypeVariable Name
Stringname
Stringemail
Include appropriate getters and setters.
Prototype for the Parameterized Constructor, public Customer(String name, String email)
Use 'equals()' and 'equalsIgnoreCase()' to compare the email ids[Refer sample input & output ].

Consider the main class "Main.java".


The link to download the template code is given below
Code Template

 
Input and Output Format:
 
Refer sample input and output for formatting specifications. 
 
[All text in bold corresponds to input and the rest corresponds to output] 

Sample Input / Output 1:

Enter First Customer Details :
Enter Customer Name :
Roger
Enter Customer Email :
abc@xyz.com
Enter Second Customer Details :
Enter Customer Name :
Lee
Enter Customer Email :
abc@xYz.com
The Email ids of Roger and Lee are not equal
Comparing without considering the cases :
The Email ids of Roger and Lee are Equal

Sample Input / Output 2:
 
Enter First Customer Details :
Enter Customer Name :
Roger
Enter Customer Email :
abc@xyz.com
Enter Second Customer Details :
Enter Customer Name :
Lee
Enter Customer Email :
abc@abc.com
The Email ids of Roger and Lee are not equal
Comparing without considering the cases :
The Email ids of Roger and Lee are not equal



Problem Requirements:

Java

KeywordMin CountMax Count
equals1-
KeywordMin CountMax Count
equalsIgnoreCase1-
@MRProgrammer89 


CREATE CLASS < Customer :


public class Customer {

    private String name,email;

public Customer(String name, String email) {

this.name=name;

this.email=email;

}

public String getName() {

return name;

}

public void setName(String name) {

this.name = name;

}

public String getEmail() {

return email;

}

public void setEmail(String email) {

this.email = email;

}

}


@MRProgrammer89 


CREATE CLASS < Main :

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc=new Scanner(System.in);

    System.out.println("Enter First Customer Details :");

System.out.println("Enter Customer Name :");

String cus1 = sc.nextLine();

System.out.println("Enter Customer Email :");

String email1 = sc.nextLine();

System.out.println("Enter Second Customer Details :");

System.out.println("Enter Customer Name :");

String cus2 = sc.nextLine();

System.out.println("Enter Customer Email :");

String email2 = sc.nextLine();

Customer jp = new Customer(email1, email2);

if(email1.equals(email2)) {

System.out.println("The Email ids of "+cus1+" and "+cus2+" are equal");

}

else {

System.out.println("The Email ids of "+cus1+" and "+cus2+" are not equal");

}

System.out.println("Comparing without considering the cases :");

if(email1.equalsIgnoreCase(email2)) {

System.out.println("The Email ids of "+cus1+" and "+cus2+" are Equal");

}

else {

System.out.println("The Email ids of "+cus1+" and "+cus2+" are not equal");

}

}

}




Date 

 

Rex figured out that the binary forms of the date, month, and year were 2 bits, 2 bits, and 2 bits rotated left in his LED board. Write a program to change the incorrect date, month, and year. use the Integer Wrapper Class rotateRight() method to print the correct date in International format.

The date format to be displayed in the output is (yyyy-mm-dd).

 

Input Format:


The first line is an integer that corresponds to the incorrect day number.
The second line is an integer that corresponds to the incorrect month number.
The third line is an integer that corresponds to the incorrect year.

 

Output Format:


The Output should display the correct date in a single line separated by slashes in the international format.

 

Sample Input:


20
36
7944


Sample Output:


1986/9/5


@MRProgrammer89 


CREATE CLASS < Main :

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        int a = sc.nextInt();

        int b = sc.nextInt();

        int c = sc.nextInt();

        

        a = Integer.rotateRight(a, 2);

        b = Integer.rotateRight(b, 2);

        c = Integer.rotateRight(c, 2);

        System.out.println(c+"/"+b+"/"+a);

}

}



@MRProgrammer89 






MOTIVATION :


    “The way we spend our time defines who we are 


Although we may not see each other as often as we’d like, distance is no match for the bond that we share. Thank you for coming to visit. It was fantastic to catch up.


VISITE MORE BLOGS




THANK YOU....😊

Post a Comment

Thanks for reading the blog. We hope it was useful to you and that you learned something new. Will always be writing on new and interesting topics, so you can visit our website to know the latest updates of our blogs. Thank You!

Previous Post Next Post

Contact Form