OBJECTIVE C
2) // Create a small app that takes user input and performs a useful calculation with that user input
// - make sure that absolutely no input crashes the app.
// - Use layout constraints to make sure the app looks good in portraint and landscape mode, as well as on small and large devices.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace CalculatorApp
{
public partial class
Form1 : Form
{
double FirstNumber;
string Operation;
public Form1()
{
InitializeComponent();
}
private void n1_Click(object sender, EventArgs e)
{
if (textBox1.Text == "0" && textBox1.Text != null)
{
textBox1.Text = "1";
}
else
{
textBox1.Text = textBox1.Text + "1";
}
}
private void n2_Click(object sender, EventArgs e)
{
if (textBox1.Text == "0" && textBox1.Text != null)
{
textBox1.Text = "2";
}
else
{
textBox1.Text = textBox1.Text + "2";
}
}
private void n3_Click(object sender, EventArgs e)
{
if (textBox1.Text == "0" && textBox1.Text != null)
{
textBox1.Text = "3";
}
else
{
textBox1.Text = textBox1.Text + "3";
}
}
private void n4_Click(object sender, EventArgs e)
{
if (textBox1.Text == "0" && textBox1.Text != null)
{
textBox1.Text = "4";
}
else
{
textBox1.Text = textBox1.Text + "4";
}
}
private void n5_Click(object sender, EventArgs e)
{
if (textBox1.Text == "0" && textBox1.Text != null)
{
textBox1.Text = "5";
}
else
{
textBox1.Text = textBox1.Text + "5";
}
}
private void n6_Click(object sender, EventArgs e)
{
if (textBox1.Text == "0" && textBox1.Text != null)
{
textBox1.Text = "6";
}
else
{
textBox1.Text = textBox1.Text + "6";
}
}
private void n7_Click(object sender, EventArgs e)
{
if (textBox1.Text == "0" && textBox1.Text != null)
{
textBox1.Text = "7";
}
else
{
textBox1.Text = textBox1.Text + "7";
}
}
private void n8_Click(object sender, EventArgs e)
{
if (textBox1.Text == "0" && textBox1.Text != null)
{
textBox1.Text = "8";
}
else
{
textBox1.Text = textBox1.Text + "8";
}
}
private void n9_Click(object sender, EventArgs e)
{
if (textBox1.Text == "" && textBox1.Text != null)
{
textBox1.Text = "9";
}
else
{
textBox1.Text = textBox1.Text + "9";
}
}
private void n0_Click(object sender, EventArgs e)
{
textBox1.Text = textBox1.Text + "0";
}
private void bad_Click(object sender, EventArgs e)
{
FirstNumber = Convert.ToDouble(textBox1.Text);
textBox1.Text = "0";
Operation = "+";
}
private void bsub_Click(object sender, EventArgs e)
{
FirstNumber = Convert.ToDouble(textBox1.Text);
textBox1.Text = "0";
Operation = "-";
}
private void bmul_Click(object sender, EventArgs e)
{
FirstNumber = Convert.ToDouble(textBox1.Text);
textBox1.Text = "0";
Operation = "*";
}
private void bdiv_Click(object sender, EventArgs e)
{
FirstNumber = Convert.ToDouble(textBox1.Text);
textBox1.Text = "0";
Operation = "/";
}
private void bc_Click(object sender, EventArgs e)
{
textBox1.Text = "0";
}
private void ndot_Click(object sender, EventArgs e)
{
textBox1.Text = textBox1.Text + ".";
}
private void nequal_Click(object sender, EventArgs e)
{
double SecondNumber;
double Result;
SecondNumber = Convert.ToDouble(textBox1.Text);
if (Operation == "+")
{
Result = (FirstNumber + SecondNumber);
textBox1.Text = Convert.ToString(Result);
FirstNumber = Result;
}
if (Operation == "-")
{
Result = (FirstNumber - SecondNumber);
textBox1.Text = Convert.ToString(Result);
FirstNumber = Result;
}
if (Operation == "*")
{
Result = (FirstNumber * SecondNumber);
textBox1.Text = Convert.ToString(Result);
FirstNumber = Result;
}
if (Operation == "/")
{
if (SecondNumber == 0)
{
textBox1.Text = "Cannot divide by zero";
}
else
{
Result = (FirstNumber / SecondNumber);
textBox1.Text = Convert.ToString(Result);
FirstNumber = Result;
}
}
}
}
}
OBJECTIVE C 2) // Create a small app that takes user input and performs a useful calculation with that user input // - m...
please look at below code and respond all the required import Foundation protocol TaksPerformer { func doAThing() } class Employee: TaksPerformer { let name: String var boss: Boss? init(name: String) { self.name = name } func doAThing() { print("\(name) is doing a thing") } } class Boss { var employee: Employee let name: String init(name: String, employee: Employee) { self.name = name self.employee = employee employee.boss = self } func actLikeABoss() { employee.doAThing() } } // 1) // A) What...
Create a code that performs the following actions: l. Define the flow rate and height of tank 2./ Have the user input a value for radius 3./ Ask the user for a value of many minutes the tank should fill for 4. Clear the command window (clc) after all of the input commands are given 5. Call in a "tank solver" function that performs the following Takes F, h, r, and t final as inputs, and there are no variable...
IN C++ MUST INCLUDE HEADER FILE, IMPLEMENTATION FILE, AND DRIVER FILE. IN C++ Create a header and implementation file to define an apartment class. Create a driver program to test the class, and create a make file to compile the driver program. Create two files called apartment.h and appartmentImp.cpp along with creating a driver program named testApartment.cpp containing the main function. Program Requirements: • Class attributes should include integers for number of rooms, monthly rent, and square feet, as well...
the goal is to create a c++ programs with small functions where the main delegates series of functions where the real work takes place. In this programming assignment, you are not allowed to use global variables. Avoid using break (unless working with a switch statement). Limit your functions to no more than 30 statements of code (not including comments or blank lines). Never use a “return” in the middle of a loop! Program Assignment: When I went to Paris over...
Need help with code in C# Create an application that reads a file named Accounts.txt. Your application should load the file and display back the results. The application should allow the user to enter additional entries and save them back to the same file. The CSV file should contain the following fields: AccountName, InvoiceDate, DueDate, AmountDue If the CSV file contains invalid data you want to inform the user which row contained bad data. Below is an example of what...
Please help code in c++ and use the answers you get from question 1 and 2 into the 3rd answer! Question 1 is first, question 2 is in the middle, question 3 is last Input Array (10 pts) te a function only (no main) that takes an array of doubles as a parameter as well as another integer rray. Create a for loop that asks the user to input any real number between-100 and r each element of the array....
Modify your PredictGPA.java file from Lab 2 to create a method called GPA that takes a string argument (the grade) and returns the corresponding value (ie 4.0 for an A, 3.33 for a B+, etc). Use this method call to reduce the “redundant” code that you had in Lab 2. The program must otherwise still run correctly as to the directions in Lab 2 and compute the GPA after using the method calls to determine the appropriate grade values. Trying...
MUST BE WRITTEN IN C++ Objective: Learn how to define structures and classes, create and access a vector of structures, use sort with different compare functions. Assignment: Your program will use the same input file, but you will print the whole book information, not just the title. And, most importantly, this time you will take an object oriented approach to this problem. Detailed specifications: Define a class named Collection, in which you will define a structure that can hold book...
MUST BE WRITTEN IN C++ Objective: Learn how to define structures and classes, create and access a vector of structures, use sort with different compare functions. Assignment: Your program will use the same input file, but you will print the whole book information, not just the title. And, most importantly, this time you will take an object oriented approach to this problem. Detailed specifications: Define a class named Collection, in which you will define a structure that can hold book...
Programming question. Using Visual Studio 2019 C# Windows Form Application (.NET Framework) Please include code for program with ALL conditions met. Conditions to be met: Word Problem A person inherits a large amount of money. The person wants to invest it. He also has to withdraw it annually. How many years will it take him/her to spend all of the investment that earns at a 7% annual interest rate? Note that he/she needs to withdraw $40,000.00 a year. Also there...