Question: I ONLY NEED PART B OF THIS QUESTION a. Write a program named Eggs that declares four variables to hold the number of eggs produced
I ONLY NEED PART B OF THIS QUESTION
a. Write a program named Eggs that declares four variables to hold the number of eggs produced in a month by each of four chickens, and assign a value to each variable. Sum the eggs, then display the total in dozens and eggs. For example, a total of 127 eggs is 10 dozen and 7 eggs.
I have part A which is below and just need part B:
01
using System;
02
public class Eggs
03
{
04
public static void Main()
05
{
06
string egg1AsString,
07
egg2AsString,
08
egg3AsString,
09
egg4AsString;
10
11
Int32 egg1,
12
egg2,
13
egg3,
14
egg4,
15
total,
16
total2,
17
total3;
18
19
Console.WriteLine("Enter first chickens eggs");
20
egg1AsString = Console.ReadLine();
21
egg1 = Convert.ToInt32(egg1AsString);
22
Console.WriteLine("Enter second chickens eggs");
23
egg2AsString = Console.ReadLine();
24
egg2 = Convert.ToInt32(egg2AsString);
25
Console.WriteLine("Enter third chickens eggs");
26
egg3AsString = Console.ReadLine();
27
egg3 = Convert.ToInt32(egg3AsString);
28
Console.WriteLine("Enter fourth chickens eggs");
29
egg4AsString = Console.ReadLine();
30
egg4 = Convert.ToInt32(egg4AsString);
31
32
total = egg1 + egg2 + egg3 + egg4;
33
total2 = total / 12;
34
total3 = total2 %12;
35
Console.WriteLine("Total eggs is {0} dozen and {1} eggs.", total2, total3);
36
Console.ReadLine();
37
}
38
}
b. Modify the Eggs program to create a new one named EggsInteractive that prompts the user for and accepts a number of eggs for each chicken.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
