Assignment02 Opt1
Assignment02 Opt1
T ra in in g As s ig nmen t
Version 1.1
Hanoi, 05/2020
Training Assignments Java Basics (Automation Test) Issue/Revision: x/y
RECORD OF CHANGES
Contents
Java Flow Control ...............................................................................................................................................4
Objective .........................................................................................................................................................4
Business needs ..............................................................................................................................................4
Working requirements ....................................................................................................................................4
Product architecture .......................................................................................................................................4
Technologies ..................................................................................................................................................4
Stored Data ....................................................................................................................................................4
Exercise 1: ......................................................................................................................................................5
Exercise 2: ......................................................................................................................................................5
Exercise 3: ......................................................................................................................................................5
Exercise 4: ......................................................................................................................................................5
Exercise 5: ......................................................................................................................................................6
CODE: Assignment01_Opt1
TYPE: Long
LOC: N/A
DURATION: 90 MINUTES
Business needs
- TBD
Working requirements
- Working environment: Eclipse IDE.
- Delivery: Source code, deployment and testing, reviewing evident packaged in a compress archive.
Product architecture
- N/A
Technologies
The product implements one or more technology:
- Java basics
- Java flow control
Stored Data
- N/A
Exercise 1:
Write a Java program that reads a floating-point number and prints "zero" if the number is zero. Otherwise,
print "positive" or "negative". Add "small" if the absolute value of the number is less than 1, or "large" if it
exceeds 1,000,000.
Test Data
Input a number: 25
Expected Output :
Input value: 25
Positive number
Exercise 2:
Write a program in Java to display the cube of the number upto given an integer.
Test Data
Input number of terms : 4
Expected Output :
Exercise 3:
Write a program in Java to make such a pattern like right angle triangle with a number which will repeat a
number in a row.The pattern is as follows :
1
22
333
4444
Exercise 4:
Write a program to print out all Armstrong numbers between 1 and 500. If sum of cubes of each digit of the
number is equal to the number itself, then the number is called an Armstrong number.
For example, 153 = ( 1 * 1 * 1 ) + ( 5 * 5 * 5 ) + ( 3 * 3 * 3 )
Exercise 5:
Compute the natural logarithm of 2, by adding up to n terms in the series
1 - 1/2 + 1/3 - 1/4 + 1/5 -... 1/n
where n is a positive integer and input by user.
-- THE END --