C# program writen in Visual Studio code, I need added on the end the Last Value Divided by the First Value. Here is the code... class Progr

Np Ms Office 365/Excel 2016 I Ntermed
1st Edition
ISBN:9781337508841
Author:Carey
Publisher:Carey
Chapter4: Analyzing And Charting Financial Data
Section: Chapter Questions
Problem 3RA
icon
Related questions
Question
100%

For this C# program writen in Visual Studio code, I need added on the end the Last Value Divided by the First Value. Here is the code...

class Program
    {
        static void Main(string[] args)
        {
            UniqueValueApp myApp = new UniqueValueApp();
            myApp.GetValues();
            myApp.DisplayValues();
            myApp.minValue();
            myApp.maxValue();
            myApp.sumOfValues();
            myApp.avgOfValues();

        }
    }

    class UniqueValueApp
    {
        private List<int> _list = new List<int>();

        public void GetValues()
        {
            int value;
            bool result;
            Console.Write("Please enter an integer: ");
            string input = Console.ReadLine();

            while (input != null)
            {
                result = int.TryParse(input, out value);

                if (result)
                {
                    if (value > -1 && value < 100)
                    {
                        if (!_list.Contains(value))
                        {
                            _list.Add(value);
                        }
                        if (_list.Count == 5)
                        {
                            break;
                        }
                    }
                    else
                    {
                        Console.WriteLine("You must enter a value between 0 and 100, inclusive.");
                    }
                }
                Console.Write("Please enter an integer: ");
                input = Console.ReadLine();
            }
        }

        public void DisplayValues()
        {
            Console.WriteLine("Unique values entered: ");
            foreach (int number in _list)
            {
                Console.Write(number+" ");
            }
        }
       
        public void minValue()
        {
            int min = _list[0];
            foreach (int number in _list)
            {
                if(number < min)
                    min = number;
            }
            Console.WriteLine("\nMin Value Entered: "+min);
        }
        public void maxValue()
        {
            int max = _list[0];
            foreach (int number in _list)
            {
                if(number > max)
                    max = number;
            }
            Console.WriteLine("\nMax Value Entered: "+max);
        }
       
        public void sumOfValues()
        {
            int s = 0;
            foreach (int number in _list)
            {
                s += number;
            }
            Console.WriteLine("\nSum of Value Entered: "+s);
        }
       
        public void avgOfValues()
        {
            int s = 0;
            foreach (int number in _list)
            {
                s += number;
            }
            Console.WriteLine("\nAverage of Value Entered: "+(s/5));
        }
       
    }

 

Unique Values Entered:
5 2 6 42 38
Min Value Entered: 2
Max Value Entered: 42
Sum of Values Entered: 93
Average of Values Entered: 18
Last Value Divided by First Value: 7
All processing completed!
Transcribed Image Text:Unique Values Entered: 5 2 6 42 38 Min Value Entered: 2 Max Value Entered: 42 Sum of Values Entered: 93 Average of Values Entered: 18 Last Value Divided by First Value: 7 All processing completed!
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Concept of Parenthesis
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Np Ms Office 365/Excel 2016 I Ntermed
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:
9781337508841
Author:
Carey
Publisher:
Cengage
Fundamentals of Information Systems
Fundamentals of Information Systems
Computer Science
ISBN:
9781305082168
Author:
Ralph Stair, George Reynolds
Publisher:
Cengage Learning
Oracle 12c: SQL
Oracle 12c: SQL
Computer Science
ISBN:
9781305251038
Author:
Joan Casteel
Publisher:
Cengage Learning
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
A Guide to SQL
A Guide to SQL
Computer Science
ISBN:
9781111527273
Author:
Philip J. Pratt
Publisher:
Course Technology Ptr