Starting from:
$30

$24

HOMEWORK #01 solution

Version 1.2.0 - Revision Notes: Version Color




 Update on some function parameters

 Figures addad.

 Output screenshoots added.




PART I




Write a complete program that calculates




 the area of the largest circle that fits inside a rectangle, (figure 2)

 the area of the largest square that fits inside the rectangle, (figure 3)

 the area of the smallest circle that surrounds the same rectangle, (figure 3)

 the area of the smallest square that surrounds the same rectangle(figure 3).

The program gets edges of the rectangle (figure 1) and print outs the area of each circle and square. The program must use all these functions listed below. If you really need you can add more functions

but newer change the given functions return type, function name, parameters and parameter types. Never write subsitution functions.




double circle_area(double radius);

double calc_hypotenuse(int side);

double calc_hypotenuse(int side1, int side2);

double calc_radius_of_smallest_circle(int side1,int side2);

double calc_radius_of_largest_circle(int side1,int side2); double calc_area_of_smallest_circle(int side1,int side2); double calc_area_of_largest_circle(int side1,int side2); double calc_area_of_smallest_square(int side1,int side2); double calc_area_of_largest_square(int side1,int side2); double calc_area_of_square (int side);

void display_results(void);

void display_results(

double largest_circle, double largest_square, double smallest_circle, double smallest_square

);




The program must use sqrt() and pow() functions when necessary. PI = 3.14




Outputs:



















Side (1 or 2)










Side (1 or 2)
















Figure 1










Figure 4
















Figure 2

























Figure 5










Figure 3










SubmissionRule: student_no.zip




GradingPolicy:




▫ If you do not apply submission rule, you will get –20 points.

▫ In case of cheating, eachparticipant gets –100.

▫ A code which does not compile will be graded up to 30 points.




Asking rules:




 You can ask when you need help.(Turkish or English)

 Describe your problem explicitly.

 And write your solution (even half) or describe your idea. If you have no idea or even half solution don’t ask, make reserch in the internet or in the books.

 Please be polite, constructive.

 If you don’t get an answer in 48 hour check the rules.




Contact:asbayraktar@gtu.edu.tr

More products