SD2720 Module 3 Working with Methods
Click Link Below To Buy:
Contact Us: 
Hwcoursehelp@gmail.com
 SD2720 Module 3 Working with Methods and Encapsulation Lab 3.1 Creating a Method
 In this lab, you will complete two tasks related to Java methods. The
tasks performed in this lab will help you use method overloading and understand
ambiguous overloading. 
Task 1 
Write a program for swapping
two numbers. In the program: 
Create a method by passing primitive values as parameters for checking the
result. 
Create another method by passing object references as parameters for checking
the result. 
 Identify the difference
between two outputs. 
Task 2 
Write a Java program that
accepts 10 numbers from the user and finds the greatest and smallest numbers
among them. Create two methods, findGreatest() and
findSmallest(), to find the greatest and smallest numbers, respectively.
 Task 3 
Write a Java program that
implements the following methods: 
 getNumbers()to accept two numbers from the user. 
 calculateHCD()to calculate the highest common divisor (HCD) of the
two numbers. Please note that it should be a recursive function. 
 calculateLCM()to calculate the least common multiple (LCM) of the
two numbers. 
Display()to display HCD and LCM.
 Submission Requirements: 
Compress your
Java project folder and responses in a Microsoft Word document into one zipped
folder and submit it to the instructor.
Evaluation Criteria: 
Your submission will be
evaluated against the following criteria using the lab rubric: 
Task 1 
Did you create a method by passing primitive values as parameters? 
Did you create a method by passing object reference values as parameters? 
Did you identify the difference between two outputs? 
 Is the code readable and
documented? 
Task 2 
Did you write a Java program that accepts 10 numbers? 
 Did you use the findGreatest() and findSmallest() methods to
find the greatest and 
smallest
numbers in your code? 
 Is the code readable and
documented? 
Task 3 
Did you write a Java program that contains getNumbers() method
to accept two numbers? 
Did you use the calculateHCD()
and calculateLCM() methods
to calculate the HCD and LCM of two numbers in your code? 
Did you use recursion in the calculateHCD() method? 
Did you use the display()
method to display the HCD and LCM of two
numbers in your code? 
 Is the code readable and
documented? 
 
No comments:
Post a Comment