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
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
Programming Logic & Design Comprehensive
9th Edition
ISBN:9781337669405
Author:FARRELL
Publisher:FARRELL
Chapter8: Advanced Data Handling Concepts
Section: Chapter Questions
Problem 17RQ
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!](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F4d27a8a6-cc74-416c-a782-397e5cce3206%2F8a35f099-4806-4afd-a3e3-37c1d7bf220b%2F6qabw_processed.png&w=3840&q=75)
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
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps with 1 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Knowledge Booster
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.Recommended textbooks for you
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
![A Guide to SQL](https://www.bartleby.com/isbn_cover_images/9781111527273/9781111527273_smallCoverImage.gif)
A Guide to SQL
Computer Science
ISBN:
9781111527273
Author:
Philip J. Pratt
Publisher:
Course Technology Ptr
![Programming with Microsoft Visual Basic 2017](https://www.bartleby.com/isbn_cover_images/9781337102124/9781337102124_smallCoverImage.gif)
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
![A Guide to SQL](https://www.bartleby.com/isbn_cover_images/9781111527273/9781111527273_smallCoverImage.gif)
A Guide to SQL
Computer Science
ISBN:
9781111527273
Author:
Philip J. Pratt
Publisher:
Course Technology Ptr
![Programming with Microsoft Visual Basic 2017](https://www.bartleby.com/isbn_cover_images/9781337102124/9781337102124_smallCoverImage.gif)
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning
![Oracle 12c: SQL](https://www.bartleby.com/isbn_cover_images/9781305251038/9781305251038_smallCoverImage.gif)
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781305627482/9781305627482_smallCoverImage.gif)
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781305627482
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781285196145/9781285196145_smallCoverImage.gif)
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781285196145
Author:
Steven, Steven Morris, Carlos Coronel, Carlos, Coronel, Carlos; Morris, Carlos Coronel and Steven Morris, Carlos Coronel; Steven Morris, Steven Morris; Carlos Coronel
Publisher:
Cengage Learning