Question

Log on. Move to cs202 directory (use 'cd'). Copy the programs circle.cpp : /* Program: circle.cpp...

  1. Log on. Move to cs202 directory (use 'cd').
  2. Copy the programs circle.cpp :
    /* Program: circle.cpp */
    
    #include "ccc_win.h"
    
    int ccc_win_main()
    {
      Point p(1, 3);
      Circle c(p,2.5);
      cwin << p << c;
      c.move(3,3);
      cwin << p << c;
      return 0;
    }
    
    Use your favorite editor to do so. Once you have typed in your program, save it with the 'save' command of your editor.
  3. When your program contains instructions to do graphics, plain 'g++' is no longer sufficient for compilation. Instead, compile program circle.cpp with the command

    $ Q circle.cpp


    'Q' does more than just compile; it compiles, links, and even runs the executable for you.
    Note the coordinate system used in the window that displays the circle. The lower left corner is (-10, -10) and the upper right corner is at (10, 10). The origin (0,0) are is in the middle of the screen. Unless stated otherwise, this is the coordinated system that is being used in our other graphics programs. You can change the coordinate system with the command cwin.coord(a,b,c,d). The point (a,b) is the top left corner, and (c,d) is the bottom right corner.
  4. Compile and run line.cpp. Try changing the coordinate system.
    /* Program: line.cpp */
    
    #include "ccc_win.h"
    
    int ccc_win_main()
    {
      Point p(1, 3);
      Point q(4, 7);
      Line s(p,q);
      cwin << s ;
      s.move(2,5);
      cwin << s ;
      return 0;
    }
    
  5. Now input an integer value altitude and use a loop to write your own graphics program 'fall.cpp' that produces a graphic representation of falling object (e.g. circle). An object has initial downward velocity 0. Each second, it's velocity increases by 32 ft/sec. Plot the descent of the falling object. Note that terminal velocity is 174 ft/sec so the object's velocity cannot exceed that speed.
  6. Now modify your program to read an integer variable secondstoopen to open a parachute after n seconds. Assume the velocity decreases by 100 ft/sec after the chute opens until the downward velocity hits 17 ft/sec.
  7. Note that outside the bottom of the loop is the code for where the chutist has landed ... put a message there.
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer:-

/* Program: house.cpp */

#include "ccc_win.h"

int ccc_win_main()

{  

//points for house

Point h1(0,6), h2(6,2), h3(6,-6), h4(-6,-6), h5(-6,2);

//points for door

Point d1(-1,-3), d2(1,-3), d3(1,-6), d4(-1,-6);

//points for window1

Point w1a(3,1), w1b(5,1), w1c(5,-1), w1d(3,-1);

//points for window2

Point w2a(-5,1), w2b(-3,1), w2c(-3,-1), w2d(-5,-1);

//lines for house

Line l1(h1, h2);

Line l2(h2, h3);

Line l3(h3, h4);

Line l4(h4, h5);

Line l5(h5, h1);

Line l6(h5, h2);

//lines for door

Line l7(d1, d2);

Line l8(d2, d3);

Line l9(d1, d4);

//lines for window1

Line l10(w1a, w1b);

Line l11(w1b, w1c);

Line l12(w1c, w1d);

Line l13(w1d, w1a);

//lines for window2

Line l14(w2a, w2b);

Line l15(w2b, w2c);

Line l16(w2c, w2d);

Line l17(w2d, w2a);

//house

cwin << l1 << l2 << l3 << l4 << l5 << l6;

//door

cwin << l7 << l8 << l9;

//window1

cwin << l10 << l11 << l12 << l13;

//window2

cwin << l14 << l15 << l16 << l17;

return 0;

}

If you find any difficulty with the code, please let know know I will try for any modification in the code. Hope this answer will helps you. If you have even any small doubt, please let me know by comments. I am there to help you. Please give Thumbs Up,Thank You!! All the best

Add a comment
Know the answer?
Add Answer to:
Log on. Move to cs202 directory (use 'cd'). Copy the programs circle.cpp : /* Program: circle.cpp...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • GUI bouncing shapes program use this interface the out put of the program should be a jFr...

    GUI bouncing shapes program use this interface the out put of the program should be a jFrame with three buttons: “add triangle”, “add square” and “add circle” and a blank screen. when the user clicks any of these buttons the corresponding shape appears and starts bouncing around the screen. the shape of these shaoes and randomized and anytime the user clicks the button you should be able to keeping adding shapes on the screen while the previosus shape is bouncing...

  • (a) The velocity of a particle moving in the x - y plane is given by...

    (a) The velocity of a particle moving in the x - y plane is given by ☺ = ((-3.2t+ 9.6 t)i + (2.4t + 4.0)j) m/s, where v is in meters per second and t in seconds. The particle is at the origin of the coordinate system at t = 0 s. i. Determine the magnitude of the acceleration of the particle at t = 2.5 s. ANS: ii. Determine the position of the particle at t = 2.5 s....

  • Update the program in the bottom using C++ to fit the requirements specified in the assignment....

    Update the program in the bottom using C++ to fit the requirements specified in the assignment. Description For this assignment, you will be writing a single program that enters a loop in which each iteration prompts the user for two, single-line inputs. If the text of either one of the inputs is “quit”, the program should immediately exit. If “quit” is not found, each of these lines of input will be treated as a command line to be executed. These...

  • NOTE: ALL C PROGRAMS MUST BE DONE IN UNIX SYSTEM WITH VI EDITOR 1. Write a...

    NOTE: ALL C PROGRAMS MUST BE DONE IN UNIX SYSTEM WITH VI EDITOR 1. Write a program that asks the user to enter a U.S. dollar amount and then shows how to pay that amount using the smallest number of $20, $10, $5 and $1 bills. Save the file as dollarAmountToNotesFirstinitialLastname.c Sample output: Enter a dollar amount: 93 $20 bills: 4 $10 bills: 1 $5 bills: 0 $1 bills: 3 Hint: Divide the amount by 20 to determine the number...

  • Create one program using these three programs: 1. Payroll Calculator Need to include state tax amount...

    Create one program using these three programs: 1. Payroll Calculator Need to include state tax amount and SS amount Net pay need to reflect those amount Need to make all the amounts with 2 decimal points. Hint See line #31 - Use the programming outline/format discussed in the lecture, with proper documentation, data declaration, etc. - When asking a user for data, provide user-friendly and clear direction - Same thing for the output. - Include code and screenshot of the...

  • a) Use the Holt Blue Polynomial Regression Calculator to make a scatter diagram of these data...

    a) Use the Holt Blue Polynomial Regression Calculator to make a scatter diagram of these data By defaut. this will Inclucde the parabola of best fit along wilth the data points. Print out this graph, cut it to size. and paste it to your poper b) Use the Holt Blue Polynomial Regression Calculator to determine the equation of the (Round the coefficients of this quadratic function to two decimal places.) quocdraftic function of best t. c) Use your quadratic function...

  • create a program shape.cpp that uses classes point.h and shape.h. The program should compile using the...

    create a program shape.cpp that uses classes point.h and shape.h. The program should compile using the provided main program testShape.cpp. the provided programs should not be modified. Instructions ar egiven below. Shape class The Shape class is an abstract base class from which Rectangle and Circle are derived. bool fits_in(const Rectangle& r) is a pure virtual function that should return true if the Shape fits in the Rectangle r. void draw(void) is a pure virtual function that writes the svg...

  • writting a c program that does the following: example output • Use Descriptor I/O operations to...

    writting a c program that does the following: example output • Use Descriptor I/O operations to open the file specified as a command line argument and read at least one byte from the sequence of bytes before Hard Coded Pause Point 1. Use file system operations to remove the i-node entry for the file opened in between Hard Coded Pause Point 1 and Hard Coded Pause Point 2. You may assume the file specified on the command line will have...

  • 1. (40 pts) Note: All programs MUST run in Ubuntu. Following the example C program in...

    1. (40 pts) Note: All programs MUST run in Ubuntu. Following the example C program in Folio consisting of three files (a.c, a.h, main.c), write a C program that consists of three files mysquare.h, mysquare.c andmyMain.c. Below is the mysquare.h prototype #include <stdlib.h> #include <stdio.h> void generateNums(int *myarr, int len); void squareNums(int *myarr, int len); void printNums(int *myarr, int len); mysquare.h must contain only the function declarations (prototypes) listed above generateNums function should generate len random integers in the range...

  • System Time Calculation Objectives of this Lab: The objective of this assignment is to get used...

    System Time Calculation Objectives of this Lab: The objective of this assignment is to get used to the system time information in Linux. You will do that by writing a small program (in either C, C++ or Java) that will access system time information available from the Linux /proc directory. How to proceed with the Program: 1. Information in the /proc/uptime is available just as though the file were a regular text file. You may open the file, read out...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT