Question

Need help with C# Create the user interface: Button, two Labels on the main window and...

Need help with C#
Create the user interface: Button, two Labels on the main window and TextBox

Calculate square roots, not using Math.Sqrt or any square root method (or math library).

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Program :

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 SquareRootDemo
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void btn_squareRoot_Click(object sender, EventArgs e)
{
  
int no;
double k=0, sq;
no = Convert.ToInt32(txtNumber.Text);
sq = no / 2;
while (sq!=k)
{
k = sq;
sq = (no / k + k) / 2;
}
lbl_Answer.Text = "Square root of " + no + " is " + sq;
}
}
}

Output:

Add a comment
Know the answer?
Add Answer to:
Need help with C# Create the user interface: Button, two Labels on the main window and...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Create a C# Form with a textbox and a button. The box is for a user...

    Create a C# Form with a textbox and a button. The box is for a user to enter a number of seconds. And when the user clicks the button, the program displays the equivalent number of hours, minutes and seconds using a MessageBox. Show method. If the seconds entered is less than 60, your program should only display the seconds; if the seconds is a least 60 and less than 3600, your program should display minutes and seconds; if the...

  • Using C#: Create a Form that consists of 3 radio buttons, two textboxes, a label and...

    Using C#: Create a Form that consists of 3 radio buttons, two textboxes, a label and a button. The three radio buttons should represent the names of three fonts, e.g. “Arial”, “Calibri” and “Times New Roman”. In the one textbox, a user should type a message and in the other textbox, the user should type a size. When the user clicks the button, the label should be updated with the text the user typed in the one textbox, using the...

  • help with C++ please Substituting these formulas, the Newton-Raphson update rule for computing the n' root...

    help with C++ please Substituting these formulas, the Newton-Raphson update rule for computing the n' root of any value K is: 2+1 = - na"-T Write a program that includes a user-defined function named root that will calculate and return the nth root of any value using the Newton-Raphson method described above: double rootN(double x, int n); The function takes two arguments: a (type double) value > 0 and an integer root > 1. This function should work exactly as...

  • 3. Produce the function quadratic(a,b,c) where a, b, and c are the coeffi- cients of the...

    3. Produce the function quadratic(a,b,c) where a, b, and c are the coeffi- cients of the quadratic ax2 + bx +c. The function should return: 1. a list of the two roots of ax2 + bx +c= 0, when two roots exist 2. the first root is the smaller of the two 3. if ax2 + bx +c=0 has no real roots, then return None. 4. if the quadratic has one real root only, then return a list with a...

  • C# Programming: A.    Write a GUI program named MultiplicationGUI whose Main() method asks the user to...

    C# Programming: A.    Write a GUI program named MultiplicationGUI whose Main() method asks the user to input an integer into a TextBox and then calls a method named MultiplicationTable() after the user clicks a Button. MultiplicationTable() displays the results of multiplying the integer by each of the numbers 2 through 10.

  • In JAVA: For this question, you need to create two interface programs in a package and...

    In JAVA: For this question, you need to create two interface programs in a package and import them to the class where you implement the methods. You can create a new package in your assignment4 project (or package) to contain the two interface programs. One of the interface program has two methods ( countOne(), countTwo() ) and the other interface program has only one method (countThree ( ) ). In a separate package, write a class to implement the two...

  • object oriented programming solve 2 quetions 9 Lab 8 - Graphical User Interface (GUI) The assignments...

    object oriented programming solve 2 quetions 9 Lab 8 - Graphical User Interface (GUI) The assignments for this week are to understand the use of tkinter modules to create GUI in Python. 9.1 Assignment 1 1. Create the following window using the tkinter module in Python. The button Quit closes the window, and the button Show prints the first name and last name entered in the Entry boxes. First Name Last Name Quit Show 2. Create the following window using...

  • I. User Interface Create a JavaFX application with a graphical user interface (GUI) based on the...

    I. User Interface Create a JavaFX application with a graphical user interface (GUI) based on the attached “GUI Mock-Up”. Write code to display each of the following screens in the GUI: A. A main screen, showing the following controls: • buttons for “Add”, “Modify”, “Delete”, “Search” for parts and products, and “Exit” • lists for parts and products • text boxes for searching for parts and products • title labels for parts, products, and the application title B. An add...

  • JAVA SOLUTION This lab has four parts: Create a window. Create 5 buttons in that window....

    JAVA SOLUTION This lab has four parts: Create a window. Create 5 buttons in that window. Create an event when a button is pushed. Create an event listener that will respond to the button being pushed event. Task 1 – Create a Window For Java: Please ensure that the following import statements are used: import javafx.application.Application; import javafx.stage.Stage; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.layout.GridPane; import javafx.scene.text.Text; import javafx.event.EventHandler; import javafx.scene.input.MouseEvent; Next, ensure that there is a main method which is...

  • Graphical User Interface Programming (Code using JavaScript w/ Intellij idea) This assignment can be done using...

    Graphical User Interface Programming (Code using JavaScript w/ Intellij idea) This assignment can be done using either the Java Swing Library or the Java FX Library Design a universal remote control for an entertainment system such as (cable / TV, etc). Create the interface as a Java Intellij project. Optionally, you may design the interface for a smartphone. This is Very Important If you are implementing your design using the Swing Library, the assignment cannot be created using the GUI...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT