Esercizio concluso
This commit is contained in:
parent
edf9e69a0c
commit
248dabf958
84
Program.cs
84
Program.cs
@ -2,8 +2,6 @@
|
||||
|
||||
class Program {
|
||||
static void Main(string[] args) {
|
||||
|
||||
|
||||
string[][] userEnteredValues = new string[][]
|
||||
{
|
||||
new string[] { "1", "2", "3"},
|
||||
@ -11,47 +9,65 @@ class Program {
|
||||
new string[] { "0", "1", "2"}
|
||||
};
|
||||
|
||||
string overallStatusMessage = "";
|
||||
//string overallStatusMessage = "";
|
||||
|
||||
overallStatusMessage = Workflow1(userEnteredValues);
|
||||
//overallStatusMessage = Workflow1(userEnteredValues);
|
||||
|
||||
if (overallStatusMessage == "operating procedure complete") {
|
||||
Console.WriteLine("'Workflow1' completed successfully.");
|
||||
try {
|
||||
Workflow1(userEnteredValues);
|
||||
}
|
||||
else {
|
||||
catch (DivideByZeroException e) {
|
||||
Console.WriteLine("An error occurred during 'Workflow1'.");
|
||||
Console.WriteLine(overallStatusMessage);
|
||||
Console.WriteLine(e.Message);
|
||||
Console.WriteLine();
|
||||
}
|
||||
|
||||
static string Workflow1(string[][] userEnteredValues) {
|
||||
string operationStatusMessage = "good";
|
||||
string processStatusMessage = "";
|
||||
//if (overallStatusMessage == "operating procedure complete") {
|
||||
// Console.WriteLine("'Workflow1' completed successfully.");
|
||||
//}
|
||||
//else {
|
||||
// Console.WriteLine("An error occurred during 'Workflow1'.");
|
||||
// Console.WriteLine(overallStatusMessage);
|
||||
//}
|
||||
|
||||
static void Workflow1(string[][] userEnteredValues) {
|
||||
//string operationStatusMessage = "good";
|
||||
//string processStatusMessage = "";
|
||||
|
||||
foreach (string[] userEntries in userEnteredValues) {
|
||||
processStatusMessage = Process1(userEntries);
|
||||
|
||||
if (processStatusMessage == "process complete") {
|
||||
//processStatusMessage = Process1(userEntries);
|
||||
try {
|
||||
Process1(userEntries);
|
||||
Console.WriteLine("'Process1' completed successfully.");
|
||||
Console.WriteLine();
|
||||
}
|
||||
else {
|
||||
//if (processStatusMessage == "process complete") {
|
||||
// Console.WriteLine("'Process1' completed successfully.");
|
||||
// Console.WriteLine();
|
||||
//}
|
||||
catch (FormatException e) {
|
||||
Console.WriteLine("'Process1' encountered an issue, process aborted.");
|
||||
Console.WriteLine(processStatusMessage);
|
||||
Console.WriteLine(e.Message);
|
||||
Console.WriteLine();
|
||||
operationStatusMessage = processStatusMessage;
|
||||
}
|
||||
//else {
|
||||
// Console.WriteLine("'Process1' encountered an issue, process aborted.");
|
||||
// Console.WriteLine(processStatusMessage);
|
||||
// Console.WriteLine();
|
||||
// operationStatusMessage = processStatusMessage;
|
||||
//}
|
||||
}
|
||||
|
||||
if (operationStatusMessage == "good") {
|
||||
operationStatusMessage = "operating procedure complete";
|
||||
//if (operationStatusMessage == "good") {
|
||||
// operationStatusMessage = "operating procedure complete";
|
||||
//}
|
||||
|
||||
//return operationStatusMessage;
|
||||
}
|
||||
|
||||
return operationStatusMessage;
|
||||
}
|
||||
|
||||
static string Process1(String[] userEntries) {
|
||||
string processStatus = "clean";
|
||||
string returnMessage = "";
|
||||
static void Process1(String[] userEntries) {
|
||||
//string processStatus = "clean";
|
||||
//string returnMessage = "";
|
||||
int valueEntered;
|
||||
|
||||
foreach (string userValue in userEntries) {
|
||||
@ -64,21 +80,23 @@ class Program {
|
||||
}
|
||||
}
|
||||
else {
|
||||
returnMessage = "Invalid data. User input values must be non-zero values.";
|
||||
processStatus = "error";
|
||||
//returnMessage = "Invalid data. User input values must be non-zero values.";
|
||||
throw new DivideByZeroException("Invalid data. User input values must be non-zero values.");
|
||||
//processStatus = "error";
|
||||
}
|
||||
}
|
||||
else {
|
||||
returnMessage = "Invalid data. User input values must be valid integers.";
|
||||
processStatus = "error";
|
||||
//returnMessage = "Invalid data. User input values must be valid integers.";
|
||||
throw new FormatException("Invalid data. User input values must be valid integers.");
|
||||
//processStatus = "error";
|
||||
}
|
||||
}
|
||||
|
||||
if (processStatus == "clean") {
|
||||
returnMessage = "process complete";
|
||||
}
|
||||
//if (processStatus == "clean") {
|
||||
// returnMessage = "process complete";
|
||||
//}
|
||||
|
||||
return returnMessage;
|
||||
//return returnMessage;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@ -13,10 +13,10 @@ using System.Reflection;
|
||||
[assembly: System.Reflection.AssemblyCompanyAttribute("es_microsoft")]
|
||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+f7de842578b3a781c70401e9cda7d4a76775c93f")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+edf9e69a0ce18bcf901ab061a8edcf43c82db844")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("es_microsoft")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("es_microsoft")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
||||
// Generated by the MSBuild WriteCodeFragment class.
|
||||
// Generato dalla classe WriteCodeFragment di MSBuild.
|
||||
|
||||
|
||||
@ -1 +1 @@
|
||||
56ed7301782671e005aca5beb135364494d106475fc78ab1890b2ca1c798aa82
|
||||
48c28f31449a3787660df4ade160598cddc1e8aa7552882538a2c0ab6772a2ee
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user