An introduction to object-oriented programming.
Write a GUI program named EggsInteractiveGUI that allows a user to input the number of eggs produced in a month by each of five chickens. Sum the eggs, then display the total in dozens and eggs. For example, a total of 127 eggs is 10 dozen and 7 eggs.

Answers

Answer 1

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.

An Introduction To Object-oriented Programming. Write A GUI Program Named EggsInteractiveGUI That Allows

Related Questions

(Find the number of days in a month) Write a program that prompts the user to enter the month and year and displays the number of days in the month. For example, If the user entered month 2 and year 2012, the program should display that February 2012 has 29 days. If the user entered month 3 and year 2015, the program should display that March 2015 has 31 days.

Answers

it would be a table program. you can add a table and put your data into the table

5. Write a C++ program that can display the output as shown below. Your
program will calculate the price after discount. User will input the
price and the discount is 20%


Answers

Answer:

#include<iostream>

using namespace std;

int main()

{

float price;

float discount;

cout<<"enter price : ";

cin>>price;

discount=price - (price * 20 / 100);

cout<<"discount rate is :"<<discount;

}

Explanation:

Other Questions
Which graph represents a function?? List the two suggestions the article gives for avoiding gender-biased language. (Site 2) asap plz!! What is the frequency of a wave with a period of 0.2 seconds? A large cooler contains 15 liters of iced tea and A small cooler contains 5 liters of iced tea how many more milliliters of iced tea does the large cooler contain than the small cooler? Find the absolute maximum and absolute minimum of the function f(x,y)=2x24x+y24y+1 on the closed triangular plate bounded by the lines x=0,y=2,y=2xin the first quadrant. Samantha is going to the store to buy cat food. A small bag of cat food costs $6 while a large bag costs $14. She plans to buy at least 4 bags of food but spend no more than $56. Which of the following is a possible combination of the types of bags she can buy? The volume of a rectangular prism can be found by multiplying the base area, B, times the height. If the volume of the prism is represented by 15x2 + x + 2 and the height is x2, which expression represents B, the area of the base? 15x + + 15x + + 15 + + 15 + + RESUELVE EL SIGUINTE PORBLEMA En la escuela "Soy Feliz porque soy diverso", hay 230 estudiantes en total. De estos, 35 son mujeres. a) Cuntos son hombres? b) Qu parte del total de los estudiantes son hombres? 2. Mara se ha gastado 13 del dinero que le dieron de paga sus abuelitos en comprar un libro de aventuras. Tambin se ha gastado 29 de la paga en comprar una cartuchera. Qu fraccin de su paga se ha gastado Mara? Datos: Libro de aventuras = 13 Cartuchera = 29 Solucin: 13+ 29=3+29= 59 Find the total cost, rounded to the nearest cent, of 3.9 pounds of corned beef at $5.49 per pound and 4.6 pounds of pastrami at $4.95 per pound. Si tuviramos suficiente dinero_a Chile durante las vacaciones.O A. volveremosB. volvamosC. vuelvenO D. volveramosSUBMIT Need help ASAP How to check that a trinomial is a perfect square ? (blank)is a chemical substance that organisms require to live. How did shifting workforce demographics contribute to the dramatic changes that occurred in the US labor force and industry during and immediately after World War II?Can any please help me I don't understand the question What might happen to the organisms in the food web below if the number of phytoplankton and vegetation drastically decreased? A paper manufacturer packages twelve reams of paper in a boxin three stacks of four reams. A ream of paper weighs 5 pounds and has dimensions of 8.5 inches by 11 inches by 2 inches. What is the volume of the current-sized box? a0 cubic inches If the market price of an orange increases from $0.80 to $1.05, then consumer surplus. Name First orange Second orange Third orange Allison $2 $1.5 $0.75 Bob $1.5 $1 $0.6 Charisse $0.75 $0.25 $0 Group of answer choices increases by $0.75 decreases by $0.95. decreases by $0.75 decreases by $1.00 Which reason would most effectively refute the counterclaim?Counterclaim: In addition to writing acclaimed lyrics, Bob Dylan has written both prose and poetry.I have read Dylans book of poetry, Tarantula, and his memoir, Chronicles: Volume One, and think that both books are worthy of the Nobel Prize in Literature. I just dont think that Dylans song lyrics should be awarded in the same category as his books.It is true that Bob Dylan has published traditional poetry and prose. However, neither of the books was very good, and neither won prestigious awards. If the Nobel Prize in Literature considered all writers of at least two mediocre books, the award would mean nothing.It is true that Bob Dylan has published traditional poetry and prose. However, one book of poetry and one memoir would not qualify him for the prize. The prize was awarded based on his songwriting, which does not qualify as literature. Two very large parallel sheets a distance d apart have their centers directly opposite each other. The sheets carry equal but opposite uniform surface charge densities. A point charge that is placed near the middle of the sheets a distance d/2 from each of them feels an electrical force F due to the sheets. If this charge is now moved closer to one of the sheets so that it is a distance d/4 from that sheet, what force will feel A portrait of Mrs. Elizabeth Freake and Baby Mary. A woman holds her baby on her lap in a chair. Who is the artist of the painting above? a. Poussin b. Christopher Wren c. Antoine Le Nain d. The artist is unknown. Please select the best answer from the choices provided A B C Sum of the ages of a father and the son is 40 years. If father's age is 3 times that of his son, then father's age is ________ * 2 points 35 40 30 45