18-SEP-18:Created for Evening north class after mess with West. Scanned images and code snippets are critical.
Might we be friends? Decision logic exercise
Extension class activity for java module exploring control of flow and user input.
Start Here: Jump to a section
Project steps and code samples
- Flow chart on paper: Create a friend compatibility flow chart on paper like the ones shown below. Use our module guide on flow charting and if/else blocks as your reference. Remember, for our first draft, we'll only be gathering integer responses from the user. Once this works, you can work on String comparisons.
- Review sample code: Study the sample code with decision logic only that shows how to code up a single question with a hard-coded response
- Code it up: Write a draft version of your program like the previous sample in NetBeans: don't worry yet about user input. Make sure the logical paths work before adding extra complexity.
- Study user input sample: Study this sample program that generated the sample output below. This class uses an object called a Scanner to read input from the keyboard. We don't know much about object creation yet, but you can get the gist of how we read in data on with it and store it in a properly typed variable.
- Add user input: Adjust your code to use a Scanner object to interact with the user based on the code samples in the previous item.
- Test: Test your code ruthlessly! Make sure the logic works as the flow chart shows. Adjust your flow chart if you made mistakes.
- Comment your code sufficiently that another programmer of your level could read your code and understand its inner workings
- Prepare: Ensure that the license header and @author tags are correct
- Sync: Make sure your hand-written flow chart matches how your program actually executes. Adjust one or the other to make them match.
- Print your code from directly inside netbeans and place it in your class folder.
- Share: Upload your code: Create a git-hub account if you don't already have one using this step-by-step guide. Inside that account, create a repository for CIT-111, and upload the .java file containing your working program. THis is described in agonizing detail in the guide.
Study this code with nested if/else blocks. Add this kind of logic to your program.
Read in our module guide about gathering String input. Study this code with String input. Add this kind of logic to your program.
Sample program output and source code
When fully-baked, a sample program output can look like figure 4
wb_incandescentSample flow charts
Legacy students have authorized the sharing of their work for the benefit of future javas at CCAC. Use their work as launchpads for yours.
Zoom in on images
On Win/Linux, Hold down control and engage your mouse's scroll ball to zoom.
(c)2018 technologyrediscogvery.net | content can freely reproduced according to the site's content use agreement.