flowchartsgorskicompsci.ca/ics3u/unit1/ppt8_flowcharts.pdf · 2020. 11. 24. · flowcharts are also...
TRANSCRIPT
![Page 1: Flowchartsgorskicompsci.ca/ICS3U/Unit1/ppt8_Flowcharts.pdf · 2020. 11. 24. · Flowcharts are also useful to help you visualize the flow of a program](https://reader033.vdocuments.us/reader033/viewer/2022060815/6093f15b0a58c81ca94a68b5/html5/thumbnails/1.jpg)
FlowchartsGraphically representing the path of the program
![Page 2: Flowchartsgorskicompsci.ca/ICS3U/Unit1/ppt8_Flowcharts.pdf · 2020. 11. 24. · Flowcharts are also useful to help you visualize the flow of a program](https://reader033.vdocuments.us/reader033/viewer/2022060815/6093f15b0a58c81ca94a68b5/html5/thumbnails/2.jpg)
You’ve maybe seen some of the joke flowcharts.
![Page 3: Flowchartsgorskicompsci.ca/ICS3U/Unit1/ppt8_Flowcharts.pdf · 2020. 11. 24. · Flowcharts are also useful to help you visualize the flow of a program](https://reader033.vdocuments.us/reader033/viewer/2022060815/6093f15b0a58c81ca94a68b5/html5/thumbnails/3.jpg)
The Birthday Card that I got my sister.
![Page 4: Flowchartsgorskicompsci.ca/ICS3U/Unit1/ppt8_Flowcharts.pdf · 2020. 11. 24. · Flowcharts are also useful to help you visualize the flow of a program](https://reader033.vdocuments.us/reader033/viewer/2022060815/6093f15b0a58c81ca94a68b5/html5/thumbnails/4.jpg)
On the back:
![Page 5: Flowchartsgorskicompsci.ca/ICS3U/Unit1/ppt8_Flowcharts.pdf · 2020. 11. 24. · Flowcharts are also useful to help you visualize the flow of a program](https://reader033.vdocuments.us/reader033/viewer/2022060815/6093f15b0a58c81ca94a68b5/html5/thumbnails/5.jpg)
![Page 6: Flowchartsgorskicompsci.ca/ICS3U/Unit1/ppt8_Flowcharts.pdf · 2020. 11. 24. · Flowcharts are also useful to help you visualize the flow of a program](https://reader033.vdocuments.us/reader033/viewer/2022060815/6093f15b0a58c81ca94a68b5/html5/thumbnails/6.jpg)
That’s not what we are making.
![Page 7: Flowchartsgorskicompsci.ca/ICS3U/Unit1/ppt8_Flowcharts.pdf · 2020. 11. 24. · Flowcharts are also useful to help you visualize the flow of a program](https://reader033.vdocuments.us/reader033/viewer/2022060815/6093f15b0a58c81ca94a68b5/html5/thumbnails/7.jpg)
Flowcharts are part of the program
process.
![Page 8: Flowchartsgorskicompsci.ca/ICS3U/Unit1/ppt8_Flowcharts.pdf · 2020. 11. 24. · Flowcharts are also useful to help you visualize the flow of a program](https://reader033.vdocuments.us/reader033/viewer/2022060815/6093f15b0a58c81ca94a68b5/html5/thumbnails/8.jpg)
Flowcharts are also useful to help you
visualize the
flow of a program.
![Page 9: Flowchartsgorskicompsci.ca/ICS3U/Unit1/ppt8_Flowcharts.pdf · 2020. 11. 24. · Flowcharts are also useful to help you visualize the flow of a program](https://reader033.vdocuments.us/reader033/viewer/2022060815/6093f15b0a58c81ca94a68b5/html5/thumbnails/9.jpg)
YrsToVote = 18-Age
Start
Get Age
“Wait ” + YrsToVote
End
public VotingAge()
{
int Age = IO.inputInt (“Enter your age: “);
int YrsToVote = 18 - Age;
System.out.println(“Wait “ + YrsToVote);
}
An example:
![Page 10: Flowchartsgorskicompsci.ca/ICS3U/Unit1/ppt8_Flowcharts.pdf · 2020. 11. 24. · Flowcharts are also useful to help you visualize the flow of a program](https://reader033.vdocuments.us/reader033/viewer/2022060815/6093f15b0a58c81ca94a68b5/html5/thumbnails/10.jpg)
Oval
Start
End
public VotingAge()
{
int Age = IO.inputInt (“Enter your age: “);
int YrsToVote = 18 - Age;
System.out.println(“Wait “ + YrsToVote);
}
Terminal
• One Start and One End for each program. No more, no less.• Only holds “Start” and “End”• Only one arrow comes out of the Start. No arrows for End.
Constructor Beginning
Constructor End
![Page 11: Flowchartsgorskicompsci.ca/ICS3U/Unit1/ppt8_Flowcharts.pdf · 2020. 11. 24. · Flowcharts are also useful to help you visualize the flow of a program](https://reader033.vdocuments.us/reader033/viewer/2022060815/6093f15b0a58c81ca94a68b5/html5/thumbnails/11.jpg)
public VotingAge()
{
int Age = IO.inputInt (“Enter your age: “);
int YrsToVote = 18 - Age;
System.out.println(“Wait “ + YrsToVote);
}
Input
• Used for IO lines.• Only write “Get” + variable name• Don’t write the prompt (question)• Only one arrow comes out of it.
IO lines
Parallelogram
Get Age
![Page 12: Flowchartsgorskicompsci.ca/ICS3U/Unit1/ppt8_Flowcharts.pdf · 2020. 11. 24. · Flowcharts are also useful to help you visualize the flow of a program](https://reader033.vdocuments.us/reader033/viewer/2022060815/6093f15b0a58c81ca94a68b5/html5/thumbnails/12.jpg)
public VotingAge()
{
int Age = IO.inputInt (“Enter your age: “);
int YrsToVote = 18 - Age;
System.out.println(“Wait “ + YrsToVote);
}
Processing
• Used for Math Lines.• Leave out the variable type, but write everything else• Only one arrow comes out of it.
Math lines
Rectangle
YrsToVote = 18-Age
![Page 13: Flowchartsgorskicompsci.ca/ICS3U/Unit1/ppt8_Flowcharts.pdf · 2020. 11. 24. · Flowcharts are also useful to help you visualize the flow of a program](https://reader033.vdocuments.us/reader033/viewer/2022060815/6093f15b0a58c81ca94a68b5/html5/thumbnails/13.jpg)
public VotingAge()
{
int Age = IO.inputInt (“Enter your age: “);
int YrsToVote = 18 - Age;
System.out.println(“Wait “ + YrsToVote);
}
Output
• Used for System.out.println lines.• Leave out the System.out.println(); but write everything else• Only one arrow comes out of it.
System.out lines
“Wait ” + YrsToVote
Pencil
![Page 14: Flowchartsgorskicompsci.ca/ICS3U/Unit1/ppt8_Flowcharts.pdf · 2020. 11. 24. · Flowcharts are also useful to help you visualize the flow of a program](https://reader033.vdocuments.us/reader033/viewer/2022060815/6093f15b0a58c81ca94a68b5/html5/thumbnails/14.jpg)
Terminal: start, end
Input: IO keyboard input
There is only one startand one end.
Arrows connect the pieces.
Flow is up to downor left to right.
Lines do not cross.
No shape can have more than 1 arrow come out of it.
Process: calculations
Output: System.out
Shape Formal: informal
RulesFlowchart Summary
![Page 15: Flowchartsgorskicompsci.ca/ICS3U/Unit1/ppt8_Flowcharts.pdf · 2020. 11. 24. · Flowcharts are also useful to help you visualize the flow of a program](https://reader033.vdocuments.us/reader033/viewer/2022060815/6093f15b0a58c81ca94a68b5/html5/thumbnails/15.jpg)
input
displayoutput
calculation
start/end
![Page 16: Flowchartsgorskicompsci.ca/ICS3U/Unit1/ppt8_Flowcharts.pdf · 2020. 11. 24. · Flowcharts are also useful to help you visualize the flow of a program](https://reader033.vdocuments.us/reader033/viewer/2022060815/6093f15b0a58c81ca94a68b5/html5/thumbnails/16.jpg)
Make a flowchart for this code:
Start at the
beginning
public Mark() {int mark = IO.inputInt("What was your test mark? ");int total = IO.inputInt("What was the test total? ");int per = mark*100/total;System.out.println("That was "+per+"%");System.out.println("Good job!");
}
12345
![Page 17: Flowchartsgorskicompsci.ca/ICS3U/Unit1/ppt8_Flowcharts.pdf · 2020. 11. 24. · Flowcharts are also useful to help you visualize the flow of a program](https://reader033.vdocuments.us/reader033/viewer/2022060815/6093f15b0a58c81ca94a68b5/html5/thumbnails/17.jpg)
Start
Make a flowchart for this code:
What shape works for the
next line?
public Mark() {int mark = IO.inputInt("What was your test mark? ");int total = IO.inputInt("What was the test total? ");int per = mark*100/total;System.out.println("That was "+per+"%");System.out.println("Good job!");
}
12345
![Page 18: Flowchartsgorskicompsci.ca/ICS3U/Unit1/ppt8_Flowcharts.pdf · 2020. 11. 24. · Flowcharts are also useful to help you visualize the flow of a program](https://reader033.vdocuments.us/reader033/viewer/2022060815/6093f15b0a58c81ca94a68b5/html5/thumbnails/18.jpg)
Start
Get mark
Make a flowchart for this code:
And line two?
public Mark() {int mark = IO.inputInt("What was your test mark? ");int total = IO.inputInt("What was the test total? ");int per = mark*100/total;System.out.println("That was "+per+"%");System.out.println("Good job!");
}
12345
![Page 19: Flowchartsgorskicompsci.ca/ICS3U/Unit1/ppt8_Flowcharts.pdf · 2020. 11. 24. · Flowcharts are also useful to help you visualize the flow of a program](https://reader033.vdocuments.us/reader033/viewer/2022060815/6093f15b0a58c81ca94a68b5/html5/thumbnails/19.jpg)
Start
Get mark
Get total
Make a flowchart for this code:
What happens
inbetweenline 2 & 3?
public Mark() {int mark = IO.inputInt("What was your test mark? ");int total = IO.inputInt("What was the test total? ");int per = mark*100/total;System.out.println("That was "+per+"%");System.out.println("Good job!");
}
12345
![Page 20: Flowchartsgorskicompsci.ca/ICS3U/Unit1/ppt8_Flowcharts.pdf · 2020. 11. 24. · Flowcharts are also useful to help you visualize the flow of a program](https://reader033.vdocuments.us/reader033/viewer/2022060815/6093f15b0a58c81ca94a68b5/html5/thumbnails/20.jpg)
Start
Get mark
Per = mark*100/total
Get total
Make a flowchart for this code:
What shape is needed for line 3?
public Mark() {int mark = IO.inputInt("What was your test mark? ");int total = IO.inputInt("What was the test total? ");int per = mark*100/total;System.out.println("That was "+per+"%");System.out.println("Good job!");
}
12345
![Page 21: Flowchartsgorskicompsci.ca/ICS3U/Unit1/ppt8_Flowcharts.pdf · 2020. 11. 24. · Flowcharts are also useful to help you visualize the flow of a program](https://reader033.vdocuments.us/reader033/viewer/2022060815/6093f15b0a58c81ca94a68b5/html5/thumbnails/21.jpg)
Start
Get mark
“That was “ + per + “%”
Get total
Make a flowchart for this code:
What shape for
line 4?
public Mark() {int mark = IO.inputInt("What was your test mark? ");int total = IO.inputInt("What was the test total? ");int per = mark*100/total;System.out.println("That was "+per+"%");System.out.println("Good job!");
}
12345
Per = mark*100/total
![Page 22: Flowchartsgorskicompsci.ca/ICS3U/Unit1/ppt8_Flowcharts.pdf · 2020. 11. 24. · Flowcharts are also useful to help you visualize the flow of a program](https://reader033.vdocuments.us/reader033/viewer/2022060815/6093f15b0a58c81ca94a68b5/html5/thumbnails/22.jpg)
Start
Get mark
Get total
“Good Job”
Make a flowchart for this code:
How does it end?
public Mark() {int mark = IO.inputInt("What was your test mark? ");int total = IO.inputInt("What was the test total? ");int per = mark*100/total;System.out.println("That was "+per+"%");System.out.println("Good job!");
}
12345
“That was “ + per + “%”
Per = mark*100/total
![Page 23: Flowchartsgorskicompsci.ca/ICS3U/Unit1/ppt8_Flowcharts.pdf · 2020. 11. 24. · Flowcharts are also useful to help you visualize the flow of a program](https://reader033.vdocuments.us/reader033/viewer/2022060815/6093f15b0a58c81ca94a68b5/html5/thumbnails/23.jpg)
Start
Get mark
Get total
End
Make a flowchart for this code:
That’s all.
Gold star
public Mark() {int mark = IO.inputInt("What was your test mark? ");int total = IO.inputInt("What was the test total? ");int per = mark*100/total;System.out.println("That was "+per+"%");System.out.println("Good job!");
}
12345
“Good Job”
“That was “ + per + “%”
Per = mark*100/total
![Page 24: Flowchartsgorskicompsci.ca/ICS3U/Unit1/ppt8_Flowcharts.pdf · 2020. 11. 24. · Flowcharts are also useful to help you visualize the flow of a program](https://reader033.vdocuments.us/reader033/viewer/2022060815/6093f15b0a58c81ca94a68b5/html5/thumbnails/24.jpg)
Let’s try another.
![Page 25: Flowchartsgorskicompsci.ca/ICS3U/Unit1/ppt8_Flowcharts.pdf · 2020. 11. 24. · Flowcharts are also useful to help you visualize the flow of a program](https://reader033.vdocuments.us/reader033/viewer/2022060815/6093f15b0a58c81ca94a68b5/html5/thumbnails/25.jpg)
Make a flowchart for this output:
Start at the beginning
Cylinder Surface Area and Volume
Height: 4.2Radius: 3.4
The surface area is 99.04 The volume is 152.5317
![Page 26: Flowchartsgorskicompsci.ca/ICS3U/Unit1/ppt8_Flowcharts.pdf · 2020. 11. 24. · Flowcharts are also useful to help you visualize the flow of a program](https://reader033.vdocuments.us/reader033/viewer/2022060815/6093f15b0a58c81ca94a68b5/html5/thumbnails/26.jpg)
Start
Make a flowchart for this output:
What shape is line 1?
Cylinder Surface Area and Volume
Height: 4.2Radius: 3.4
The surface area is 99.04 The volume is 152.5317
![Page 27: Flowchartsgorskicompsci.ca/ICS3U/Unit1/ppt8_Flowcharts.pdf · 2020. 11. 24. · Flowcharts are also useful to help you visualize the flow of a program](https://reader033.vdocuments.us/reader033/viewer/2022060815/6093f15b0a58c81ca94a68b5/html5/thumbnails/27.jpg)
Start
Make a flowchart for this output:
What shape are the next
2 lines? (2&3)
Cylinder Surface Area and Volume
Height: 4.2Radius: 3.4
The surface area is 99.04 The volume is 152.5317
Print title
![Page 28: Flowchartsgorskicompsci.ca/ICS3U/Unit1/ppt8_Flowcharts.pdf · 2020. 11. 24. · Flowcharts are also useful to help you visualize the flow of a program](https://reader033.vdocuments.us/reader033/viewer/2022060815/6093f15b0a58c81ca94a68b5/html5/thumbnails/28.jpg)
StartGet
heightGet
radius
Make a flowchart for this output:
What about the last two lines?
Cylinder Surface Area and Volume
Height: 4.2Radius: 3.4
The surface area is 99.04 The volume is 152.5317
Print title
![Page 29: Flowchartsgorskicompsci.ca/ICS3U/Unit1/ppt8_Flowcharts.pdf · 2020. 11. 24. · Flowcharts are also useful to help you visualize the flow of a program](https://reader033.vdocuments.us/reader033/viewer/2022060815/6093f15b0a58c81ca94a68b5/html5/thumbnails/29.jpg)
StartGet
height
Print surface area
Get radius
Print volume
Make a flowchart for this output:Hey! Where
did those two numbers
come from?
Cylinder Surface Area and Volume
Height: 4.2Radius: 3.4
The surface area is 99.04 The volume is 152.5317
Print title
Oh yeah. We missed
a step.
![Page 30: Flowchartsgorskicompsci.ca/ICS3U/Unit1/ppt8_Flowcharts.pdf · 2020. 11. 24. · Flowcharts are also useful to help you visualize the flow of a program](https://reader033.vdocuments.us/reader033/viewer/2022060815/6093f15b0a58c81ca94a68b5/html5/thumbnails/30.jpg)
StartGet
height
Calculate surface area
Print surface area
Get radius
Print volume
Make a flowchart for this output:
Then, what shape to end it?
Cylinder Surface Area and Volume
Height: 4.2Radius: 3.4
The surface area is 99.04 The volume is 152.5317
Print title
Calculate volume
![Page 31: Flowchartsgorskicompsci.ca/ICS3U/Unit1/ppt8_Flowcharts.pdf · 2020. 11. 24. · Flowcharts are also useful to help you visualize the flow of a program](https://reader033.vdocuments.us/reader033/viewer/2022060815/6093f15b0a58c81ca94a68b5/html5/thumbnails/31.jpg)
StartGet
height
Calculate surface area
Print surface area
Get radius
Print volume
End
Make a flowchart for this output:
That’s all.
Cylinder Surface Area and Volume
Height: 4.2Radius: 3.4
The surface area is 99.04 The volume is 152.5317
Print title
Calculate volume
Gold star
![Page 32: Flowchartsgorskicompsci.ca/ICS3U/Unit1/ppt8_Flowcharts.pdf · 2020. 11. 24. · Flowcharts are also useful to help you visualize the flow of a program](https://reader033.vdocuments.us/reader033/viewer/2022060815/6093f15b0a58c81ca94a68b5/html5/thumbnails/32.jpg)
public class flowchart {public static void main(String args[]) {new flowchart();
}public flowchart() {double a = IO.inputDouble("What is a?");double b = IO.inputDouble("What is b?");double c = IO.inputDouble("What is c?");double pos = (-b+(Math.sqrt(b*b-4*a*c)))/2*a;double neg = (-b-(Math.sqrt(b*b-4*a*c)))/2*a;System.out.println("The roots are "+pos+", "+neg);
}}
Very Important Side note: https://www.youtube.com/watch?v=VOXYMRcWbF8
First, let’s classify the
code!
![Page 33: Flowchartsgorskicompsci.ca/ICS3U/Unit1/ppt8_Flowcharts.pdf · 2020. 11. 24. · Flowcharts are also useful to help you visualize the flow of a program](https://reader033.vdocuments.us/reader033/viewer/2022060815/6093f15b0a58c81ca94a68b5/html5/thumbnails/33.jpg)
public class flowchart {public static void main(String args[]) {new flowchart();
}public flowchart() {double a = IO.inputDouble("What is a?");double b = IO.inputDouble("What is b?");double c = IO.inputDouble("What is c?");double pos = (-b+(Math.sqrt(b*b-4*a*c)))/2*a;double neg = (-b-(Math.sqrt(b*b-4*a*c)))/2*a;System.out.println("The roots are "+pos+", "+neg);
}}
Very Important Side note: https://www.youtube.com/watch?v=VOXYMRcWbF8
![Page 34: Flowchartsgorskicompsci.ca/ICS3U/Unit1/ppt8_Flowcharts.pdf · 2020. 11. 24. · Flowcharts are also useful to help you visualize the flow of a program](https://reader033.vdocuments.us/reader033/viewer/2022060815/6093f15b0a58c81ca94a68b5/html5/thumbnails/34.jpg)
public class flowchart {public static void main(String args[]) {new flowchart();
}public flowchart() {double a = IO.inputDouble("What is a?");double b = IO.inputDouble("What is b?");double c = IO.inputDouble("What is c?");double pos = (-b+(Math.sqrt(b*b-4*a*c)))/2*a;double neg = (-b-(Math.sqrt(b*b-4*a*c)))/2*a;System.out.println("The roots are "+pos+", "+neg);
}}
Very Important Side note: https://www.youtube.com/watch?v=VOXYMRcWbF8
![Page 35: Flowchartsgorskicompsci.ca/ICS3U/Unit1/ppt8_Flowcharts.pdf · 2020. 11. 24. · Flowcharts are also useful to help you visualize the flow of a program](https://reader033.vdocuments.us/reader033/viewer/2022060815/6093f15b0a58c81ca94a68b5/html5/thumbnails/35.jpg)
public class flowchart {public static void main(String args[]) {new flowchart();
}public flowchart() {double a = IO.inputDouble("What is a?");double b = IO.inputDouble("What is b?");double c = IO.inputDouble("What is c?");double pos = (-b+(Math.sqrt(b*b-4*a*c)))/2*a;double neg = (-b-(Math.sqrt(b*b-4*a*c)))/2*a;System.out.println("The roots are "+pos+", "+neg);
}}
Very Important Side note: https://www.youtube.com/watch?v=VOXYMRcWbF8
Start with what shape?
![Page 36: Flowchartsgorskicompsci.ca/ICS3U/Unit1/ppt8_Flowcharts.pdf · 2020. 11. 24. · Flowcharts are also useful to help you visualize the flow of a program](https://reader033.vdocuments.us/reader033/viewer/2022060815/6093f15b0a58c81ca94a68b5/html5/thumbnails/36.jpg)
public class flowchart {public static void main(String args[]) {new flowchart();
}public flowchart() {double a = IO.inputDouble("What is a?");double b = IO.inputDouble("What is b?");double c = IO.inputDouble("What is c?");double pos = (-b+(Math.sqrt(b*b-4*a*c)))/2*a;double neg = (-b-(Math.sqrt(b*b-4*a*c)))/2*a;System.out.println("The roots are "+pos+", "+neg);
}}
Very Important Side note: https://www.youtube.com/watch?v=VOXYMRcWbF8
Start
What goes in the
parallelogram?
![Page 37: Flowchartsgorskicompsci.ca/ICS3U/Unit1/ppt8_Flowcharts.pdf · 2020. 11. 24. · Flowcharts are also useful to help you visualize the flow of a program](https://reader033.vdocuments.us/reader033/viewer/2022060815/6093f15b0a58c81ca94a68b5/html5/thumbnails/37.jpg)
public class flowchart {public static void main(String args[]) {new flowchart();
}public flowchart() {double a = IO.inputDouble("What is a?");double b = IO.inputDouble("What is b?");double c = IO.inputDouble("What is c?");double pos = (-b+(Math.sqrt(b*b-4*a*c)))/2*a;double neg = (-b-(Math.sqrt(b*b-4*a*c)))/2*a;System.out.println("The roots are "+pos+", "+neg);
}}
Very Important Side note: https://www.youtube.com/watch?v=VOXYMRcWbF8
Start Get a Get b Get c
![Page 38: Flowchartsgorskicompsci.ca/ICS3U/Unit1/ppt8_Flowcharts.pdf · 2020. 11. 24. · Flowcharts are also useful to help you visualize the flow of a program](https://reader033.vdocuments.us/reader033/viewer/2022060815/6093f15b0a58c81ca94a68b5/html5/thumbnails/38.jpg)
public class flowchart {public static void main(String args[]) {new flowchart();
}public flowchart() {double a = IO.inputDouble("What is a?");double b = IO.inputDouble("What is b?");double c = IO.inputDouble("What is c?");double pos = (-b+(Math.sqrt(b*b-4*a*c)))/2*a;double neg = (-b-(Math.sqrt(b*b-4*a*c)))/2*a;System.out.println("The roots are "+pos+", "+neg);
}}
Very Important Side note: https://www.youtube.com/watch?v=VOXYMRcWbF8
Start Get apos = (-b+(Math.sqrt(b*b-
4*a*c)))/2*aGet b
neg = (-b+(Math.sqrt(b*b-4*a*c)))/2*a
Get c
![Page 39: Flowchartsgorskicompsci.ca/ICS3U/Unit1/ppt8_Flowcharts.pdf · 2020. 11. 24. · Flowcharts are also useful to help you visualize the flow of a program](https://reader033.vdocuments.us/reader033/viewer/2022060815/6093f15b0a58c81ca94a68b5/html5/thumbnails/39.jpg)
public class flowchart {public static void main(String args[]) {new flowchart();
}public flowchart() {double a = IO.inputDouble("What is a?");double b = IO.inputDouble("What is b?");double c = IO.inputDouble("What is c?");double pos = (-b+(Math.sqrt(b*b-4*a*c)))/2*a;double neg = (-b-(Math.sqrt(b*b-4*a*c)))/2*a;System.out.println("The roots are "+pos+", "+neg);
}}
Very Important Side note: https://www.youtube.com/watch?v=VOXYMRcWbF8
Start Get apos = (-b+(Math.sqrt(b*b-
4*a*c)))/2*a
"The roots are "+pos+", "+neg
Get b
neg = (-b+(Math.sqrt(b*b-4*a*c)))/2*a
Get c
![Page 40: Flowchartsgorskicompsci.ca/ICS3U/Unit1/ppt8_Flowcharts.pdf · 2020. 11. 24. · Flowcharts are also useful to help you visualize the flow of a program](https://reader033.vdocuments.us/reader033/viewer/2022060815/6093f15b0a58c81ca94a68b5/html5/thumbnails/40.jpg)
public class flowchart {public static void main(String args[]) {new flowchart();
}public flowchart() {double a = IO.inputDouble("What is a?");double b = IO.inputDouble("What is b?");double c = IO.inputDouble("What is c?");double pos = (-b+(Math.sqrt(b*b-4*a*c)))/2*a;double neg = (-b-(Math.sqrt(b*b-4*a*c)))/2*a;System.out.println("The roots are "+pos+", "+neg);
}}
Very Important Side note: https://www.youtube.com/watch?v=VOXYMRcWbF8
Start Get apos = (-b+(Math.sqrt(b*b-
4*a*c)))/2*a
"The roots are "+pos+", "+neg
Get b
neg = (-b+(Math.sqrt(b*b-4*a*c)))/2*a
Get c
End
How do we end?
![Page 41: Flowchartsgorskicompsci.ca/ICS3U/Unit1/ppt8_Flowcharts.pdf · 2020. 11. 24. · Flowcharts are also useful to help you visualize the flow of a program](https://reader033.vdocuments.us/reader033/viewer/2022060815/6093f15b0a58c81ca94a68b5/html5/thumbnails/41.jpg)
Flowcharts•Diagrams that trace how a computer
FLOWS through a piece of code.•Used to plan out a program before you
code.•Also used to understand a program
because it represents it visually.
![Page 42: Flowchartsgorskicompsci.ca/ICS3U/Unit1/ppt8_Flowcharts.pdf · 2020. 11. 24. · Flowcharts are also useful to help you visualize the flow of a program](https://reader033.vdocuments.us/reader033/viewer/2022060815/6093f15b0a58c81ca94a68b5/html5/thumbnails/42.jpg)
There is only one start and one end.
Arrows connect the pieces.
Flow is up to down or left to right.
Lines do not cross.
The only shape with can have 2 lines come out of it is a diamond.
No shape can have more than 2 lines come out of it.
Flowchart Rules
![Page 43: Flowchartsgorskicompsci.ca/ICS3U/Unit1/ppt8_Flowcharts.pdf · 2020. 11. 24. · Flowcharts are also useful to help you visualize the flow of a program](https://reader033.vdocuments.us/reader033/viewer/2022060815/6093f15b0a58c81ca94a68b5/html5/thumbnails/43.jpg)
Start End
The ONLY thing it can
hold.
One of each per flow
chart.
![Page 44: Flowchartsgorskicompsci.ca/ICS3U/Unit1/ppt8_Flowcharts.pdf · 2020. 11. 24. · Flowcharts are also useful to help you visualize the flow of a program](https://reader033.vdocuments.us/reader033/viewer/2022060815/6093f15b0a58c81ca94a68b5/html5/thumbnails/44.jpg)
Get n
int n = IO.inputInt("Number? ");
From IO,inputlines
ONLY write “Get” + variable name
![Page 45: Flowchartsgorskicompsci.ca/ICS3U/Unit1/ppt8_Flowcharts.pdf · 2020. 11. 24. · Flowcharts are also useful to help you visualize the flow of a program](https://reader033.vdocuments.us/reader033/viewer/2022060815/6093f15b0a58c81ca94a68b5/html5/thumbnails/45.jpg)
Calculate surface area
SA = 6 * a * a
int SA = 6 * a * a;
Math calculations
Leave the variable type off, put in the
calculation
![Page 46: Flowchartsgorskicompsci.ca/ICS3U/Unit1/ppt8_Flowcharts.pdf · 2020. 11. 24. · Flowcharts are also useful to help you visualize the flow of a program](https://reader033.vdocuments.us/reader033/viewer/2022060815/6093f15b0a58c81ca94a68b5/html5/thumbnails/46.jpg)
System.out.println("Giant");System.out.println("The total is "+n);
Giant“The total
is “+n
System.out.printlnstatements
Just include what is in the brackets.