Square Me Up Code in C language

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Square Me Up

Code in C language

point.h code
// WARNING: Do not change this file.
// Doing so will nullify your score for the activity.
typedef struct {
  int x;
  int y;
} Point;

 

rectangle.h code

// WARNING: Do not change this file.
// Doing so will nullify your score for the activity.
#include "point.h"

typedef struct {
  Point upp_rig;
  Point low_lef;
} Rectangle;

main.c
point.h
rectangle.h
< > +C
Tests
Executions
5. Square Me Up
1 // WARNING: Do not add, remove, or change anything before the line 19 of this file.
2 // Doing so will nullify your score for the activity.
by Jay Vince Serato
CE Run Tests
Everyone knows that a square is just a rectangle whose length and width are the
4 #include <stdio.h>
same.
5 #include "rectangle.h"
Test Cases
Rectangle get square(Point p, int len);
Given a point that represents the square's lower-left point and a value of the side, find
the second point and eventually return an instance of a rectangle that has two points.
O Test Case 1
9 - int mainO {
int ll_x, lLy, side;
printf("Enter Lower-left point's X: ");
scanf("%d", &1lx);
printf("Enter lower-left point's Y: ");
scanf("%d", &1Ly);
printf("Enter length of side: ");
scanf("%d", &side);
10
11
Your Output
Input
12
13
No Output
1. LL Point's X-Coordinate
14
15
Expected Output
2. LL Point's Y-Coordinate
3. Length of Side
18
Enter lower-left point's X: 2
// TODO: Initialize the point here
// Point ...
19
Enter lower-left point's Y: 3
Output
Enter length of side: 7
// TODO: Call the get_square here
Rectangle rect
Rectangle's upper-right point: (9, 10)
---;
Enter lower-left point's X: 2
Enter lower-left point's Y: 3
printf("\nRectangle's upper-right point: (%d, %d)", rect.upp_rig.x, rect.upp_rig.y);
Enter length of side: 7
return 0;
O Test Case 2
Rectangle's upper-right point: (9, 10)
28 }
29
// TODO implement get_square
31- Rectangle get_square(Point p, int len) {
32
30
O Test Case 3
33 }
O Test Case 4
O Test Case 5
Hidden
O Test Case 6 Hidden
Transcribed Image Text:main.c point.h rectangle.h < > +C Tests Executions 5. Square Me Up 1 // WARNING: Do not add, remove, or change anything before the line 19 of this file. 2 // Doing so will nullify your score for the activity. by Jay Vince Serato CE Run Tests Everyone knows that a square is just a rectangle whose length and width are the 4 #include <stdio.h> same. 5 #include "rectangle.h" Test Cases Rectangle get square(Point p, int len); Given a point that represents the square's lower-left point and a value of the side, find the second point and eventually return an instance of a rectangle that has two points. O Test Case 1 9 - int mainO { int ll_x, lLy, side; printf("Enter Lower-left point's X: "); scanf("%d", &1lx); printf("Enter lower-left point's Y: "); scanf("%d", &1Ly); printf("Enter length of side: "); scanf("%d", &side); 10 11 Your Output Input 12 13 No Output 1. LL Point's X-Coordinate 14 15 Expected Output 2. LL Point's Y-Coordinate 3. Length of Side 18 Enter lower-left point's X: 2 // TODO: Initialize the point here // Point ... 19 Enter lower-left point's Y: 3 Output Enter length of side: 7 // TODO: Call the get_square here Rectangle rect Rectangle's upper-right point: (9, 10) ---; Enter lower-left point's X: 2 Enter lower-left point's Y: 3 printf("\nRectangle's upper-right point: (%d, %d)", rect.upp_rig.x, rect.upp_rig.y); Enter length of side: 7 return 0; O Test Case 2 Rectangle's upper-right point: (9, 10) 28 } 29 // TODO implement get_square 31- Rectangle get_square(Point p, int len) { 32 30 O Test Case 3 33 } O Test Case 4 O Test Case 5 Hidden O Test Case 6 Hidden
Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY