Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1. Recursion a. Write a complete Java program that prints digits of a given number separately using recursion method. [2 mark] For example, if the
1. Recursion a. Write a complete Java program that prints digits of a given number separately using recursion method. [2 mark] For example, if the given input 329 , the output would be: 329 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 (a and b) and give them values. [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] 3. Write a Java program the design the following calss: [4 marks] Build a class GymMember 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. Build a setter method (setDate) to change the value of JoiningDate attribute. e. In the main method, create two GymMember objects g1 and g2 using value constructor with arguments (parameters); and print their ids. f. Also, in the main method, create a third GymMember object g3 using the default constructor. g. Use setter method setDate, to change the value of JoiningDate of object g3. h. Call a method CheckJoiningDate() on this object g3. i. Print the result of CheckJoiningDate() method. j. In the GvmMember class, build a method named CheckJoiningDate() that has no parameters. The method checks the joining date of this object g3, and if the joining year 2019 or before; prints the following: "Congratulations, you've earned a free membership next month (-)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started