reset password
Author Message
wcwir
Posts: 75
Posted 19:30 Apr 21, 2019 |

After quiz and lecture on Monday (or Tuesday for the Tu-Th section), we will go through the VowelsAndConsonants problems, and I'm giving you one more day to complete it.

Please go back to the Liang chapter on Methods and re-read section 6.11. It is extremely important, and quite different from what we've been doing up to that point. We are coming up against more complex problems, and we need a more sophisticated approach to solving them. Methods are part of that approach, and it is not enough to understand what they do and how; you must also understand what they can do for you -- how they can make your work as a software developer easier and more manageable.

jcolora5
Posts: 6
Posted 20:26 Apr 21, 2019 |

I do not understand methods :\ 

send help :'v

wcwir
Posts: 75
Posted 21:52 Apr 21, 2019 |
jcolora5 wrote:

I do not understand methods :\ 

send help :'v

But... You have been using methods from the beginning of the course! Every time you do System.out.println() in your code, you are using the method println(). The method "knows" how take a String and display it to console. Other methods are like that too: they "know" how to solve some problem.

A program may solve many problems, and instead of writing the code that solves all of these problems inside the main method, we write a solution to each problem in a separate method, and then the main method can call these methods.

Almost everything you do -- walking from bus to class, making a sandwich, etc. -- can be broken down into smaller tasks. For example, walking consists of taking steps; each step consists of lifting one foot, moving it forward, and putting in back on the ground. Methods allow us to break down complex problems into tasks -- that is probably the most fundamental thing to understand about them.

Seriously, as you go about your daily life, think about what "subroutines" your actions consist of. If you were to program a robot that does things you do, what methods would you write?