Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace ConsoleApplication1
- {
- class Program
- {
- static void Main(string[] args)
- {
- }
- }
- class Files
- {
- private File generetedFile;
- private File file1;
- private File file2;
- public Files(File file1, File file2)
- {
- this.file1 = file1;
- this.file2 = file2;
- if (file1.Suffix == file2.Suffix)
- {
- Console.WriteLine("Enter file name:");
- string fileName = Console.ReadLine();
- file1.Open = true;
- file2.Open = true;
- generetedFile = new File(fileName, file1.Suffix, file1.SizeInMbs + file2.SizeInMbs, DateTime.Now, file1.Contents + file2.Contents, true);
- file1.Open = false;
- file2.Open = false;
- }
- else
- {
- Console.WriteLine("Files don't share the same sufficx");
- }
- }
- }
- class File
- {
- private string fileName;
- private string suffix;
- private double sizeInMbs;
- private DateTime dateOfCreation;
- private string contents;
- private bool open;
- public File(string fileName, string suffix, double sizeInMbs, DateTime dateOfCreation, string contents, bool open)
- {
- this.fileName = fileName;
- this.suffix = suffix;
- this.sizeInMbs = sizeInMbs;
- this.dateOfCreation = dateOfCreation;
- this.contents = contents;
- this.open = open;
- }
- public bool compare(string suffix)
- {
- return this.suffix == suffix;
- }
- public string toString()
- {
- return "File name = " + this.FileName + suffix + "Size = " + sizeInMbs +
- "Date of creation = " + dateOfCreation + "is open:" + open + "contents = " + contents;
- }
- public string FileName
- {
- get { return fileName; }
- set { fileName = value; }
- }
- public string Suffix // property
- {
- get { return suffix; } // get method
- set { suffix = value; } // set method
- }
- public double SizeInMbs
- {
- get { return sizeInMbs; }
- set { sizeInMbs = value; }
- }
- public DateTime DateOfCreation
- {
- get { return dateOfCreation; }
- set { dateOfCreation = value; }
- }
- public string Contents
- {
- get { return contents; }
- set { contents = value; }
- }
- public bool Open
- {
- get { return open; }
- set { open = value; }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement