Arvutiteaduse instituut
  1. Kursused
  2. 2019/20 kevad
  3. Objektorienteeritud programmeerimine (Narva Kolledž) (LTAT.NR.003)
EN
Logi sisse

Objektorienteeritud programmeerimine (Narva Kolledž) 2019/20 kevad

  • Home
  • Materials
  • Grading
  • Java Glossary
  • Cheat sheet (S1-S6)
  • Source Example
  • Links
Chapter 1

Tasks for the first chapter

  • Read the course description. Pay attention to the:
    • course objectives
    • rules and requirements
    • grading system
  • Study the materials of Chapter 1 (all parts).
  • Install JDK 13 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.

Make sure your programs are correct and clean, and submit them in Moodle.

Chapter 1
  • Arvutiteaduse instituut
  • Loodus- ja täppisteaduste valdkond
  • Tartu Ülikool
Tehniliste probleemide või küsimuste korral kirjuta:

Kursuse sisu ja korralduslike küsimustega pöörduge kursuse korraldajate poole.
Õppematerjalide varalised autoriõigused kuuluvad Tartu Ülikoolile. Õppematerjalide kasutamine on lubatud autoriõiguse seaduses ettenähtud teose vaba kasutamise eesmärkidel ja tingimustel. Õppematerjalide kasutamisel on kasutaja kohustatud viitama õppematerjalide autorile.
Õppematerjalide kasutamine muudel eesmärkidel on lubatud ainult Tartu Ülikooli eelneval kirjalikul nõusolekul.
Courses’i keskkonna kasutustingimused