/
WorkHours.cs
55 lines (47 loc) · 1.73 KB
/
WorkHours.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
using System;
namespace WorkHours
{
internal class WorkHours
{
private static void Main(string[] args)
{
#region Tests
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine("Testing with the example variables!");
int[] rHV = new int[] { 60, 1, 240, 10, 21 };
int[] dNV = new int[] { 6, 1, 10, 10, 10 };
int[] pV = new int[] { 75, 100, 100, 10, 10 };
for (int i = 0; i <= rHV.GetUpperBound(0); i++)
{
Console.WriteLine("\nInput: Required hours:{0} Days Available:{1} Productivity:{2}",rHV[i],dNV[i],pV[i]);
Console.WriteLine("Result:");
result(calcHours(dNV[i], pV[i]), rHV[i]);
}
Console.WriteLine("\nTest end!\n");
Console.ForegroundColor = ConsoleColor.White;
#endregion
int requiredHours = int.Parse(Console.ReadLine());
int daysNeeded = int.Parse(Console.ReadLine());
int productivity = int.Parse(Console.ReadLine());
result(calcHours(daysNeeded, productivity), requiredHours);
}
private static double calcHours(int daysN, int prod)
{
double result = (((double)daysN * 0.9) * 12) * prod / 100;
return result;
}
private static void result(double hoursA, double reqH)
{
if (hoursA < reqH)
{
Console.WriteLine("No");
Console.WriteLine((int)(hoursA - reqH));
}
else
{
Console.WriteLine("Yes");
Console.WriteLine((int)(hoursA - reqH));
}
}
}
}