Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

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: 3 2 9 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: 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) [4 marks] 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 gland g2 using value constructor with arguments (parameters), and print their ids. e. Also, in the main method, create a third Gym Member object g3 using the default constructor f. Call a method Check JoiningDate() 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

3.52 Rating (149 Votes )

There are 3 Steps involved in it

Step: 1

1 b Now lets go through the code tracing process Import Statements import javautilScanner Here we im... 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

Income Tax Fundamentals 2013

Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill

31st Edition

1111972516, 978-1285586618, 1285586611, 978-1285613109, 978-1111972516

More Books

Students also viewed these Programming questions

Question

24. What is your recommendation to the Springfield Noreasters?

Answered: 1 week ago

Question

discuss the use of exercise as an adjunct to therapy.

Answered: 1 week ago