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;
- using System.Threading.Tasks;
- namespace Zadanie1_Lab3
- {
- class Program
- {
- static void Main(string[] args)
- {
- Rect[] tablica = new Rect[3];
- for(int i=0; i < tablica.Length; i++)
- {
- tablica[i] = new Rect();
- }
- Console.WriteLine("Witamy w programie obliczajacym pole i obwod prostokatu, prosze podac nastepujace dane dla trzech prostokatow.");
- Console.WriteLine("Aby przejsc do deklaracji prosokatow prosze wcisnac dowolny klawisz:");
- Console.ReadKey();
- for (int i = 0; i < tablica.Length; i++)
- {
- Console.WriteLine("Prosze podac szerokosc dla prostokatu {0}: ", i + 1);
- double k = double.Parse(Console.ReadLine());
- Console.WriteLine("Prosze podac wysokosc dla prostokatu {0}: ", i + 1);
- double l = double.Parse(Console.ReadLine());
- Console.WriteLine("Prosze podac kolor dla prostokatu {0}: ", i + 1);
- String o = Console.ReadLine();
- tablica[i].setRect(k,l,o);
- }
- Console.WriteLine("Aby kontynuowac i wyswietlic parametry prostokatow prosze wcisnac dowolny klawisz");
- Console.ReadKey();
- for (int i =0; i < tablica.Length; i++)
- {
- Console.WriteLine("Parametry dla prostokatu nr {0}", i + 1);
- tablica[i].showRectParams();
- }
- Console.Write("Prosze wcisnac dowolny klawisz aby przejsc dalej:");
- Console.ReadLine();
- Console.WriteLine("Prosze podac wartosc graniczna pola powierzchni: ");
- double poleGranicz = double.Parse(Console.ReadLine());
- if (tablica[0].getArea() > poleGranicz && tablica[1].getArea() > poleGranicz && tablica[2].getArea() > poleGranicz)
- {
- Console.WriteLine("Zadne pole nie spelnia warunku.");
- }
- else
- {
- for (int i = 0; i < tablica.Length; i++)
- {
- if (tablica[i].getArea() <= poleGranicz)
- {
- Console.WriteLine("Prostokat nr {0} spelnia warunek graniczny majac pole rowne {1}", i + 1, tablica[i].getArea());
- Console.WriteLine("oraz o parametrach: ");
- tablica[i].showRectParams();
- }
- }
- }
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement