Java Examples In A Nutshell (3rd Edition) [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Java Examples In A Nutshell (3rd Edition) [Electronic resources] - نسخه متنی

O'Reilly Media, Inc

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید










1.16 Exercises


Exercise 1-1. Write a program that counts from 1 to 15, printing out each number,
and then counts backward by twos back to 1, again printing out each
number.

Exercise 1-2. Each term of the Fibonacci series is formed by adding the previous
two terms. What sort of series do you get if you add the previous
three terms? Write a program to print the first 20 terms of this
series.

Exercise 1-3. Write a program that takes two numbers and a string as command-line
arguments and prints out the substring of the string specified by the
two numbers. For example:

% java Substring hello 1 3

should print out:

ell

Handle all possible exceptions that might arise because of bad input.

Exercise 1-4. Write a program that interactively reads lines of input from the user
and prints them back out, reversed. The program should exit if the
user types "tiuq".

Exercise 1-5. The SortNumbers class shows how you can sort an
array of doubles. Write a program that uses this class to sort an
array of 100 floating-point numbers. Then, interactively prompt the
user for numeric input, and display the next larger and next smaller
number from the array. You should use an efficient binary search
algorithm to find the desired position in the sorted array.



/ 285