Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //program.cs
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApplication1
- {
- class Program
- {
- static double Memuza(Song song1, Song song2)
- {
- return (double)(song1.GetLength() + song2.GetLength()) / 2;
- }
- static void Main(string[] args)
- {
- Song song1 = new Song(int.Parse(Console.ReadLine()), int.Parse(Console.ReadLine()));
- Song song2 = new Song(int.Parse(Console.ReadLine()), int.Parse(Console.ReadLine()));
- Console.WriteLine(Memuza(song1, song2));
- song2.SetLength(song1.GetLength()/2);
- Console.WriteLine(Memuza(song1, song2));
- }
- }
- }
- //song.cs
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApplication1
- {
- class Song
- {
- private int length, siduri;
- public Song(int length, int siduri)
- {
- this.length = length;
- this.siduri = siduri;
- }
- public int GetLength()
- {
- return this.length;
- }
- public int GetSiduri()
- {
- return this.siduri;
- }
- public void SetLength(int length)
- {
- this.length = length;
- }
- public void SetSiduri(int siduri)
- {
- this.siduri = siduri;
- }
- public string ToString()
- {
- return "length is " + this.length + ", siduri is " + this.siduri;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement