Assignment01 Opt1
Assignment01 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 Introduction ................................................................................................................................................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
Java Introduction
Objective
- Java Data Types, Java Operators, Java Input and Output, Java Expressions & Blocks.
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
Stored Data
- N/A
Exercise 1:
Write a Java program to print the sum of two numbers.
Test Data:
74 + 36
Expected Output :
110
Exercise 2:
Write a Java program to print the result of the following operations.
Test Data:
a. -5 + 8 * 6
b. (55+9) % 9
c. 20 + -3*5 / 8
d. 5 + 15 / 3 * 2 - 8 % 3
Expected Output :
43
1
19
13
Exercise 3:
Write a Java program to multiply two binary numbers.
Input Data:
Input the first binary number: 10
Input the second binary number: 11
Expected Output
Product of two binary numbers: 110
Exercise 4:
Write a Java program that accepts two integer values from the user and return the larger values. However if
the two values are the same, return 0 and return the smaller value if the two values have the same remainder
when divided by 6.
Sample Output:
Input the first number : 12
Input the second number: 13
Result: 13
Exercise 5:
Write a Java program to takes the user for a distance (in meters) and the time was taken (as three numbers:
hours, minutes, seconds), and display the speed, in meters per second, kilometers per hour and miles per
hour (hint: 1 mile = 1609 meters).
Test Data
Input distance in meters: 2500
Input hour: 5
Input minutes: 56
Input seconds: 23
Expected Output :
Your speed in meters/second is 0.11691531
Your speed in km/h is 0.42089513
Your speed in miles/h is 0.26158804
-- THE END --