Home /
Expert Answers /
Computer Science /
3-write-a-java-program-the-design-the-following-calss-4-marks-build-a-class-gvmmember-that-has-pa726
(Solved):
3. Write a Java program the design the following calss: [4 marks] Build a class GvmMember that has ...
3. Write a Java program the design the following calss: [4 marks] Build a class GvmMember that has the following: a. Attributes: name (String), ID(int), JoiningDate (Date class). Use this for date type: Date JoiningDate = new Date(int year, int month, int date) Refer to this site for details on how to use Date class in Java: https://www.geeksforgeeks.org/date-class-java-examples/ b. Build a constructor that accepts three parameter name, ID, and Joining date. Then initialize the objects' attributes. c. Build a default constructor with empty body and no parameters. d. In the main method, create two GvmMember objects g1 and g2 using value constructor with arguments (parameters); and print their ids. e. Also, in the main method, create a third GvmMember object g3 using the default constructor. f. Call a method CheckJoiningDate() on this object g3. g. Print the result of CheckJoiningDate() method. h. In the GvmMember class, build a method named CheckJoiningDate() that has no parameters. The method checks the joining date of this object \( \mathrm{g} 3 \), and if the joining year 2019 or before; prints the following: "Congratulations, you've earned a free membership next month \( (-) \) "
a. Write a complete Java program that prints digits of a given number separately. [2 mark] For example, if the given input 329 , the output would be: \[ \begin{array}{l} 3 \\ 2 \\ 9 \end{array} \] b. You must Show the details of Tracing the code above that you followed to get the answer. [1 marks] 2. Wrapper Class: Write a complete Java program as follows: a. Create two boolean variables ( \( \mathrm{a} \) and \( \mathrm{b} \) ) and give them values. \( \quad \) [1 mark] b. Compare the two variables created above using compare() method that takes two boolean values in the parameter which are to be compared. [1 mark] c. What are possible outputs emerged from the compare() method above? Explain all the cases [1 mark]