Institute of Computer Science
  1. Courses
  2. 2018/19 spring
  3. Object-Oriented Programming (Narva College) (LTAT.NR.003)
ET
Log in

Object-Oriented Programming (Narva College) 2018/19 spring

  • Home
  • Materials
  • Java Glossary
  • Source Example
  • Cheat sheet (S1-S6)
  • Grading
  • Links
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 value 2147483647. 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 
  • Institute of Computer Science
  • Faculty of Science and Technology
  • University of Tartu
In case of technical problems or questions write to:

Contact the course organizers with the organizational and course content questions.
The proprietary copyrights of educational materials belong to the University of Tartu. The use of educational materials is permitted for the purposes and under the conditions provided for in the copyright law for the free use of a work. When using educational materials, the user is obligated to give credit to the author of the educational materials.
The use of educational materials for other purposes is allowed only with the prior written consent of the University of Tartu.
Terms of use for the Courses environment