Session 1 |
Task to be completed by Wednesday 13.02
- Read the course description. Pay attention to the:
- course objectives
- rules and requirements
- grading system
- Study the materials Before session 1 (all parts).
- Install JDK 11 and IntelliJ on your computer.
Task 1
Rewrite the following Python program into Java:
print('Hello, World!')
Task 2
Rewrite the following Python program into Java:
fahr = float(input('Enter the temperature in F: ')) cel = round((fahr - 32) * 5/9, 2) print('The temperature in C is:', cel)
Task 3
- Create variables for integers:
a
,b
,c
,d
,f
,e
. - Assign variable
a
value2147483647
. Assign the rest of the variables any integers. - Sum, subtract, multiply, divide variables and find the reminder.
- What is the result if variable
a
is added value 1? Explain the answer in the program comment. - What is the result of the statement
System.out.println(1-0.9);
? Explain the answer in the program comment.
Hint: you can output the result of calculations using the following statement:
System.out.println("Sum of numbers " + b + " and " + c + " is " + (b + c));
What will change if the parenthesis are removed?
Task 4
Create a program which asks the user for his/her name and greets the user by the name.
Hint: use Scanner to ask the user for the name.
Session 1 |