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 ConsoleApplication8
- {
- class Program
- {
- static void Main(string[] args)
- {
- Console.WriteLine(Scitani1.Secti(20, 30));
- Console.ReadLine();
- }
- }
- class Scitani1
- {
- public static int Secti(int a, int b, int c)
- {
- return a + b;
- }
- public static int secti(int a, int b, int c)
- {
- return a + b + c ;
- }
- }
- //vytvořte třídu pocetznaku
- //vytvořte metodu třídy pocet
- //metoda vrátí pocet zbnaků v parametru, který obsahuje text
- //Přetěžte metodu aby vrátila počet znaků v parametru, který obsahuje desetinné číslo
- class PocetZnaku
- {
- public static int Pocet (string a)
- {
- return a.Length;
- }
- public static int Pocet(double a)
- {
- return Convert.ToString (a).Length;
- }
- }
- //Zadání ve Wordu
- class hodnoty
- {
- double a = 0;
- double b = 0;
- double c = 0;
- public void Nacteni (double a)
- {
- if( a >0) //IF zajistí aby se načetlo pouze kladné číslo
- this.a = a;
- else
- }
- }
- public soucet()
- {
- return a + b + c;
- }
- public double Prumer()
- {
- if (b ==0)
- return a;
- else if (c==0)
- return ( a + b)/2;
- else
- return (a + b + c) /3;
- }
- //Vtvořte třídu MatematOperace
- //Vytvořte metodu pruměr, která vráti průměr ze dvou čísel
- //Vytvořte přetíženou metoru průměr, která vrátí průměrnou délku ze 3 textů.
- //Vytvořte objekt a použíjte vytvořené metody
- class MatmatOperace
- {
- public double pruměr (double a, double b)
- {
- return (a + b) / 2;
- }
- public double pruměr (double a, double b)
- {
- return a;
- }
- public double pruměr (double a, double b, double c)
- {
- return (a + b + c) / 3;
- }
- public double pruměr (string a, string b, string c)
- {
- return (a.Length + b.Length + c.Length) / 3;
- }
- }
- MatematOpeace operace = new matematOperace();
- console
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement