/* 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.
$ Q circle.cpp
/* 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; }
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
Log on. Move to cs202 directory (use 'cd'). Copy the programs circle.cpp : /* Program: circle.cpp...
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...
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...
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...
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...
Have been working on this code for awhile and cant get it to
work with Glut. Wondering if there is anything I can fix
#include <iostream>
#include "graph1.h"
using namespace std;
//Add Function Prototypes Here
int getNoPoints();
void getPoints(int x[], int y[], int no_points);
void drawPolyLine(int x[], int y[], int no_points);
int main()
{
//Variable Declaration/Initialization
int no_points = 0;
const int MAX_POINTS = 10;
int x[MAX_POINTS];
int y[MAX_POINTS];
//Display Graphics Window
displayGraphics();...
Assignment Λ You shall write a Java program that accepts 5 command-line arguments and generates an image of a Sierpinski triangle, as a 24- bit RGB PNG image file. Specifications The command-line arguments shall consist of the following 1. The width (in pixels) of the image, as a positive decimal integer 2. The height (in pixels) of the image, as a positive decimal integer 3. The minimum area (in pixels) that a triangle must have in order to be drawn,...
6.15 Program 6: Using Arrays to Count Letters in Text 1. Introduction In this program, you will practice working with arrays. Your program will read lines of text from the keyboard and use an array to track the number of times each letter occurs in the input text. You will use the contents of this array to generate a histogram (bar graph) indicating the relative frequencies of each letter entered. Test cases are available in this document. Remember, in addition...
(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....
Modify the NervousShapes program so that it displays equilateral
triangles as well as circles and rectangles. You will need to
define a Triangle class containing a single instance variable,
representing the length of one of the triangle’s sides. Have the
program create circles, rectangles, and triangles with equal
probability. Circle and Rectangle is done, please comment on your
methods so i can understand
*/
package NervousShapes;
import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;
import javax.imageio.*;
import javax.swing.*;
import javax.swing.event.*;
public class...
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...