Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace Calculator
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private void label1_Click(object sender, EventArgs e)
- {
- }
- private void Form1_Load(object sender, EventArgs e)
- {
- }
- private void Multiplication_Click(object sender, EventArgs e)
- {
- //очищение памяти + не нажата ли кнопка??
- }
- private void Division_Click(object sender, EventArgs e)
- {
- }
- }
- public interface IInterfaceCalc
- {
- void Put_A(double a); //запомнить a
- void Clear_A(); //очистить память
- double Multiplication(double b); //умножение
- double Division(double b); //деление
- double Sum(double b); //сумма
- double Subtraction(double b); //вычитание
- double Square(); //квадрат
- double Factorial(); //факториал
- double MemoryShow(); //показать содержимое регистра памяти
- void Memory_Clear(); //стереть содержимое регистра
- }
- public class Calc : IInterfaceCalc
- {
- private double a = 0;
- private double memory = 0;
- public void Put_A(double a)
- {
- this.a = a;
- }
- public void Clear_A()
- {
- a = 0;
- }
- public double Multiplication(double b)
- {
- return a * b;
- }
- public double Division(double b)
- {
- return a / b;
- }
- public double Sum(double b)
- {
- return a + b;
- }
- public double Subtraction(double b)
- {
- return a - b;
- }
- public double Square()
- {
- return Math.Pow(a, 2.0);
- }
- public double Factorial()
- {
- double f = 1;
- for (int i = 1; i <= a; i++)
- {
- f *= (double)i;
- }
- return f;
- }
- public double MemoryShow()
- {
- return memory;
- }
- public void Memory_Clear()
- {
- memory = 0.0;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement