Working Code Awhile Cant Get Work Glut Wondering Anything Fix Include Include Graph1h Usin Q43887613


Have been working on this code for awhile and cant get it towork 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();
//Prompt for the number of points
no_points = getNoPoints();
//Prompt for the data for the points
getPoints(x, y, no_points);
//Draw the polyline
drawPolyLine(x, y, no_points);
return 0;
}
//Function Stubs Follows
int getNoPoints()
{
//Declare local variables
int no_points = 0;
//Prompt for the number of points
cout << “Please Enter Number of Points “;
cin >> no_points;
//Return the number of points
return 0;
}
void getPoints(int x[], int y[], int no_points)
{
//Declare local variables
//Using a for-loop, prompt for the coordinates ofeach point and store in arrays x and y
for (int i = 0; i < no_points; i++)
{
cout << “Please EnterCordinates for point” <<i+1;
cin >> x[i] >>y[i];
}
}
void drawPolyLine(int x[], int y[], int no_points)
{
//Declare local variables
int circle;
int line;
int drawCircle(int radius, int center_x, intcenter_y);
int drawLine(int x1, int y1, int x2, int y2, intwidth);
//Use 1 for-loop for drawing the red circle on eachpoint
for (int p = 0; p < no_points; p++)
{
circle = drawCircle(5, x[p],y[p]);
setColor(circle, 255, 0, 0);
}
//Use a second for-loop for drawing the lines -remember there is always one less line than there are points!
for (int w = 0; w < no_points – 1; w++)
{
line = drawLine(x[w], y[w], x[w +1], y[w + 1], 1); //std function to draw line
}
}
Write a C++ program that draws a polyline. A polyline is defined as: A series of conected line segments that are treated as a single object A polyline has the following properties: 1. The number of points are one greater the number of line segments 2. Each point is also an endpoint of a segment. This program will prompt the user for the following data: 1. Prompt the user for the number of points the polyline contains. 2. Prompts the user for the x/y coordinates for the each point Example for the data input prompts are shown below: Enter # of points: 6 Enter x/y coord for Point #1: 10 25 Enter x/y coord for Point #2: 50 65 Enter x/y coord for Point #3: 100 175 Enter x/y coord for Point #4: 200 235 Enter x/y coord for Point #5: 300 275 Enter x/y coord for Point #6: 450 395 Your program will store the x/y coordinates in parallel arrays and then draw a red circle (radius of 5) centered on each point. Your program will then draw a yellow line between each point. An example of each point is shown below: C++ Graphics Show transcribed image text Write a C++ program that draws a polyline. A polyline is defined as: A series of conected line segments that are treated as a single object A polyline has the following properties: 1. The number of points are one greater the number of line segments 2. Each point is also an endpoint of a segment. This program will prompt the user for the following data: 1. Prompt the user for the number of points the polyline contains. 2. Prompts the user for the x/y coordinates for the each point Example for the data input prompts are shown below: Enter # of points: 6 Enter x/y coord for Point #1: 10 25 Enter x/y coord for Point #2: 50 65 Enter x/y coord for Point #3: 100 175 Enter x/y coord for Point #4: 200 235 Enter x/y coord for Point #5: 300 275 Enter x/y coord for Point #6: 450 395 Your program will store the x/y coordinates in parallel arrays and then draw a red circle (radius of 5) centered on each point. Your program will then draw a yellow line between each point. An example of each point is shown below:
C++ Graphics
Expert Answer
Answer to Have been working on this code for awhile and cant get it to work with Glut. Wondering if there is anything I can fix #i…
Working Git Created Hello World Project Repository Project Repository Must Meet Criteria Q43840273
- working Git. created a Hello World project and repository yourproject repository must meet the criteria below.
- The Java code must compile and run without error, printing ahello message to the terminal.
- The repository must have a feature branch on which the work wasdone, which has been merged into the master. (Check with ‘gitbranch’ – your feature branch should be listed.)
- There must be at least 2 commits with feature work, beyondinitializing the project. (Check with ‘git log’)
- Your commits must have descriptive messages.
- Your commits must have timestamps from this quarter.
- Your name and email address must be set up in your Gitinstallation. (Look at the Author line in ‘git log’)
- The repository must be clean with no uncommitted changes. (Whenyou do ‘git status’ it should say “On branch master, nothing tocommit, working tree clean”)
Expert Answer
Answer to working Git. created a Hello World project and repository your project repository must meet the criteria below. The Jav…
Working Matlab Need Code Perform Task Digitalpin2 Pressed Button Turn Two Green Leds One R Q43823377
I am working in MATLAB and need my code to perform the task thatwhen DigitalPin2 is pressed (a button) it will turn on two greenLEDs and one red LED then after 120 seconds if another button ispressed (DigitalPin7) the same LEDs will remain lit for anadditional 10 seconds. I am having problems with MATLAB not readingtwo buttons at once and not being able to “unpress” or turnoff abutton once pushed. The following is my current code. Thanks
a = arduino;
while 1==1
DigitalPin2 = readDigitalPin (a, ‘D2’);
DigitalPin3 = readDigitalPin (a, ‘D3’);
DigitalPin7 = readDigitalPin (a, ‘D7’);
if DigitalPin2 == 1
for i=1:10000000000000000
%writeDigitalPin(a, ‘D7’, 0);
writeDigitalPin(a, ‘D13’, 0);
writeDigitalPin(a, ‘D5’, 1);
writeDigitalPin(a, ‘D11’, 1);
writeDigitalPin(a, ‘D10’, 1);
pause (120);
if DigitalPin7 == 1
writeDigitalPin(a, ‘D13’, 0);
writeDigitalPin(a, ‘D5’, 1);
writeDigitalPin(a, ‘D11’, 1);
writeDigitalPin(a, ‘D10’, 1);
pause (10);
else
writeDigitalPin(a, ‘D11’, 0);
writeDigitalPin(a, ‘D5’, 0);
writeDigitalPin(a, ‘D10’, 1);
writeDigitalPin(a, ‘D12’, 1);
writeDigitalPin(a, ‘D6’, 1);
pause (10);
writeDigitalPin(a, ‘D6’, 0);
writeDigitalPin(a, ‘D12’, 0);
writeDigitalPin(a, ‘D10’, 1);
writeDigitalPin(a, ‘D13’, 1);
%writeDigitalPin(a, ‘D7’, 1);
pause(5);
writeDigitalPin(a, ‘D10’, 0);
writeDigitalPin(a, ‘D8’, 1);
writeDigitalPin(a, ‘D13’, 1);
%writeDigitalPin(a, ‘D7’, 1);
pause(60);
writeDigitalPin(a, ‘D8’, 0);
writeDigitalPin(a, ‘D9’, 1);
writeDigitalPin(a, ‘D13’, 1);
%writeDigitalPin(a, ‘D7’, 1);
pause(10);
writeDigitalPin(a, ‘D9’, 0);
writeDigitalPin(a, ‘D10’, 1);
writeDigitalPin(a, ‘D13’, 1);
%writeDigitalPin(a, ‘D7’, 1);
pause(5);
end
end
elseif DigitalPin3 == 1
for i=1:10000000000000000
%writeDigitalPin(a, ‘D7’, 0);
writeDigitalPin(a, ‘D13’, 0);
writeDigitalPin(a, ‘D5’, 1);
writeDigitalPin(a, ‘D11’, 1);
writeDigitalPin(a, ‘D10’, 1);
pause (240);
writeDigitalPin(a, ‘D11’, 0);
writeDigitalPin(a, ‘D5’, 0);
writeDigitalPin(a, ‘D10’, 1);
writeDigitalPin(a, ‘D12’, 1);
writeDigitalPin(a, ‘D6’, 1);
pause (10);
writeDigitalPin(a, ‘D6’, 0);
writeDigitalPin(a, ‘D12’, 0);
writeDigitalPin(a, ‘D10’, 1);
writeDigitalPin(a, ‘D13’, 1);
%writeDigitalPin(a, ‘D7’, 1);
pause(5);
writeDigitalPin(a, ‘D10’, 0);
writeDigitalPin(a, ‘D8’, 1);
writeDigitalPin(a, ‘D13’, 1);
%writeDigitalPin(a, ‘D7’, 1);
pause(60);
writeDigitalPin(a, ‘D8’, 0);
writeDigitalPin(a, ‘D9’, 1);
writeDigitalPin(a, ‘D13’, 1);
%writeDigitalPin(a, ‘D7’, 1);
pause(10);
writeDigitalPin(a, ‘D9’, 0);
writeDigitalPin(a, ‘D10’, 1);
writeDigitalPin(a, ‘D13’, 1);
%writeDigitalPin(a, ‘D7’, 1);
pause(5);
end
else (DigitalPin3 & DigitalPin2) == 0
writeDigitalPin(a, ‘D5’, 0);
writeDigitalPin(a, ‘D6’, 0);
%writeDigitalPin(a, ‘D7’, 0);
writeDigitalPin(a, ‘D8’, 0);
writeDigitalPin(a, ‘D9’, 0);
writeDigitalPin(a, ‘D10’, 0);
writeDigitalPin(a, ‘D11’, 0);
writeDigitalPin(a, ‘D12’, 0);
writeDigitalPin(a, ‘D13’, 0);
end
end
Expert Answer
Answer to I am working in MATLAB and need my code to perform the task that when DigitalPin2 is pressed (a button) it will turn on …
Working Microsoft Word Assignments Ever Think Need Know Stuff Review Keys Future Align Wor Q43861483
While working on the Microsoft Word assignments did your everthink to yourself “Why do I need to know this stuff?” Review “Keysto the Future: Align Workforce Readiness Skills to Ensure StudentSuccess.” After reading the linked white paper, discuss threereasons it is essential for you to attain and enhance yourMicrosoft Office skills.
Expert Answer
Answer to While working on the Microsoft Word assignments did your ever think to yourself “Why do I need to know this stuff?”…
Working Oracle Sql Describe Detail Identifying Anomalies Missing Value Easily Look Determ Q43905992
When working with Oracle or SQL describe in detail onidentifying anomalies? If there is a missing value then you caneasily look for. But how do you determine if an entry is an anomalyor not?
Thanks.
Expert Answer
Answer to When working with Oracle or SQL describe in detail on identifying anomalies? If there is a missing value then you can ea…
Working Problem Set R Must Make Function Take Three Arguments Print Sum Squared Errors Tex Q43881646
I am working on a problem set in R, where I must make a functionthat will take three arguments and print the sum of squared errors.The text-problem is as following:
Write function called `model_score_int`.`model_score_int` should take three arguments: (1)a guess for the intercept, (2) a vector ofx’s, and (3) a vector of y’s. Thefunction should use the guess for the intercept to calculate theslope that passes through the point (mean(x),mean(y)). Remember that you given two points can calculatethe slope as (Y2-Y1) / (X2-X1). Using the linedefined by the intercept passed to the function and the calculatedslope as your prediction rule, calculate the sum of squarederrors for the data given by x andy.
My code for the function so far is:
model_score_int <- function(intercept, x, y) {
b1 <- ((y[2]-y[1])/(x[2]-x[1]))
e <- y – b1
sum(e^2)
But when I run it with values I get ‘Inf’ as output. Please helpme make a function that can calculate it correct!
}
Expert Answer
Answer to I am working on a problem set in R, where I must make a function that will take three arguments and print the sum of sq…
Working Properly Program Functions Import Convertmf Convertfm Def Main Length Input Enter Q43780063

Here is what I have and it is not working properly:
program:
from functions import (convertmf, convertfm)
def main():
length = (input(‘Enter the length to convert: ‘))
choice = (input(‘Enter M or F to convert enterted value to Metersor Feet: ‘))
if choice==F:
print(‘The length’, length,’Meters convertsto’,functions.convertmf(choice),’Feet.’,format(length,convertmf,’.2f’))
elif choice==M:
print(‘The length’, length, ‘Feet convertsto’,functions.convertfm(choice),’Feet.’,format(length,convertfm,’.2f’))
else:
print(‘Error: invalid selection.’)
main()
functions:
#the formula for converting feet to meters is feet =meters/0.3048
#the formula for converting meters to feet is meters= feet *0.3048
def convertmf(choice):
return length*0.3048
def convertfm(choice):
return length/0.3048
The total is 649 3. Create a custom Python module named functions.py. This module must contain two functions: one that converts from Feet to Meters and one that converts from Meters to Feet. These functions must be named convertmf (used when Fis selected) and convertfm ( used when M is selected). Write a program named program53.py, which imports the functions from module functions.py. The program’s main() should prompt the user to specify M or Fas choices then call the appropriate function which was imported. Conversion accuracy should use full precision ( 5 decimal places ) for the calculations, and display then print the result to two decimal places. Enter the length to convert: 25.75 Enter Mor F to convert enterted value to Meters or Feet: M The length 25.75 Feet converts to 7.85 Meters. Enter the length to convert: 25.75 Enter M or F to convert enterted value to Meters or Feet: F The length 25.75 Meters converts to 84.48 Feet. Tip: Use the import keyword: import functions from * . The call the functions, would be functionname() Show transcribed image text The total is 649 3. Create a custom Python module named functions.py. This module must contain two functions: one that converts from Feet to Meters and one that converts from Meters to Feet. These functions must be named convertmf (used when Fis selected) and convertfm ( used when M is selected). Write a program named program53.py, which imports the functions from module functions.py. The program’s main() should prompt the user to specify M or Fas choices then call the appropriate function which was imported. Conversion accuracy should use full precision ( 5 decimal places ) for the calculations, and display then print the result to two decimal places. Enter the length to convert: 25.75 Enter Mor F to convert enterted value to Meters or Feet: M The length 25.75 Feet converts to 7.85 Meters. Enter the length to convert: 25.75 Enter M or F to convert enterted value to Meters or Feet: F The length 25.75 Meters converts to 84.48 Feet. Tip: Use the import keyword: import functions from * . The call the functions, would be functionname()
Expert Answer
Answer to Here is what I have and it is not working properly: program: from functions import (convertmf, convertfm) def main(): le…
Working Vba Excel Assignment Generate Age Based User S Input Either Min Max Input User Pro Q43902920
I am working in VBA excel. The assignment is to generate agebased on user’s input from either in the min/max input the user hasprovided.
I have thus far created the conditions in the forms however inthe models,
the definition is where I need help:
Here I need to edit the current the code below to generate therequested code as shown above in each of it’s condition. PLEASEHELP! ANY advice would be great!
Expert Answer
Answer to I am working in VBA excel. The assignment is to generate age based on user’s input from either in the min/max input the …
World Wide Web Originally Designed Stateless Entity However Time Identified Stateful Relat Q43789076
A) The World Wide Web was originally designed as a statelessentity. However, over time it was identified that a statefulrelationship between a web client and a web server can benefit inmany ways including e-commerce, collecting web behaviour of webusers etc. The cookie mechanism was introduced for this purpose. Inyour lecture slides (week-8 to week-9), the following diagramdemonstrates the use of a cookie. Explain each of the six stepsindicated in the following diagram for using the cookie in onlineshopping. 1. B) Consider a scenario where an advertising companypays fees to Deakin University for including banner ads in Deakin’sweb site, i.e., an image presenting an advertisement of a productfrom a manufacturer which is linked to the manufacturer’s webserver. Deakin receives payment from the advertising company basedon the number of visits by its users to the manufacturer’s website. The advertising company gets payment from the manufacturerbased on the number of times the advertisement is displayed.Prepare a diagram illustrating how the cookie is used whenretrieving a Deakin web page containing an advertisement and thentracking the users of Deakin’s web site visiting the manufacturer’sweb site by clicking on an advertisement. Explain the steps in yourdiagram.
Expert Answer
Answer to A) The World Wide Web was originally designed as a stateless entity. However, over time it was identified that a statefu…
Worm Infecting Systems Exploiting Bug Popular Server Program Spreading Rapidly Systems Del Q43905071
A worm is infecting systems by exploiting a bug in a popularserver program. It is spreading rapidly, and systems where it isdeleted quickly become reinfected. A security researcher decides tolaunch a counterattack in the form of a defensive worm. Whenever abreak-in attempt comes from a remote host, the defensive wormdetects it, heads off the break-in, and exploits the same bug tospread to the attacking host. On that host, it deletes the originalworm. It then waits until that system is attacked, and the cyclerepeats.
- Many people would claim that launching a counterattack in thisscenario is ethically unacceptable. Give at least three argumentsthat support this view.
- Are there circumstances or conditions under which acounterattack would be ethically justified? Explain yourreasoning.
Expert Answer
Answer to A worm is infecting systems by exploiting a bug in a popular server program. It is spreading rapidly, and systems where …