私はこのコードを持っている:出力を印刷し、私はコストの合計を計算するために、再びそれを繰り返す必要はありません:異なる方法
public void printCost(List<c_flightRotationAircraft> fRAList,
List<c_itineraryDistFra> iDFraList, HashSet<string> distinctAircraft, HashSet<int> distinctItinerary,
List<c_position> positionList, List<c_airportAircraft> aAList, c_config config)
{
c_files f = new c_files();
double pDC = passengerDelayCost(fRAList, iDFraList, distinctItinerary, config); // Passenger delay cost
double oCC = outboundCancelCost(fRAList, iDFraList, distinctItinerary, config); // Outbound cancellation cost
double iCC = inboundCancelCost(fRAList, iDFraList, distinctItinerary, config); // Inbound cancellation cost
double cLC = cancelLegalCost(fRAList, iDFraList, distinctItinerary, config); // Cancellation Legal Compensation Cost
double dLC = delayLegalCost(fRAList, iDFraList, distinctItinerary, config); // Delay legal cost
double fOCD = flightOperatingCostDecrease(fRAList, iDFraList, distinctItinerary, config); //Penalties for non-compliant location of aircraft
/*
f.insertAircraftPositionEndRtw(distinctAircraft, fRAList, config, positionList, aAList); // inserts the aircraft in the airports (aAList) List
double pNcLA = penaltyNonCompliantLocationAircraft(fRAList, iDFraList,
distinctAircraft, positionList, aAList, config); // Penalties for non-compliant location of aircraft
*/
Console.WriteLine();
Console.WriteLine("Passenger delay cost: {0}", pDC.ToString("#.##"));
Console.WriteLine("Outbound cancellation cost: {0}", oCC.ToString("#.##"));
Console.WriteLine("Inbound cancellation cost: {0}", iCC.ToString("#.##"));
Console.WriteLine("Cancellation Legal Compensation Cost: {0}", cLC.ToString("#.##"));
Console.WriteLine("Delay legal cost: {0}", dLC.ToString("#.##"));
Console.WriteLine("Flight operating cost decrease: {0}", fOCD.ToString("#.##"));
//Console.WriteLine("Penalties for non-compliant location of aircraft: {0}", pNcLA.ToString("#.##"));
}
3を持っている簡単な方法は何をメソッド:値を計算するためのメソッド、コストを印刷するメソッド、合計コストを合計する第3のメソッド
関数(クラスも)は唯一の機能を持つ必要があります。 – IROEGBU