неділя, 18 січня 2015 р.

About xml

Extensible Markup Language, скорочено XML

How to read/write data in text file

1. reading text file

How to extract data from the Data Table

1. Suppose we have database: (how to create table you can see here)

How to create table and add data to the DB

1. Download MySQL Community Server Installer (see post)
2. Download MySQL Workbench
3. Connect to database

понеділок, 12 січня 2015 р.

Java task OOP: test animal sounds

Create Console Application project AnimalSounds in VS.
  a)Add interface ISound with method Sound() to the project
    Add class Cat with fields: name,color and properties for accessing these fields.
    Class Cat should implement interface ISound - method Sound should write cat-sound ("M'yau")
    Add class Dog with similar members as Cat class.
  b) In the method Main() create array of ISound type and fill it with Cats and Dogs objects.
     Output the sound of this array in for each loop by calling method Sound for each element;
  

субота, 10 січня 2015 р.

Java task OOP: make different actions on object Worker

 A) Create Console Application project WorkerPerson in VS.
 Add class Person with code from the previous task to the project.
 Add new class Worker, which inherits class Person.
 Class Worker should consist next members:
 a) fields: workplace and salary.
 b) two properties for access to these fields
 c) constructor for initialisation of all fields (remember about fields in the base class)
 d) method OutPut() for writing all fields into Console
 e) method SalaryIncrease() for increasing salary by formula salary=salary+Age

 In the method Main() create array of Workers and fill it with data from Console by calling appropriate constructor.
 Output all Workers with Age more then 20 years.
 Increase salary for workers, whose salary is more then 200.Output result.
 Sort array of Workers by name (for this task class Worker should implement interface IComparable). Output result.

Java task OOP: calculate the age of person

 Add class Person to the project.
 Class Person should consists of
 a) two fields: name and birthDate.
 b) two properties for access to these fields
 c) constructor for initialisation of these fields
 d) method Age(), which may calculate the age of person
 In the method Main() create 2 objects of Person type: p1 and p2;
 Change name and birthDate these persons by properties.
 Output ages (by colling method Age()) of these persons.

Java task: input number (1-7) - the day of week and output the name of this day

Java task: input number (1-7) - the day of week and output the name of this day

Java task: input 9 numbers and calculate how many of them are negative

Java task: input 9 numbers and calculate how many of them are negative

Типи

Прості типи в java не є об'єктно-орієнтованими. В java є 8 простих типів: byte, short, int, long, char, float, double і boolean.