<mosaic.cnfolio.com>
PROGRAM
1. /*Samuel David Smyth
2.   Student No. 809997*/
3.
4. /* PSEUDO CODE
5.
6. START
7.    Define the variables
8.       Pidgey
9.       Candy
10.       Experience per evolution, equal to 1000
11.       Potential Evolutions, the amount of evolutions that are possible with the amount of candy the user has
12.       Executable Evolutions, the amount of evolutions the user can actually peform
13.       Total Experience
14.
16.       Pidgey value
17.       Candy value
18.
19.    Candies divided by 12, rounded down to the nearest integer equals Potential Evolutions
20.
21.    IF Potential Evolutions are less than or equal to Pidgey value
22.       THEN
23.          Set Executable Evolutions equal to Potential Evolutions
24.    ELSE IF Potential Evolutions are greater than the Pidgey value
25.       THEN
26.          Set Executable Evolutions equal to Pidgey value
27.    END IF
28.
29.    Set the Total Experience value equal to the Executable Evolutions multiplied by the Experience value
30.
31.    WHEN the Pidgey input value is 0, display warning message
32.
33.    WHEN the Candy value is 0, display warning message
34.
35.    IF Executable Evolutions are equal to 0 and the Pidgey value is greater than or equal to 1)
36.       THEN
37.          Display a message informing the user that they cannot perform any evolutions
38.    END IF
39.
40.    IF Executable Evolutions are greater than or equal to 1 and less than 55
41.       THEN
42.          Display a message informing the user how much XP they can earn
43.    ELSE IF Executable Evolutions are greater than or equal to 55 and less than 69
44.       THEN
45.          Display a message informing the user how much XP they can earn, and warning them that they are close to exceeding the maximum evolutions possible with 1 egg
46.    ELSE IF Executable Evolutions are greater than or equal to 69 and less than 100
47.       THEN
48.          Display a message informing the user of the xp they can earn, and that they have exceeded the evolutions possible with 1 egg, suggesting they use another
49.    ELSE IF Executable Evolutions are greater than or equal to 100 and less than 138
50.       THEN
51.          Display a message informing the user of the xp they can earn using 1 lucky egg, and what they could earn with 2 lucky eggs
52.    ELSE IF Executable Evolutions are greater than or equal to 138
53.       THEN
54.          Display a message informing the user that they have exceeded the maximum evolutions that can be performed with 2 lucky eggs and ask them to enter a lower value
55.    END IF
56. END
57.
58.
59. */
60.
61.
62.
63. #include <stdio.h>
64.
65.
66. int main(void)
67. {
68.    /*Define all the variables*/
69.    int Pidgey;
70.    int Candy;
71.    int Experience = 1000
72.    int Potential_Evolutions;
73.    int Executable_Evolutions;
74.    int Total_Experience;
75.
76.    /*Scan for user input*/
77.    scanf("%d %d", &Pidgey, &Candy);
78.
79.    /*Calculate potential evolutions based on candy value*/
80.    Potential_Evolutions = (Candy/12)
81.
82.    /*Finding the amount of evolutions that can actually be performed*/
83.    if (Potential_Evolutions <= Pidgey)
84.    {
85.    Executable_Evolutions = Potential_Evolutions;
86.
87.    }
88.    else if (Potential_Evolutions > Pidgey)
89.    {
90.    Executable_Evolutions = Pidgey;
91.    }
92.
93.    /*Adjusting the Total Experience value accordingly*/
94.    Total_Experience = Executable_Evolutions * Experience;
95.
96.    /*Checking for null inputs*/
97.    switch (Pidgey)
98.    {
99.    case 0: printf("You have not entered a Pidgey value, if you do not have any, get hunting!\n");
100.    }
101.    switch (Candy)
102.    {
103.    case 0: printf("You have not entered a Candy value, did you know that you can gain 3 Candies by transferring a pokemon?");
104.    }
105.
106.    /*Finding correct output values for different scenarios*/
107.    if ((Executable_Evolutions ==0) && (Pidgey >= 1))
108.    {
109.    printf("You cannot perform any evolutions right now, gain more Pidgey candy by catching wild Pidgeys and transferring them to the Professor.");
110.    }
111.
112.    if ((Executable_Evolutions >= 1) && (Executable_Evolutions < 55))
113.    {
114.    printf("You can earn a maximum of %dxp with this lucky egg.", Total_Experience)
115.    }
116.    else if ((Executable_Evolutions >=55) && (Executable_Evolutions < 69))
117.    {
118.    printf("Warning: You are very close to exceding the maximum amount of evolutions for this lucky egg.\nYou can earn a maximum of %dxp.", Total_Experience);
119.    }
120.
121.    else if ((Executable_Evolutions >=69) && (Executable_Evolutions < 100))
122.    {
123.    printf("You should be able to gain 69,000xp with this egg, or maybe consider using another egg to gain a total of %dxp", Total_Experience);
124.    }
125.    else if ((Executable_Evolutions >=100) && (Executable_Evolutions < 138))
126.    {
127.    printf("Using 2 lucky eggs, you can earn a maximum of %dxp.\n If you only have one lucky egg you can only earn a maximum of 69,000xp", Total_Experience);
128.    }
129.    else if (Executable_Evolutions >= 138)
130.    {
131.    printf ("You have exceded the maximum evolutions that can be performed with 2 lucky eggs, please enter lower values");
132.    }
133.
134.
135. }