add Programmyday form github
This commit is contained in:
38
E-Book/EBook.cs
Normal file
38
E-Book/EBook.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace E_Book
|
||||
{
|
||||
internal class EBook
|
||||
{
|
||||
private string? author;
|
||||
private string? publishingYear;
|
||||
private MediaAssets[] media;
|
||||
private decimal totalPageCount;
|
||||
|
||||
public EBook(int number)
|
||||
{
|
||||
media = new MediaAssets[number];
|
||||
}
|
||||
public bool AddMediaAsset(MediaAssets pageCount)
|
||||
{
|
||||
for (int i = 0; i < media.Length; i++)
|
||||
{
|
||||
if (media[i] is null)
|
||||
{
|
||||
media[i] = pageCount;
|
||||
totalPageCount += media[i].GetPageCount();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public void PrintInof()
|
||||
{
|
||||
Console.WriteLine($"Das Buch hat {totalPageCount} Seiten,");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user