C# program that will accept multiple values from user and let them know if its i
ID: 3800609 • Letter: C
Question
C# program that will accept multiple values from user and let them know if its in acceptable range of 0 to 100.
Requirements
1-create a method that will display the instructions and information about the program.
2-create a method that displays the prompt as to whether you wish to enter another value
3-create a method that requests the input from the user
I think I have a start with the format that follows - any advice would be appriciated.
______________________________________________________________________________
using System;
using static System.Console;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Chapter6Homework1
{
class Ch6Program1
{
static void Main(string[] args)
{
int value;
DisplayInstructions()
}
//Display Instructions
public static void DisplayInstructions()
{
WriteLine("***** ***** ***** ***** ***** *****");
WriteLine(" This application lets you enter as many values as you want.");
WriteLine(" It will then test the values you entered to see if they are within the acceptable range of 0 to 100");
}
//Input From User
public static getInput()
{
//accept input from user
}
//Enter another value question
public static getMultiInput()
{
//a loop to ask if the user would like to enter more values
WriteLine(" Would you like to enter another value?");
ReadLine();
//I think a bool needs to be entered in this area to end input and display results
/*Output reads as follows:
*
* Results
* Number of Valid values entered during testing: *****show number of values entered*
* Number of Invalid values entered: ******show number of invalid values entered for testing*
* Values outside of range: *******show number outside range*
* Non-Numeric values entered: *******show number of non-numeric vaues entered*
*
*/
}
}
}
Explanation / Answer
We can also try with these code:
1)
Int x = 30 ;
If (Enumerable. Range (1 , 100 ). Contains(x))
If (x >= 1 && x <= 100)
2)
If (number >= 1 && number <= 100)
Or
Bool TestRange (int numberToCheck, int bottom, int top)
{
Return ( numberToChecheck >= bottom && numberToCheck <= top);
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.