Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Recursion a. Write a complete Java program that prints digits of a given number separately. [2 mark] For example, if the given input 329

image text in transcribed

1. Recursion 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: 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. In the main method, create two GymMember objects g1and g2 using value constructor with arguments (parameters); and print their ids. e. Also, in the main method, create a third GymMember 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 GymMember 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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database And Expert Systems Applications Dexa 2022 Workshops 33rd International Conference Dexa 2022 Vienna Austria August 22 24 2022 In Computer And Information Science 33

Authors: Gabriele Kotsis ,A Min Tjoa ,Ismail Khalil ,Bernhard Moser ,Alfred Taudes ,Atif Mashkoor ,Johannes Sametinger ,Jorge Martinez-Gil ,Florian Sobieczky ,Lukas Fischer ,Rudolf Ramler ,Maqbool Khan ,Gerald Czech

1st Edition

3031143426, 978-3031143427

More Books

Students also viewed these Databases questions

Question

What steps should be taken to address any undesirable phenomena?

Answered: 1 week ago