Friday, March 4, 2011

Financial Management Pdf I M Pandey

Java exercises and tasks (POS1: 2A, 2C)

classes, objects

Create a class SomeMaths containing a static constant PI and a static method getSquare double (double x) , which provides the square of x .
Create a class further Circle, which simulates a circle. Circle has a radius attribute and the methods getCircumference () , which provides the scope, and getArea () , which calculates the area. The methods should be the constant PI and method getSquare (use) of SomeMaths . A third class
CircleExercise is the main () generate three circles of type Circle and output respectively the radius, perimeter and area.
The UML diagram looks like this:


arrays

Create a class triangular array , which is a private two-dimensional array field contains integer values. This field should be "triangular" and are initialized with the following values:
 a 

1 1 1 2 1 1 3

3 1 1 4 6 4 1 1 5 10 10
5 1
The methods are public and should do the following:
void create (int row, int column) is a new field produce with the given rows and columns (rectangular).
int [] [] GetArray () does not return the field.
int totals [] () is to provide a one-dimensional array with the row totals.
boolean set (int row, int col, int value) will set the value at the given location in the field box and return on success. For invalid indices should be returned false be.

Write a class test triangular array , in the main triangular array of two objects in the method () be created. Make (set as valid and invalid () etc.) to test calls to the right.

streams, strings

Write a class ReadFile which one opens a file specified on the command line and reads in a string. Use StringBuilder read three methods string String read (InputStream FileInputStream) , StringBuffer String read (InputStream FileInputStream) and String (InputStream FileInputStream) and measure the time required by each method to read the file.
from the file to each with read () a sign read. The method read string () depends on each of the character read to a string, the method read StringBuffer () uses a StringBuffer and read StringBuilder () uses a StringBuilder . The character read is then always append to () appended to the StringBuffer or StringBuilder .
Test with different sized files (small, medium, large, very large). They are measuring different times for different methods. Explain the differences!
Use System.currentTimeMillis () (provides long) to get the current time in ms .

Random, Calendar, Command Line, streams

There are test data of the form
 Date From Time To Time From Time To date 
time
...
be generated. With a date the form YYYY-MM-DD and from time-and bis-time the form HH: MM should have . Furthermore, aiming to fulfill the following conditions:

  • Use java.util.Random to get the test data.
  • bis-time should always come from-time (ie later)
  • a row with the date, time and from time to always come up after that period of the previous line (the times are then sorted).
  • between two lines should be no more than 36 hours (up from time to time)
example
 2011-03-04 10:24 2011-03-04 11:33 12:56 10:45 

2011-03-05 12:33 17:23

The program will be run as: java
 CalenderTest [-h] [Start Date] [start time] [file] number 
-h ... This issue and help end
start date ... YYYY-MM-DD (optional)
start time ... HH: MM (Optional)
file ... Output file name (optional)
number ... Number of generated rows is not specified
start date, the day is to be used as start value. If no start time
specified, the current time is to be used as a starting value. These initial values can be seen in the first line of output.
If no file name file is specified, the default output is used. be
The number of rows to be generated must be at least 1!

error messages are output to System.err .

Name the project calendertest ( class-name-calendertest ).

0 comments:

Post a Comment