public void showSpread() { if (this.waveform == null){ //there is no data to display UI.println("No

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

public void showSpread() { if (this.waveform == null){ //there is no data to display UI.println("No

Post by answerhappygod »

public void showSpread() {
if (this.waveform == null){ //there is
no data to display
UI.println("No waveform
to display");
return;
}
this.display();
/*# YOUR CODE HERE */
// set min and max to max and min
double min = Double.MAX_VALUE;
double max = Double.MIN_VALUE;


// loop over this.waveform, for each
value in this.waveform:
if
(this.waveform.get(min)<min){
return;
}
// if
this.waveform.get(i); < min then set min = to value
// do the same for max
>

// draw green line for max
UI.setColor(Color.green);
// use max as y1 and y2
UI.drawLine(GRAPH_LEFT, max,
GRAPH_RIGHT, max);
//draw red line for min
UI.setColor(Color.red);
//use min for y1, y2
UI.drawLine(GRAPH_LEFT, min,
GRAPH_RIGHT, min);
}
PLEASE HELP I SUCK AT FOR LOOP STATEMENTS
Public Void Showspread If This Waveform Null There Is No Data To Display Ui Println No 1
Public Void Showspread If This Waveform Null There Is No Data To Display Ui Println No 1 (67.38 KiB) Viewed 12 times
public void showSpread() { if (this.waveform == null) { //there is no data to display UI.println("No waveform to display"); return; } this.display(); /*# YOUR CODE HERE */ // set min and max to max and min double min = Double.MAX_VALUE; double max = Double.MIN_VALUE; // loop over this.waveform, for each value in this.waveform: if (this.waveform.get(min)<min) { return; } // if this.waveform.get(i); < min then set min = to value // do the same for max > // draw green line for max UI.setColor (Color.green); // use max as y1 and y2 UI.drawLine(GRAPH_LEFT, max, GRAPH_RIGHT, max); //draw red line for min UI.setColor (Color.red); //use min for y1, y2 UI.drawLine(GRAPH_LEFT, min, GRAPH_RIGHT, min); }
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply