Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions Icon

Related questions

Question

C#(Sharp): I made my code and design below. Anybody can help me some correction and add some design button and code. "Need to make C# step by step design and code "Calculator where make a calculator program that can do add, subtract, multiply, divide and square root. It should have a memory save/restore function for one number. There should be a way to set the number of fraction digits displayed".

  • Code:

  • 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 AktCalc

    {

    public partial class Form1 : Form

    {

    string last = "";

    bool minus = false;

    bool plus = false;

    bool divide = false;

    bool multiply = false;

    string memory = "";

    public Form1()

    {

    InitializeComponent();

    }

    private void button2_Click(object sender, EventArgs e)

    {

  • if (textBox1.Text.Contains(","))

    {

    return;

    }

    else

    {

    textBox1.Text += ",";

    }

    }

    private void button21_Click(object sender, EventArgs e)

    {

    last = textBox1.Text;

    multiply = true;

    }

    private void button3_Click(object sender, EventArgs e)

    {

    last = textBox1.Text;

    plus = true;

    }

    private void button5_Click(object sender, EventArgs e)

    {

    last = textBox1.Text;

    divide = true;

    }

  • private void button4_Click(object sender, EventArgs e)

    {

    last = textBox1.Text;

    minus = true;

    }

    // Equalls =

    private void button6_Click(object sender, EventArgs e)

    {

    if (minus)

    {

    decimal equals1;

    equals1 = Convert.ToDecimal(last) - Convert.ToDecimal(textBox1.Text);

    textBox1.Text = Convert.ToString(equals1);

    }

    if (plus)

    {

    decimal equals1;

    equals1 = Convert.ToDecimal(last) + Convert.ToDecimal(textBox1.Text);

    textBox1.Text = Convert.ToString(equals1);

    }

    if (divide)

    {

    decimal equals1;

  • equals1 = Convert.ToDecimal(last) / Convert.ToDecimal(textBox1.Text);

    textBox1.Text = Convert.ToString(equals1);

    }

    if (multiply)

    {

    decimal equals1;

    equals1 = Convert.ToDecimal(last) * Convert.ToDecimal(textBox1.Text);

    textBox1.Text = Convert.ToString(equals1);

    }

    }

    private void button16_Click(object sender, EventArgs e)

    {

    textBox1.Text = Convert.ToString(Math.Sqrt(Convert.ToDouble(textBox1.Text)));

    }

    private void button1_Click(object sender, EventArgs e)

    {

    memory = textBox1.Text;

    label1.Text = "M";

    }

    private void button10_Click(object sender, EventArgs e)

    {

    memory = "";

    label1.Text = "";

    }

  • private void button15_Click(object sender, EventArgs e)

    {

    textBox1.Text = memory;

    }

    private void button11_Click(object sender, EventArgs e)

    {

    textBox1.Text = "";

    multiply = false;

    plus = false;

    minus = false;

    divide = false;

    }

    private void button20_Click(object sender, EventArgs e)

    {

    textBox1.Text += "0";

    }

    private void button19_Click(object sender, EventArgs e)

    {

    textBox1.Text += "1";

    }

    private void button18_Click(object sender, EventArgs e)

    {

  • textBox1.Text += "2";

    }

    private void button17_Click(object sender, EventArgs e)

    {

    textBox1.Text += "3";

    }

    private void button14_Click(object sender, EventArgs e)

    {

    textBox1.Text += "4";

    }

    private void button13_Click(object sender, EventArgs e)

    {

    textBox1.Text += "5";

    }

    private void button12_Click(object sender, EventArgs e)

    {

    textBox1.Text += "6";

    }

    private void button9_Click(object sender, EventArgs e)

    {

    textBox1.Text += "7";

    }

  • private void button8_Click(object sender, EventArgs e)

    {

    textBox1.Text += "8";

    }

    }

    }

expand button
Expert Solution
Check Mark
Knowledge Booster
Background pattern image
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
    Recommended textbooks for you
    Text book image
    Database System Concepts
    Computer Science
    ISBN:9780078022159
    Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
    Publisher:McGraw-Hill Education
    Text book image
    Starting Out with Python (4th Edition)
    Computer Science
    ISBN:9780134444321
    Author:Tony Gaddis
    Publisher:PEARSON
    Text book image
    Digital Fundamentals (11th Edition)
    Computer Science
    ISBN:9780132737968
    Author:Thomas L. Floyd
    Publisher:PEARSON
    Text book image
    C How to Program (8th Edition)
    Computer Science
    ISBN:9780133976892
    Author:Paul J. Deitel, Harvey Deitel
    Publisher:PEARSON
    Text book image
    Database Systems: Design, Implementation, & Manag...
    Computer Science
    ISBN:9781337627900
    Author:Carlos Coronel, Steven Morris
    Publisher:Cengage Learning
    Text book image
    Programmable Logic Controllers
    Computer Science
    ISBN:9780073373843
    Author:Frank D. Petruzella
    Publisher:McGraw-Hill Education