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

Objektorienteeritud programmeerimine (Narva Kolledž) 2018/19 kevad

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

Tasks (to be submitted by Sun 17.04 23:55) 1 point

Task 1. Modify example 1

Modify the first example as follows. If the user wants to copy a folder, the program outputs a message (e.g. You want to copy a folder) and finishes its work. If the user wants to copy a file, the program outputs the size of the file and the date when the file was modified.

Task 2.

Create a class called Timetable. One of the class constructors has to take in two arrays - String[] courses and int[] begins. The begins array contains the time of the corresponding courses (Note: the time is converted into minutes, e.g. {10*60+15, 12*60+15}). The method int showBeginning(String course) has to show the time when the course (given as an argument) begins. The class should also have a method called writeIntoFile(String fileName) which saves the courses and the time into the file using DataOutputStream. Finally, add an alternative constructor which takes in only one argument - the file name and reads the data from the file into the arrays.

In the main class, demonstrate the use of the constructors and methods.

Hint: it is more convenient to read from the file if the number of course-time pairs is known in advance.

Task 3.

Create a program which shows statistics on the given word in the given file. Solve the task using class BufferedReader and method readLine.

NB: it is not allowed to use class Scanner.

Session 10 
  • 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