This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections; | |
using System.Collections.Specialized; | |
using System.IO; | |
using System.Collections.Generic; | |
using System.Text; | |
namespace Student_nagruzka | |
{ | |
public abstract class FileHanlder |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Product | |
attr_accessor :name, :sku, :price, :regular_price, :promoname | |
def initialize(name, sku, price, regular_price, promoname) | |
@name = name | |
@sku = sku | |
@price = price | |
@regular_price = regular_price | |
@promoname = promoname | |
@stock = stock | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class EducationGarfieldParser < Scripting::CustomParser | |
@@document | |
@@base_prod | |
@@ctx | |
# def initialize | |
# | |
# end | |
def parse(ctx) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#it's not very good to do that... | |
class String | |
def palindrome? | |
self == self.reverse | |
end | |
end | |
input = gets.chomp | |
puts input.palindrome? ? true : false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def find_words_number(string) | |
string.split.size | |
end | |
puts "Enter Your string:" | |
string = gets.chomp | |
puts "Words Number ---> #{find_words_number(string)}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
array_of_words = ["Words", "Sobaka", "Paralelogram", "Polundrom", "Yes", "No"] | |
puts array_of_words.sort_by { |word| word.length} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def make_output(array) | |
50.times { print "-" } | |
puts | |
puts array.join(" - ") | |
puts "" | |
end | |
def generate_array(size) | |
array = [] | |
size.to_i.times { array << rand(10..30) } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
array = [] | |
rand(20..30).times { array << rand(0..40)} | |
puts "Original array #{ array.join(" ") }" | |
puts "Result array #{ array.sort.join(" ") }" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def generate_array(size) | |
array = [] | |
size.to_i.times { array << rand(-10..20) } | |
array | |
end | |
#have some questions accroding to this task (probably, it can be done with 'each'?!) | |
def insert_zeros_to_array(array) | |
i = 0 | |
while(i < array.size) do | |
if array[i] > 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def make_output(array) | |
40.times { print "-"} | |
puts "\n#{array.join(", ")}" | |
end | |
def generate_array | |
array = [] | |
rand(10..20).times { array << rand(-10..10)} | |
array | |
end |
NewerOlder