[Solved] C Programming Language #Project 1

$25

File Name: C_Programming_Language_#Project__1.zip
File Size: 320.28 KB

SKU: [Solved] C Programming Language #Project – 1 Category: Tag:
5/5 - (1 vote)

Professor Oak who is known as Pokmon creator, lost his laboratory on a explosion because of an mischievous fire Pokmon. After so much effort, Prof. Oak rebuild his own lab but he couldnt activate Pokmon creating machine because storage of the machine has broken. Professor can do wonders with Pokmons but he doesnt know anything about software developing. Therefore, he asked students of Gebze Technical University for help to make the machine functional again. Professor send an image of the old machines control panel that is shown below:

You are expected to code a function for each menu option. Write the code of the functions that

are shown below by obeying given function prototypes.

Part 1. Write a function that takes shape of the Pokmon as an input and calculates area of the shape and returns it. Parameters that are used to calculate the area of the shape must be taken from the user in the function. Number of the parameters can be changed according to the shape of the Pokmon. The shapes could be rectangular, square or circular and all the shape types must be pre-defined on the program like: Square is 1, rectangular is 2 and circular is 3. The function prototype is:

double CreateBody (int shape)

Part 2. Write a function that takes a color code as an integer input to paint the Pokmon and returns revised color code. If the color code is between 0

Page 1 of 3

and 1000 then the function returns modulo five of the code, otherwise, it always returns 1 as the revised color code. The colors could be red, yellow, blue, black or white and all the colors must be pre- defined on the program like: red is 0, yellow is 1, blue is 2, black is 3 and white is

  1. The function prototype is:

int SetColor (int color)

Part 3. Write a function that takes shape and size of the body as an input and calculates length of one move of the Pokmon and returns the length. The length of one move is equal to perimeter of the body (Assume that the shorter edge is 5 if the shape is rectangular). The function prototype is:

double LoadMoves(int shape, double body_size)

Part 4. Write a function that specifies attack power of the Pokmon. It takes lower and upper bound of the attack power and generates a random integer attack power between the bounds and returns the power. The function prototype is:

int SetAtackPower(int lower_bound, int upper_bound)

Part 5. Write a function that prints created Pokmon with its wonderful specifications like the figure that is shown below:

(Rectangular Pokmon example)

XXXXXXX

XXXXXXX

XXXXXXX

XXXXXXX

XXXXXXX

Name: Rectangular Pokmon

Size: 35

Color: Red

Move: 24

Attack Power: 78

(Circular Pokmon example)

X

X X

X

Name: Circular Pokmon

Size: 28.26

Color: Blue

Move: 18.84

Attack Power: 102

As you notice, the shapes of the Pokmons are dynamic and that means you should print them according to their size. On the figure that is shown above, the function prints Xs by the length of the edges on vertical and horizontal direction (Assume that the shorter edge is 5 if the shape is rectangular). If the shape is

Page 2 of 3

circular then put tabs between two Xs which are on the middle of the shape as much as minus one of the radius of the shape, and align the other rows as expected by using the middle row. The function prototype is:

void ShowPokemon(int shape, double body_size, int color,

double move_length, int attack_power)

The main function must be li ke as shown above:

int main ()

{

int shape, color, attack_power; double size_of_body, move_length; shape = RECTENGULAR / CIRCULAR / SQUARE // Pick one of them size_of_ body = CreateBody (shape) color = 798

color = SetColor(color) move_length = LoadMoves(shape, size_of_body) attack_power = SetAttackPower (0, 150)

ShowPokemon(shape, size_of_body, color, move_length, attack_power)

}

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] C Programming Language #Project 1
$25