Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

use visual studio, take the screenshot of the output and the code. Help me with

ID: 3710469 • Letter: U

Question

use visual studio, take the screenshot of the output and the code. Help me with number 4

letter and then add th becomes ogday, and c that allows the user to . Write a program named CarRentallnteractiveGUI that prompts a user for days and miles for a car rental and displays the total rental fee computed as $20 per day plus 25 cents per mile. 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. Figure 3-20 shows a typical execution. Debugging Exer Each of the following p files has syntax and/or project folder with a ne in Visual Studio. For ex FixedDebugThreel. All the Fixed prefix, so you the top-level folder. Afte problems, and fix them. 1. gg Calcula Enter eggs produced by each of 5 chickens 15 36 Chapter a. Debug Threel b. DebugThree2 0 31 23 Clok to calculate Case Problems 127 eggs is 10 dazen wth 7 left over 1. In Chapter 2, you created prompts a user for the nun in this year's competition. competition if each contes a statement that indicates v last year's, Now, create an i that performs all the samet Figure 3-20 An Eggs InteractiveGUI application Write a GUI program named TestsinteractiveGUI that allows a user to enter scores for five tests he has taken. Display the average of the test scores to two decimal places 5.

Explanation / Answer

//EggsInteractiveGUI.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace EggsInteractiveGUI
{
    static class EggsInteractiveGUI
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());
        }
    }
}
-----------------------------------------------------------------------------------------------------------------------------------------
//Form1.cs
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 EggsInteractiveGUI
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void calculateButton_Click(object sender, EventArgs e)
        {
            const int EGGS_PER_DOZEN = 12;

            int firstChickenEggs = Convert.ToInt32(firstChickenTextBox.Text);
            int secondChickenEggs = Convert.ToInt32(secondChickenTextBox.Text);
            int thirdChickenEggs = Convert.ToInt32(thirdChickenTextBox.Text);
            int fourthChickenEggs = Convert.ToInt32(fourthChickenTextBox.Text);
            int fifthChickenEggs = Convert.ToInt32(fifthChickenTextBox.Text);

            int totalEggs = firstChickenEggs + secondChickenEggs + thirdChickenEggs + fourthChickenEggs + fifthChickenEggs;

            int dozen = totalEggs / EGGS_PER_DOZEN;
            int leftOver = totalEggs % EGGS_PER_DOZEN;

            outputLabel.Text = String.Format("{0} eggs is {1} dozen with {2} left over", totalEggs, dozen, leftOver);
        }
    }
}
-------------------------------------------------------------------------------------------------------------------------------

//Form1.Designer.cs
namespace EggsInteractiveGUI
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.label1 = new System.Windows.Forms.Label();
            this.firstChickenTextBox = new System.Windows.Forms.TextBox();
            this.secondChickenTextBox = new System.Windows.Forms.TextBox();
            this.thirdChickenTextBox = new System.Windows.Forms.TextBox();
            this.fourthChickenTextBox = new System.Windows.Forms.TextBox();
            this.fifthChickenTextBox = new System.Windows.Forms.TextBox();
            this.calculateButton = new System.Windows.Forms.Button();
            this.outputLabel = new System.Windows.Forms.Label();
            this.SuspendLayout();
            //
            // label1
            //
            this.label1.AutoSize = true;
            this.label1.Location = new System.Drawing.Point(25, 22);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(282, 17);
            this.label1.TabIndex = 0;
            this.label1.Text = "Enter eggs produced by each of 5 chickens";
            //
            // firstChickenTextBox
            //
            this.firstChickenTextBox.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
            this.firstChickenTextBox.Location = new System.Drawing.Point(48, 69);
            this.firstChickenTextBox.Name = "firstChickenTextBox";
            this.firstChickenTextBox.Size = new System.Drawing.Size(42, 26);
            this.firstChickenTextBox.TabIndex = 1;
            //
            // secondChickenTextBox
            //
            this.secondChickenTextBox.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
            this.secondChickenTextBox.Location = new System.Drawing.Point(96, 69);
            this.secondChickenTextBox.Name = "secondChickenTextBox";
            this.secondChickenTextBox.Size = new System.Drawing.Size(42, 26);
            this.secondChickenTextBox.TabIndex = 2;
            //
            // thirdChickenTextBox
            //
            this.thirdChickenTextBox.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
            this.thirdChickenTextBox.Location = new System.Drawing.Point(144, 69);
            this.thirdChickenTextBox.Name = "thirdChickenTextBox";
            this.thirdChickenTextBox.Size = new System.Drawing.Size(42, 26);
            this.thirdChickenTextBox.TabIndex = 3;
            //
            // fourthChickenTextBox
            //
            this.fourthChickenTextBox.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
            this.fourthChickenTextBox.Location = new System.Drawing.Point(192, 69);
            this.fourthChickenTextBox.Name = "fourthChickenTextBox";
            this.fourthChickenTextBox.Size = new System.Drawing.Size(42, 26);
            this.fourthChickenTextBox.TabIndex = 4;
            //
            // fifthChickenTextBox
            //
            this.fifthChickenTextBox.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
            this.fifthChickenTextBox.Location = new System.Drawing.Point(240, 69);
            this.fifthChickenTextBox.Name = "fifthChickenTextBox";
            this.fifthChickenTextBox.Size = new System.Drawing.Size(42, 26);
            this.fifthChickenTextBox.TabIndex = 5;
            //
            // calculateButton
            //
            this.calculateButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
            this.calculateButton.Location = new System.Drawing.Point(65, 127);
            this.calculateButton.Name = "calculateButton";
            this.calculateButton.Size = new System.Drawing.Size(203, 40);
            this.calculateButton.TabIndex = 6;
            this.calculateButton.Text = "Click to calculate";
            this.calculateButton.UseVisualStyleBackColor = true;
            this.calculateButton.Click += new System.EventHandler(this.calculateButton_Click);
            //
            // outputLabel
            //
            this.outputLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
            this.outputLabel.Location = new System.Drawing.Point(28, 194);
            this.outputLabel.Name = "outputLabel";
            this.outputLabel.Size = new System.Drawing.Size(279, 52);
            this.outputLabel.TabIndex = 3;
            this.outputLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
            //
            // Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(332, 255);
            this.Controls.Add(this.outputLabel);
            this.Controls.Add(this.calculateButton);
            this.Controls.Add(this.fifthChickenTextBox);
            this.Controls.Add(this.fourthChickenTextBox);
            this.Controls.Add(this.thirdChickenTextBox);
            this.Controls.Add(this.secondChickenTextBox);
            this.Controls.Add(this.firstChickenTextBox);
            this.Controls.Add(this.label1);
            this.Name = "Form1";
            this.Text = "Egg Calculator";
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.TextBox firstChickenTextBox;
        private System.Windows.Forms.TextBox secondChickenTextBox;
        private System.Windows.Forms.TextBox thirdChickenTextBox;
        private System.Windows.Forms.TextBox fourthChickenTextBox;
        private System.Windows.Forms.TextBox fifthChickenTextBox;
        private System.Windows.Forms.Button calculateButton;
        private System.Windows.Forms.Label outputLabel;
    }
}