Question: using java brograming do these. 1. Write a class definition for Date, an object type that contains three integers, year, month and day. This class
using java brograming do these.
1. Write a class definition for Date, an object type that contains three integers, year, month and day. This class should provide two constructors. The first should take no parameters (default constructor) which initialises todays date. The second should take parameters named year, month and day (all variables as integer type) and use them to initialize the instance variables.
Write a main method that creates a new Date object named current date which gives todays date and another object named birthday, the second object should contain your birthdate. If both dates are same print Today is your birthday, else print Somebodys Birthday with you day and Month of Birthday. (10 points)
Sample output if same day and month: 10 October - Today is your birthday
Sample output if different day and month: 10 October - Somebodys Birthday
Output in correct format (5 points)
Test the class using different dates give the tests as comments.
Submit the debug window screen shots also as image file or word doc.
2. Given four objects, complete the code to check if the Integer objects and String objects are equal ,display the results ,Explain each output using comments. (10 points)
public class WrapperDemo {
public static void main (String args[]){
Integer intObj1 = new Integer (25);
Integer intObj2= new Integer (25);
String S=new String(cs1050);
String S=new String(cs1050);
-------------------------------------------------------
}
}
in java programig
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
