Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
test2
//Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public enum GENERATE_RESULT_MODE { // This should cross reference to System.Config file for the network device // the order of the arrange is important and must follow the order in the network device // in the system config file // It is important also the Name property in System Config matches the NetworkDev enum name Random = 0, OnlyPass, OnlyFail, } class Car { public string model; // Create a field // Create a class constructor for the Car class public Car() { model = "Mustang"; // Set the initial value for model } public string RandomPF(GENERATE_RESULT_MODE Mode) { // Based on the mode , generate the strig as pass fail ; only pass or only fail var resultCharList = (Mode == GENERATE_RESULT_MODE.Random)? "PF" : (Mode == GENERATE_RESULT_MODE.OnlyPass)? "P" : "F"; var resultStringChars = new char[1]; var random1 = new Random(); for (int i = 0; i < resultStringChars.Length; i++) { resultStringChars[i] = resultCharList[random1.Next(resultCharList.Length)]; } string result = new string(resultStringChars); return result; } public string GenTopVisionResult(int row, int col, int mode, int lowerBound) { int m_TotalUnits = row * col; string msg; string OverallG1, ImageNameG1; string OverallG2, ImageNameG2; List<string> UnitDateG1 = new List<string>(); List<string> UnitDateG2 = new List<string>(); List<string> CodeDataG1 = new List<string>(); string[] UnitDataG1 = new string[m_TotalUnits](); if (mode == 0) { if (lowerBound == 0) { // Only PASS OverallG1 = OverallG2 = RandomPF(GENERATE_RESULT_MODE.OnlyPass); ImageNameG1 = "SimResult_FixPass1"; ImageNameG2 = "SimResult_FixPass2"; for (int i=1; i < m_TotalUnits; i++) { string defectCode = "TC"+i.ToString(); UnitDateG1.Add(string.Format("{0},{1};",RandomPF(GENERATE_RESULT_MODE.OnlyPass), defectCode)); UnitDateG2.Add(string.Format("{0},{1};",RandomPF(GENERATE_RESULT_MODE.OnlyPass), defectCode)); CodeDataG1.Add("Code"+i+";"); } // Replace the last ";" to ":" CodeDataG1.Last().Replace(";",":"); } else {// Only Fail OverallG1 = OverallG2 = RandomPF(GENERATE_RESULT_MODE.OnlyPass); ImageNameG1 = "SimResult_FixFail1"; ImageNameG2 = "SimResult_FixFail2"; for (int i=1; i < m_TotalUnits; i++) { string defectCode = "TC"+i.ToString(); UnitDateG1.Add(string.Format("{0},{1};",RandomPF(GENERATE_RESULT_MODE.OnlyFail), defectCode)); UnitDateG2.Add(string.Format("{0},{1};",RandomPF(GENERATE_RESULT_MODE.OnlyFail), defectCode)); CodeDataG1.Add("Code"+i+";"); } // Replace the last ";" to ":" CodeDataG1.Last().Replace(";",":"); } } else { // Only PASS OverallG1 = RandomPF(GENERATE_RESULT_MODE.Random); OverallG2 = RandomPF(GENERATE_RESULT_MODE.Random); ImageNameG1 = "SimResult_FixFail1"; ImageNameG2 = "SimResult_FixFail2"; for (int i=1; i < m_TotalUnits; i++) { string defectCode = "TC"+i.ToString(); UnitDateG1.Add(string.Format("{0},{1};",RandomPF(GENERATE_RESULT_MODE.Random), defectCode)); UnitDateG2.Add(string.Format("{0},{1};",RandomPF(GENERATE_RESULT_MODE.Random), defectCode)); CodeDataG1.Add("Code"+i+";"); } // Replace the last ";" to ":" CodeDataG1.Last().Replace(";",":"); } // TOP VISION: [2 GRAB - MULTIPLE CAVITY] OR CAN BE [1 GRAB - ONE CAVITY] // OVERALL P/FG1 ; P/F1 , TC1 ; P/F2 , TC2; P/F3 , TC3; P/F4 , TC4; P/F5 , TC5 ; P/F6 , TC6 ; CODE1 ; CODE2 ; CODE3; CODE4; CODE5; CODE6: {No Spacing & new line} // OVERALL P/FG2 ; P/F1 , TC1 ; P/F2 , TC2; P/F3 , TC3; P/F4 , TC4; P/F5 , TC5; P/F6 , TC6: {No Spacing & new line } // IMAGE_NAME_G1; IMAGE_NAME_G2 \r {No Spacing with new line } string result = string.Format("{0};{1}{2}:{3};{4}:{5};{6}\r",OverallG1, UnitDateG1, CodeDataG1, OverallG2, UnitDateG2, ImageNameG1, ImageNameG2); return result; } } public class Program { public static void Main(string[] args) { Car Ford = new Car(); // Create an object of the Car Class (this will call the constructor) Console.WriteLine(Ford.RandomPF(GENERATE_RESULT_MODE.Random)); // Print the value of model //Your code goes here //Console.WriteLine("Hello, world!"); } } }
run
|
edit
|
history
|
help
-1
calc
Can a == true && a == false be true in C#?
xpath select element code
Sort A List : Print the sorted list of ages of the students
4647
asxasxd
Watch Jurassic World Dominion Online Free
1
credentials
zasasasa