1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Ivenika [448]
3 years ago
14

An introduction to object-oriented programming.

Computers and Technology
1 answer:
Scorpion4ik [409]3 years ago
3 0

Answer:

The csharp program is given below.

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 WindowsFormsApplication1

{

   public partial class Form1 : Form

   {

       public Form1()

       {

           InitializeComponent();

      }

       private void button6_Click(object sender, EventArgs e)

       {

           int total = (Convert.ToInt32(textBox1.Text) +  Convert.ToInt32(textBox2.Text) + Convert.ToInt32(textBox3.Text) + Convert.ToInt32(textBox4.Text) + Convert.ToInt32(textBox5.Text));

           int dozen = total / 12;

           int eggs = total % 12;

           textBox6.Text = dozen.ToString();

           textBox7.Text = eggs.ToString();

       }

       private void button7_Click(object sender, EventArgs e)

       {

           textBox1.Text = "";

           textBox2.Text = "";

           textBox3.Text = "";

           textBox4.Text = "";

           textBox5.Text = "";

           textBox6.Text = "";

           textBox7.Text = "";

       }

        private void button8_Click(object sender, EventArgs e)

       {

           Close();

       }

    }

}

Explanation:

1. The integer variables are declared for total eggs, number of dozens and number of eggs.

2. The input of each text box is converted into integer by using the Convert.ToInt32() method on the value of that particular text box.

3. All the inputs are added and the sum is assigned to variable, total.

4. The number of dozens are obtained by dividing total by 12 and assigning the value to the variable, dozen.

5. The number of extra eggs are obtained by taking the modulus of total and 12 and the value is assigned to the variable, eggs.

6. The integer values in the variables, dozen and eggs, are converted into string using the ToString() function with that particular value.

dozen.ToString();

eggs.ToString();

7. The text boxes are assigned the respective values of dozens and number of eggs.

textBox6.Text = dozen.ToString();

textBox7.Text = eggs.ToString();

8. Two additional buttons, clear and exit, are also added.

9. The clear button erases the contents of all the text boxes. The Text property of each textbox is set to “” thereby clearing all the text fields.

10. The exit button closes the application using Close() function.

11. The program is made in visual studio and the output is attached.

You might be interested in
In which of the following scenarios would it be best to use a for loop?
Evgesh-ka [11]

Answer:

I would say 3 is the most likely answer ("When you want to ask the user for 10 numbers").

You use for loops to perform a task x times usually.

8 0
3 years ago
Question #4
Nataliya [291]
A is your answer.............
3 0
3 years ago
Write the use of the Goto statement with the help of an example.
kogti [31]
Sorry for this but to be honest we do t get taught this in the school I go to sorry
3 0
2 years ago
________ are hardware devices or software programs that direct messages as they travel between networks.
In-s [12.5K]
<span>Routers are hardware devices or software programs that direct messages as they travel between networks. the answer is routers</span>
5 0
3 years ago
What language do the Vikings speak in the game " For Honor"?
aivan3 [116]
In the game the Vikings speak icelandic
3 0
3 years ago
Read 2 more answers
Other questions:
  • MATLAB graphics user interface:<br> Describe what Folder, Command Window and Workspace are.
    5·1 answer
  • Which of the following situations would not require knowledge of networking?
    6·1 answer
  • Which of these jobs would be most appropriate for someone who majors in computer engineering? I need the answer ASAP Helping com
    14·2 answers
  • What are the advantages and disadvantages of malware maintenance?
    12·1 answer
  • What was the first computer programming language?
    7·2 answers
  • Fire Tint, Inc., (FTI), applies tint to airplane canopies (front windows) manufactured by other companies. When the canopy manuf
    12·1 answer
  • Select three physical forms of storage. USB drive Primary cache Magnetic storage Secondary cache Dynamic RAM Optical drive
    7·2 answers
  • What is the output by the code system.out.print(8-4+2);
    13·1 answer
  • What is the main function of processing unit​
    5·2 answers
  • QUESTION 10
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!