Question

In: Computer Science

Using C# Windows App Form Create a simple calculator using +,-,*,/ Please show code GUI Code...

Using C# Windows App Form

Create a simple calculator using +,-,*,/

Please show

code

GUI

Code for calculator

menus

radio button

input text boxes

Solutions

Expert Solution

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 Calculator_Simple
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
double num1, num2, ans;
private void rdbAdd_CheckedChanged(object sender, EventArgs e)
{
getNumbers();
txtAns.Text = (num1 + num2).ToString();
}
private void getNumbers()
{
num1 = Convert.ToDouble(txtNum1.Text);
num2 = Convert.ToDouble(txtNum2.Text);
}

private void rdbSub_CheckedChanged(object sender, EventArgs e)
{
getNumbers();
txtAns.Text = (num1 - num2).ToString();
}

private void rdbMul_CheckedChanged(object sender, EventArgs e)
{
getNumbers();
txtAns.Text = (num1 * num2).ToString();
}

private void rdbDiv_CheckedChanged(object sender, EventArgs e)
{
getNumbers();
if (num2 != 0)
{
txtAns.Text = (num1 / num2).ToString();
}
else
{
MessageBox.Show("Denominator can't b 0.");
}

}

}
}

outputs

design

If you have any query regarding the code please ask me in the comment i am here for help you. Please do not direct thumbs down just ask if you have any query. And if you like my work then please appreciates with up vote. Thank You.


Related Solutions

***IN C# ONLY, USING WINDOWS FORMS*** --NO JAVA--. Create a GUI application in C# that calculates...
***IN C# ONLY, USING WINDOWS FORMS*** --NO JAVA--. Create a GUI application in C# that calculates and displays the total travel expenses of a business person on a trip. Here is the information that the user must provide: • Number of days on the trip • Amount of airfare, if any • Amount of car rental fees, if any • Number of miles driven, if a private vehicle was used • Amount of parking fees, if any • Amount of...
Create a windows form application in C# that looks and functions like a basic calculator. It...
Create a windows form application in C# that looks and functions like a basic calculator. It must do the following: Add, subtract, multiply, and divide. Account for division by zero. Show at least two decimal places. Retain the last number on the window so that, when the user opens the calculator the next time, the number that was in the window at the last close appears. Have a memory, so that users can store values and recall them. Operate with...
C# Programming Discuss how to build a Multi-Form Windows application in C#. That is an App...
C# Programming Discuss how to build a Multi-Form Windows application in C#. That is an App that has more than one form, like say maybe 5 forms. How do you connect these forms and pass data objects between these forms?
Create an ASP.Net Website using Visual Studio with C#: Create a simple calculator that has 3...
Create an ASP.Net Website using Visual Studio with C#: Create a simple calculator that has 3 text boxes: 2 of them to enter numbers, the 3rd one displays the results Create 4 buttons to add, subtract, multiply, and divide Prevent the user from entering text in the number fields Display a message indicating “cannot divide by” when the user click “/” and there is a zero the in the second box Create two additional buttons: - One to store data...
In c# I need to create a simple payroll management system using visual basic and GUI....
In c# I need to create a simple payroll management system using visual basic and GUI. I also need to connect to SQL database. It needs a log in screen, inside the login screen it needs another screen to enter or edit employee information. It needs somewhere to enter hours worked for that specific employee, and another screen that can access reports.
I need this code in C++ form using visual studios please: Create a class that simulates...
I need this code in C++ form using visual studios please: Create a class that simulates an alarm clock. In this class you should: •       Store time in hours, minutes, and seconds. Note if time is AM or PM. (Hint: You should have separate private members for the alarm and the clock. Do not forget to have a character variable representing AM or PM.) •       Initialize the clock to a specified time. •       Allow the clock to increment to the...
Simple Painting GUI Apps You are just developing the GUI app. Your mission in this exercise...
Simple Painting GUI Apps You are just developing the GUI app. Your mission in this exercise is to implement a very simple Java painting application. Rapid Prototyping The JFrame is an example that can support the following functions: * Draw curves, specified by a mouse drag. * Draw filled rectangles or ovals, specified by a mouse drag (don't worry about dynamically drawing the shape during the drag - just draw the final shape indicated). * Shape selection (line, rectangle or...
I need the c# code for the below assignment. Complete PigLatin program in Windows Forms GUI....
I need the c# code for the below assignment. Complete PigLatin program in Windows Forms GUI. Zip the solution project file and attach to this submission. Do this in the GUI format (Windows Form). Be sure and add a Clear Button to reset for entering another word or words. PigLatinGUI Basic Steps in Creating your Program Create your user interface (GUI). Use different font styles but don’t overdo it, Use colors, and Use graphics (You can find all kinds of...
Code, pls. Thank you. Exercise - MPG Calculator Create a Windows Forms application and call it...
Code, pls. Thank you. Exercise - MPG Calculator Create a Windows Forms application and call it MPGCalculator Build a form that looks like the form in the video provided. The form consists of 4 labels, 2 textboxes and 3 buttons Name all controls properly. Certain labels do not have to be named Pay attention to video and set all design time properties accordingly. The "x" should be a hot key for the exit button When Calculate is clicked, you should...
Create a Windows application in C# that can be used to change the form color. Your...
Create a Windows application in C# that can be used to change the form color. Your form background color should initially be blue. Provide at least two buttons with two different color choices and a Reset option. Change the font style and size on buttons. Align the buttons so that they are in the center of the form. The color choice buttons should be the same size. Add event handlers for the buttons so that when the user click the...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT