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
What are the consequences of plagiarism?
garik1379 [7]
You can be:
expelled from school
fired from your job
not accepted into college
sometimes you can even be sued
8 0
2 years ago
Read 2 more answers
T F The scope of a parameter is limited to the function which uses it.
KiRa [710]

Answer: True

Explanation:

 Yes, the given statement is true that the scope of the parameters are limited within the function where it is used in the program. In the function, the scope is basically referring to visibility of the given variable in the particular program.

Ordinarily, every factor has a worldwide degree. When characterized, all aspects of the program can get easily accessible to the variable.

It is basically useful for limit the scope of the variable in the single function and the variable has always in limited scope so that the inside function does not affected the main function of the program.

3 0
3 years ago
What can happen if you do not follow the directions of medicine or the directions from the doctor? (Give 4 examples)​
iren [92.7K]

Answer:

1) Issue at hand will not properly be resolved and another visit to the doctor will have to occur, either to refill the prescription or to try another course of action.

2) Side effects

3) Ineffective

4) If directions are not followed to a tea, money will be waisted on the purchase.

Explanation:

5 0
2 years ago
A Product Manager has been given responsibility for overseeing the development of a new software application that will be deploy
natima [27]

There are different software that has been developed today. The most time-saving and cost-effective way is to Design the application’s security features after the application’s initial build is complete.

Accenture is known for their work in improving business needs. They are constantly shifting to a new method of delivering information technology.

They are known to embed security into the product development life cycle helps secure the business and also keeping speed and assisting to remove friction.

Learn more about Accenture from

brainly.com/question/25737623

8 0
2 years ago
Help with some questions. Thank you!
Oksana_A [137]

Answer:

1. E: II and III only

2. A: (int)(Math.random() * (upper − lower) ) + lower

3. A: The value of answer is N

4. E: while( !(userGuess == secretNumber) && numGuesses <= 15 )

5. C: 21

Explanation:

1. Which of the following is equivalent to while(userGuess != secretNumber)?

I. while( userGuess < secretNumber && userGuess > secretNumber)  

NO - This will test until the userGuess is smaller AND greater than the secretNumber, at the same time... so that condition will never be true.

II. while( userGuess < secretNumber || userGuess > secretNumber)

YES - This will test the value of userGuess and see if it's smaller OR greater than secetNumber.  So, it will loop until the user guesses right.

III. while( !(userGuess == secretNumber) )

YES, this will negate the match with the secretNumber.  In order words, if it's not a match, it will return true... so the loop will run until it finds a false condition (a match).

As you can see, only II and III are valid.

2.  If the lower limit were inclusive and the upper limit exclusive, which expression would properly generate values for the secret number?

A: (int)(Math.random() * (upper − lower) ) + lower

Since the lower limit is INCLUSIVE, we mustn't add one to the lower limit.  Also, the Math.random() function returns a value that matches our needs; it returns a value between [0,1[ (meaning the 0 is included, but not the 1).

Assuming the (int) caster does return only the integer portion doing a round down of the result, we'll be perfect.

3. What conclusion can be made about the state of the program when the while loop terminates?

while(!answer.equals( "N"))

{.....

A: The value of answer is N

The condition in the loops reads as "While the negation of the answer being 'N', loop".  If the answer equals 'N' then the method should return true... which will be negated by the '!' operator, causing the condition to be false. Thus we know that if the loop ends, the value of answer contains 'N', any other value will keep the loop going.

4. Assuming numGuesses is initialized to 1, how would the while statement be modified to include an extra criterion limiting the number of guesses to 15?

E: while( !(userGuess == secretNumber) && numGuesses <= 15 )

This modified condition will first test to see if the user has guessed the secretNumber (if he has, the first sub-parenthesis will be true... so the left side of the && operator will be false due to the negation operator.  The right side of the && operator will check to see how many tries have been attempted. Since the counter starts at 1, it needs to go up to 15 inclusively... so the <= is the right comparison operator.

5. After execution of the following code segment, what will be displayed?

int x = 1;

while(x < 18)

{

x += 5;

}

System.out.println(x);

C: 21

The x variable is initialized with 1... then enters the loop, in which it is incremented by 5 at each passage.

So after first passage, x = 6

After second passage, x = 11

After third passage, x = 16

After fourth passage, x = 21

Cannot enter the loop again because 21 > 18.

So, it will print out the value of 21.

3 0
3 years ago
Other questions:
  • Which payment type is best if you are trying to sick to a budget?
    15·1 answer
  • ​A(n) ____ will hold an online auction buyer’s payment until he or she is satisfied that the item bought matches the seller’s de
    13·1 answer
  • Which option can Jesse use to customize her company’s logo, name, address, and similar details in all her business documents?
    7·1 answer
  • Clep allows students to do all of thw following except which?
    11·2 answers
  • A program that interacts with another piece of software as it if were a human user is known as a(n) ________.
    5·1 answer
  • Convert to octal. Convert to hexadecimal. Then convert both of your answers todecimal, and verify that they are the same.(a) 111
    12·1 answer
  • Which is a good plan for backing up data?
    6·1 answer
  • The auxiliary device used to store large volume of data and program for future is called​
    10·1 answer
  • What is a trusted computing base (TCB)? Hosts on your network that support secure transmissions The operating system kernel and
    9·1 answer
  • Why womt this code work????
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!