Posts

Showing posts from May, 2015

Student Marks details using single inheritance program in Ruby

#Single Inheritance class Marks   def pass     puts "\nEnter Maths Marks"     mat=gets.to_i     puts "Enter computer Marks"     com=gets.to_i     puts "Enter science Marks"     sci=gets.to_i     puts "\nTotal Marks:", tot=(mat.to_i + com.to_i + sci.to_i), "\n "     if tot < 150       puts "You are passed in second class"     else       puts "You are passed in first class"     end   end end class Student < Marks   def pass     puts "Enter the Rollno"     no=gets.to_i     puts "Enter the Name"     name=gets     puts "Enter the Depatment"     dept=gets     puts "\nRollno: #{ no}"     puts "Name: #{ name}"     puts "Depatment: #{ dept}"     puts "\nHai "+ name +" \nPlease enter Marks"      super   end end obj1=Student.new obj1.pass

Sample Files program in Ruby Programming

Sample Files program in Ruby Programming File.new("input.txt", "w+") File.new("temp.txt", "r+") File.new("output.txt","a+") myfile = File.open("input.txt", "w+") myfile.puts "Hai welcome to files in ruby programming " myfile.close File.zero?("output.txt") puts "open file" check_file = gets.chomp test = open(check_file) puts "The file #{check_file}" puts test.read

Print the numbers on given array using Regular Expressions.

#Print the three digit numbers in given array my_array = [111,45456,456,74897,787,45466,789,6587,784,234,456,4658,4587,235,456] my_reg = [] my_array.each do |k| my_reg << my_array end if my_reg=my_array.select {|n| n.to_s.match(/^\d{3}$/)} puts my_reg end

cbse ugc net computer science papers free download

Hi friends please find below link to download free ugc net computer science papers without cost... Enjoy All the best your exam. Click to download ugc net papers