You are on page 1of 349

Java Fundamentals and Java Programming Instructor Resource Guide

INSTRUCTOR NOTES FOR SLIDES Appendix A Whats in Your Future? Slide 1: Whats in Your Future? Lesson Preparation Internet access is required for this lesson. The students are asked to find occupations that may interest them. In the US, the Department of Labor publishes a book called the Occupational Outlook Handbook that lists all occupations. The book can be found on the Internet here: www.bls.gov/oco/home.htm. Your country may have a similar publication or website listing details about occupations and industries. United Kingdom: National Statistics, http://www.statistics.gov.uk/cci/nscl.asp?id=5089 Careers in Europe: http://www.hobsons.com http://www.irishjobs.ie/ http://www.iht.com/IHT/SUP/052799/car01.html http://ec.europa.eu/growthandjobs/index_en.htm http://www.escapeartist.com/jobs12/easteu.htm What to Watch For Students are not always realistic about what career options they have. Ask students to discuss their plans with a parent or guardian. You may want to have parents review and sign each students planning documents.

Oracle Academy

1 Copyright 2012, Oracle. All rights reserved.

Appendix A: What's in Your Future?

For those students who already have concrete plans for their thirteenth year, ask them to plan another option. What if something happened and they could not pursue what seems to be so certain right now? This will eliminate the I already know what Im going to do so I dont have to do this response. Slide 2: What Will I Learn? No instructor notes for this slide. Slide 3: Why Learn It? Relate the process of developing goals, changing plans, and maybe having to restart a few times in life to the same process students experienced in Java fundamentals and/or programming. Was the first plans you had the one you eventually adopted? Did all your plans as a group materialize? What changed along the way? Change is the only thing you can count on. Its best to have more than one play in your playbook more options instead of fewer. Slide 4: Why Learn It? (continued) No instructor notes for this slide. Slide 5: Why Learn It? (continued) No instructor notes for this slide. Slide 6: Tell Me / Show Me Goal Planning No instructor notes for this slide. Slide 7: Tell Me / Show Me Goal Planning (continued) Before showing students this slide, you may want to ask them to write about their future job plans on a piece of paper or on the classroom whiteboard or blackboard. Using this list, you can see which goals follow the SMART framework. Slide 8: Tell Me / Show Me Goal Planning (continued) No instructor notes for this slide. Slide 9: Tell Me / Show Me Aims Versus Goals No instructor notes for this slide. Oracle Academy 2 Copyright 2012, Oracle. All rights reserved. Appendix A: What's in Your Future?

Slide 10: Tell Me / Show Me What are Your Goals? No instructor notes for this slide. Slide 11: Tell Me / Show Me Goal Planning Time Frames No instructor notes for this slide. Slide 12: Tell Me / Show Me What are Your Goals? Explain the purpose of a 10-year vision. Explain that long-term goals are things that happen over time. Students will struggle with 10-year goals, but thats the point. Students are not used to thinking that far into the future. This is a good mental challenge. Just try to keep students thinking realistically they may not all be millionaires. Slide 13: Tell Me / Show Me Occupations For countries outside the US, you may be able to find a document or resource comparable to the Occupational Outlook Handbook. Slide 14: Tell Me / Show Me Occupations No instructor notes for this slide. Slide 15: Tell Me / Show Me Examining Occupations Ask students how they would find out details about jobs without this resource would they talk to people in the industry? What if they didnt know anyone in the profession? Taking the time to do this type of research can be very helpful. Slide 16: Tell Me / Show Me What Occupations Interest You? The US Department of Labor publishes a website listing industry information here: http://www.bls.gov/oco/cg. You may be able to find something similar in your country. Make a list of industries that are prominent in your country or region. Ask students to share information about industries that their family members and friends work in. Oracle Academy 3 Copyright 2012, Oracle. All rights reserved. Appendix A: What's in Your Future?

Slide 17: Tell Me / Show Me Industries No instructor notes for this slide. Slide 18: Tell Me / Show Me Industries (continued) This is just a partial list, please see http://www.bls.gov/oco/cg for a complete list. Slide 19: Tell Me / Show Me Industries (continued) No instructor notes for this slide. Slide 20: Tell Me / Show Me Industries (continued) No instructor notes for this slide. Slide 21: Tell Me / Show Me Examining Industries No instructor notes for this slide. Slide 22: Tell Me / Show Me What Industries Interest You? No instructor notes for this slide. Slide 23: Tell Me / Show Me Roadmap to Your Ideal Career No instructor notes for this slide. Slide 24: Tell Me / Show Me Roadmap to Your Ideal Career (continued) Look for a job description in the local paper or on a local job search website. Slide 25: Tell Me / Show Me Roadmap to Your Ideal Career (continued) Once students have an idea about the occupation and/or industry that interests them, then they can map out a plan for how to achieve their vision. Slide 26: Tell Me / Show Me Additional Resources

Oracle Academy

4 Copyright 2012, Oracle. All rights reserved.

Appendix A: What's in Your Future?

No instructor notes for this slide. Slide 27: Summary No instructor notes for this slide. Slide 28: Try It/Solve It Practice Solutions Teacher Preparation: In the US, the Department of Labor publishes a book called the Occupational Outlook Handbook that lists all occupations. The book can be found on the Internet here: www.bls.gov/oco/home.htm. Other countries may have a similar publication or website listing details about occupations and industries that students can reference in practice exercises 4 through 8 below. Try It / Solve It 1. What Are Your Goals? Think about your goals for the short, medium and long term. What are your goals Within one month? Within three months? Within one year? Within five years? For the longer term? Solution: Answers will vary. Generally: Short range goals occur within one month to one year. Medium range goals are usually education related and occur within five years. Long term goals are concerned with the type of job and lifestyle students are interested in.

2. What Occupations Interest You? Do some job titles appeal to you more than others? List the five job titles that interest you most.

Oracle Academy

5 Copyright 2012, Oracle. All rights reserved.

Appendix A: What's in Your Future?

Solution: Answers will vary. 3. What Industries Interest You? List three industries that interest you most. Solution: Answers will vary. 4. Your Ideal Career Your ideal Career is likely to be found in some combination of the occupations and industries you listed in steps 2 and 3. Choose one of the job titles and industries that you listed above and research the following information. Education needed Skills needed Work experience needed Personal characteristics needed Earnings Expected job prospects What workers do on the job Working conditions

To find out this information, use the OOH website (www.bls.gov/oco/home.htm) or labor statistics available for your country, or search job listings for similar jobs and review the job requirements. You may want to use a chart such as the one below to keep track of your research.

Information Source Name/URL

Job Title

Basic Work Responsibilities

Education/Training/ Skills Required

Solution: Answers will vary.

Oracle Academy

6 Copyright 2012, Oracle. All rights reserved.

Appendix A: What's in Your Future?

Answer each of the following. Use complete sentences. 5. Which career(s) do you have the most interest in? Solution: Answers will vary. 6. For each of the careers you are most interested in, describe in detail why you are interested in it. What makes this job sound like something youd like to do? Solution: Answers will vary. 7. Based on the educational/training requirements for the career(s) you are most interested in, list the courses youve taken in high school, or will take in college that you feel will help you prepare for this career? Solution: Answers will vary. 8. What future steps will you take to gain more knowledge and experience about your chosen career(s)? Solution: Answers will vary.

Oracle Academy

7 Copyright 2012, Oracle. All rights reserved.

Appendix A: What's in Your Future?

Java Fundamentals and Java Programming Instructor Resource Guide


INSTRUCTOR NOTES FOR SLIDES Appendix A What is a Consultant? Slide 1: What is a Consultant? Lesson Preparation Students search the Internet's job-recruiting sites to find job openings for consultants and use this information to answer questions about what is a consultant? If Internet access is not available in the classroom, provide four or five different job descriptions copied from the Internet's job-recruiting sites and have each group use the descriptions to answer questions about what is a consultant? Internet addresses for four major US job-recruiting services include monster.com, hotjobs.yahoo.com, jobs.com, dice.com. You may want to use other job search websites for your country or region. Slide 2: What Will I Learn? No instructor notes for this slide. Slide 3: Why Learn It? Talk to students about how they have performed these skills throughout the course already! Remind them of the projects they have completed throughout this course, their roles in those projects, and how those roles/skills are typical to a consulting role. Slide 4: Why Learn It?(continued) No instructor notes for this slide. Slide 5: Why Learn It?(continued) No instructor notes for this slide. Oracle Academy 1 Copyright 2012, Oracle. All rights reserved. Appendix A: What is a Consultant?

Slide 6: Tell Me / Show Me What is a Consultant? Explain that a consultant job can vary from company to company and in different industries. In information technology, a consultant is typically hired to do specific tasks on a project. Again, those tasks will depend on the project. However, there are skills (ability to communicate, work in a team, and create presentations for clients) that are required for all consulting roles. Ask the students if they are an expert in a particular topic. Do their parents or friends ask for advice about this topic? Perhaps about mobile phones, social networking sites, computer technology, or even automobiles? They probably already consult on certain topics.

Oracle Academy

2 Copyright 2012, Oracle. All rights reserved.

Appendix A: What is a Consultant?

Slide 7: Tell Me / Show Me Why Hire a Consultant? No instructor notes for this slide. Slide 8: Tell Me / Show Me Why Hire a Consultant?(continued) No instructor notes for this slide. Slide 9: Tell Me / Show Me Business Consultant A business consultant can be someone who has worked in a particular capacity for a long time and is considered an expert in the topic. For example, someone who has worked in public relations for a large company or the government for a long time may have a lot of experience in a lot of different scenarios requiring public relations expertise and as such, could become a public relations consultant. Slide 10: Tell Me / Show Me Business Consultants (continued) No instructor notes for this slide. Slide 11: Tell Me / Show Me Business Consultants (continued) No instructor notes for this slide. Slide 12: Tell Me / Show Me Information Technology (IT) Consultants There are so many different skills and products to learn about and become experts on in the Information Technology field. The more areas students are exposed to, the more experienced and knowledgeable they become. They may also become more unique and desirable skills-wise. Slide 13: Tell Me / Show Me Information Technology (IT) Consultants (continued) Students should understand that they can learn something from every project they participate on and every software or computer product they are exposed to. The more experience they have in different projects, the better they will be able to perform in the future. Slide 14: Tell Me / Show Me Educational Background for IT Consultants No instructor notes for this slide. Oracle Academy 3 Copyright 2012, Oracle. All rights reserved. Appendix A: What is a Consultant?

Slide 15: Tell Me / Show Me Skills Required by IT Consultants Soft skills such as communication, teamwork, and presentation skills, are very desirable to employers. If an employer had to choose between two candidates who were equal technically, but one candidate had stronger communication, teamwork, and presentation skills, then they may choose the candidate with the exceptional soft skills. Slide 16: Tell Me / Show Me Job Descriptions for IT Consultants After reviewing this job post, you may want to show a job post from a local newspaper or regional job website. Ask the questions, What are the basic skills required for the job? What are the technical skills required for the job? What is the educational background required for the job? Slide 17: Tell Me / Show Me Job Descriptions for IT Consultants (continued) No instructor notes for this slide. Slide 18: Tell Me / Show Me Skills All Employers Want: Self-Management Skills No instructor notes for this slide. Slide 19: Tell Me / Show Me Skills All Employers Want: Transferable Skills No instructor notes for this slide. Slide 20: Tell Me / Show Me 21st Century Skills These are the 21st Century Skills highlighted by the Oracle Education Foundation in the Oracle Academy and ThinkQuest curricula. Other organizations may have slightly different lists, although the ideas are generally the same. (For example, the 21st Century Skills Institute lists critical thinking and problem solving skills, communication skills, creativity and innovation skills, collaboration skills, information and media literacy skills, and contextual learning skills See http://www.21stcenturyskills.org/index.php?option=com_content&task=view&id=195&Itemid=183)

Oracle Academy

4 Copyright 2012, Oracle. All rights reserved.

Appendix A: What is a Consultant?

Slide 21: Tell Me / Show Me 21st Century Skills (continued) No instructor notes for this slide. Slide 22: Tell Me / Show Me 21st Century Skills (continued) No instructor notes for this slide. Slide 23: Summary No instructor notes for this slide. Slide 24: Try It/Solve It No instructor notes for this slide.

Practice Solutions Try It / Solve It 1. Three job roles are listed below. Choose the best job role where a Consultant might be involved. 1. Data Entry 2. Application Design 3. Computer Sales Solution: Application Design 2. From the job description chosen in question 1, identify the basic skills and technical skills required for the position. Solution: Examples of possible skills identified. Advanced expertise in application design.

Oracle Academy

5 Copyright 2012, Oracle. All rights reserved.

Appendix A: What is a Consultant?

High degree of proficiency with Oracle and Java. Excellent analytical skills. Strong oral and written communication skills. Java Certification is a plus.

3. Locate a job description for a consultant using the Internet. Provide the description and the link to the site listing the description. Solution: Answers will vary. 4. For the job description provided in question 3, identify the possible role for the position and the basic and technical skills necessary for the job. Solution: Answers will vary based on the job description identified in question #3. 5. Refer to the list of Self-Management and Transferable Skills below. Which of the skills do you possess? List at least 5 skills.

Self Management Skills Good attendance Honest Punctual Follow instructions Meet deadlines Get along with teachers Get along with students Hard working, productive

Transferable Skills Planning Organizing or managing projects Supervising others Negotiating Solving problems Accepting responsibility Instructing others Managing people or leadership Writing well or using words Computer and technology skills Dealing with data Working with people Driving or operating vehicles

Oracle Academy

6 Copyright 2012, Oracle. All rights reserved.

Appendix A: What is a Consultant?

Solution: Answers will vary 6. Refer to the list of 21st Century Skills below. Which of the skills do you possess? Can you describe how you have used five of these skills in your school, student organizations, or work or community experiences? 21st Century Skills Critical Thinking Creativity Teamwork Cross-cultural understanding Communication Technology Self-Direction Solution: Answers will vary 7. Write a job description for a consulting position with your firm. The position will complete all of the application development aspects of a potential future business. Solution: Answers will vary.

Oracle Academy

7 Copyright 2012, Oracle. All rights reserved.

Appendix A: What is a Consultant?

Java Fundamentals and Java Programming Instructor Resource Guide


INSTRUCTOR NOTES FOR SLIDES Appendix A Speaking in Public Slide 1: Speaking in Public What to Watch For Not everyone will master public speaking. The practice includes a skit. Some students will not want to participate in the skit. If they provide input during the group discussion, then that is a good first step in the right direction. Slide 2: What Will I Learn? No instructor notes for this slide. Slide 3: Why Learn It? Write the following list on the board/overhead: snakes insects/bugs speaking in front of a group heights flying

Ask students to copy the list and then add five items from their personal lists of things that they fear. Ask students to rate the top five most feared items, starting with 1 being their most feared. Tally the results. Discuss the results as a lead-in to this lesson. Slide 4: Why Learn It? (cont.) No instructor notes for this slide. Oracle Academy 1 Copyright 2012, Oracle. All rights reserved. Appendix A: Speaking in Public

Slide 5: Tell Me / Show Me The Speechmaking Process This is an example of a process that students can follow to produce and give a speech. Slide 6: Tell Me / Show Me Step 1: Assess the Purpose of Your Talk This is a critical step in the speechmaking process because it affects the rest of the speech! Ask students if they have ever listened to a speech and they werent sure what it was about. If students take the time to think about the questions, why are you giving this talk, how long should your talk last, and what is the purpose of your talk, then this will help guide the creation of the rest of the speech. Slide 7: Tell Me / Show Me Step 2: Research and Refine the Topic It is important to know your audience so that you can relate the topic to them. How familiar is the audience with your topic? Why does the audience care about the topic? After you know your audience, you can refine the topic of your speech so that it is directed to their needs and interests. Slide 8: Tell Me / Show Me Step 3: Write and Organize Your Materials A well organized speech typically includes three distinctive parts: a beginning, a middle and an end. The introduction to a speech is very important, it is where you capture the audiences attention and make the audience believe that you know what you are talking about and care about your topic. Your introduction should accomplish the five objectives on this slide. Slide 9: Tell Me / Show Me Step 3: Write and Organize Your Materials (continued) The middle of your talk is where you expand on your key points. Slide 10: Tell Me / Show Me Step 3: Write and Organize Your Materials (continued) Experienced speech makers believe that it is the first and last 30 seconds of a speech that the audience tends to remember the most. Techniques for ending the speech including ending in a dramatic way or concluding on a high or positive note. Slide 11: Tell Me / Show Me Step 4: Select a Mode of Delivery Most students will present from a manuscript. After students gain experience, they may try other modes. Students who are interested in the topic can consider joining a debate team or a non-profit organization dedicated to public speaking and leadership development such as Toastmasters International.

Oracle Academy

2 Copyright 2012, Oracle. All rights reserved.

Appendix A: Speaking in Public

Slide 12: Tell Me / Show Me Speaking Extemporaneously No instructor notes for this slide. Slide 13: Tell Me / Show Me Speaking From a Manuscript No instructor notes for this slide. Slide 14: Tell Me / Show Me Presenting From Memory No instructor notes for this slide. Slide 15: Tell Me / Show Me Impromptu Speaking No instructor notes for this slide. Slide 16: Tell Me / Show Me Step 5: Organizing Visual Aids Ask the students if they have ever listened to a speech involving visual aids. Were the visual aids used effectively? Or did they take away from the speaker? Slide 17: Tell Me / Show Me Step 5: Organizing Visual Aids (continued) No instructor notes for this slide. Slide 18: Tell Me / Show Me Step 5: Organizing Visual Aids (continued) No instructor notes for this slide. Slide 19: Tell Me / Show Me Step 6: Practice, Practice, Practice Remind students that students need to practice public speaking in order to become better at it. Practice giving your speech in a mirror or videotape and watch your speech. Just like golfers and baseball players examine their swings reviewing video, students can review their mannerisms, speech patterns, posture, etc. by watching themselves.

Oracle Academy

3 Copyright 2012, Oracle. All rights reserved.

Appendix A: Speaking in Public

Slide 20: Tell Me / Show Me Step 7: Deliver: Appearance No instructor notes for this slide. Slide 21: Tell Me / Show Me Step 7: Deliver: Managing Your Nervousness Ask students to name their reasons for being afraid of public presentations. List the responses on the board. Explain that your first day in the classroom as a teacher was a pretty scary experience, but you learned several techniques to overcome your fear. Read each item, demonstrate it briefly, and/or provide examples from your personal experience. Slide 23: Tell Me / Show Me Step 7: Deliver: 10 Techniques...(cont.) Read each item, demonstrate it briefly, and/or provide examples from your personal experience. Slide 24: Tell Me / Show Me Improving Public Speaking Skills No instructor notes for this slide. Slide 25: Tell Me / Show Me GridWorld Case Study Presentations No instructor notes for this slide. Slide 26: Tell Me / Show Me Common Presentation Problems to Avoid No instructor notes for this slide. Slide 27: Additional Resources No instructor notes for this slide. Slide 28: Summary No instructor notes for this slide. Slide 29: Try It/Solve It Oracle Academy 4 Copyright 2012, Oracle. All rights reserved. Appendix A: Speaking in Public

No instructor notes for this slide.

Practice Solutions LESSON 3 Speaking In Public

Try It / Solve It 1. The instructor will provide a list of topics that you can choose from. Work in your groups to develop a short presentation on the topic. Try to give everyone a role in the skit (one person talks, the other one draws on the board, the other one acts it out, demonstrates, etc.). Incorporate as many of the 10 techniques for effective public-speaking tips as you can. Pay attention while the other groups present, and provide comments on how well they used the 10 techniques for effective public speaking. Be positive in your feedback! Mention the good things as well as the areas for improvement. Solution: From the public-speaking topics suggested below or others that you create, assign one topic to each student group. Have each group act out or role-play one of the public-speaking topics. Give students 5 minutes to develop a skit to present in front of the class. Instruct them to incorporate as many of the 10 techniques for effective public-speaking tips as they can. While each group presents, the other class members record which of the 10 tips were well done. Encourage them to be positive here! Discuss the good points after each group presents. Public-Speaking Topic List: Explain to the attendance office that you forgot your written excuse for yesterday's absence. Demonstrate to the class the correct way to put staples in a stapler or paper in a printer. Introduce a new student to the class and tell three interesting things about that student. Demonstrate the correct way to set the table for dinner use the board to draw silverware, water glass, and dishes. Explain how to play a sport use the board to draw the field/court, goals, etc. Explain the rules of the game. Give a sales pitch for why someone should buy your backpack.

Oracle Academy

5 Copyright 2012, Oracle. All rights reserved.

Appendix A: Speaking in Public

Give a sales pitch for joining your rugby/football/volleyball/drill team. Engage the class in the best way to make a paper airplane. Explain to the class how to copy a picture from the Internet and save it in a file.

2. Watch the evening news program or attend a speaking event and record specific examples of the speaker's use or misuse of the 10 techniques for effective public speaking. Solution: Answers will vary.

Oracle Academy

6 Copyright 2012, Oracle. All rights reserved.

Appendix A: Speaking in Public

Java Fundamentals and Java Programming Instructor Resource Guide


INSTRUCTOR NOTES FOR SLIDES Appendix A Leaders in Information Technology Slide 1: Leaders in Information Technology Lesson Preparation This career skills lesson aims to build positive associations between learning and work by showcasing meaningful contributions made to society by information-technology (IT) professionals (consider choices that include men, women, and underrepresented minorities). Students will research information about early pioneers in IT and people currently in IT (women of the year in IT, today's business leaders in IT, people who have used IT to make significant changes in our world) not necessarily all famous people but people who have jobs that they enjoy. Students will then answer questions to identify the contribution this IT professional is making in the information-technology world, recognize obstacles this person had to overcome, list the skills this person has acquired, and name personal qualities that make this person a leader. Slide 2: What Will I Learn? No instructor notes for this slide. Slide 3: Why Learn It? No instructor notes for this slide. Slide 4: Tell Me / Show Me Your teacher will identify several websites Below are some useful sites. You may also know of sites that recognize leaders from your region or country. Oracle Academy 1 Copyright 2012, Oracle. All rights reserved. Appendix A: Leaders in Information Technology

http://www.cwhonors.org/ Outstanding site: ComputerWorld Search for New Heroes website. The ComputerWorld Honors brings together the chairmen or chief executive officers of the worlds foremost informationtechnology companies with the world's leading universities, libraries, and research institutions to document a revolution in progress: the global information-technology revolution.

http://www.informationtechnologyleaders.com/ Outstanding streaming video and written scripts of women and men in technology careers. Hosted by Laura Schildkraut, information-technology leaders is a series of one-on-one interviews with leading executives in information systems and information technology. The programs remind us that success in this discipline comes in all shapes and sizes and to shake off failures. Produced by the University of Washington Business School.

http://www.witi.com/index.php Women in Technology International: Hall of Fame section with stories of outstanding women current and interesting

Slide 5: Summary No instructor notes for this slide. Slide 6: Try It/Solve It No instructor notes for this slide.

Oracle Academy

2 Copyright 2012, Oracle. All rights reserved.

Appendix A: Leaders in Information Technology

Practice Solutions LESSON 4 Leaders in Information Technology

Try It / Solve It 1. From the Internet sites listed by the teacher, identify three people recognized as making a contribution in an information-technology field. Record your responses to the following questions. 1. Who is this person? 2. What kind of contribution did he/she make or are they currently making to IT? 3. Where does this person work? 4. Why has this person been recognized as an IT leader other than simply by the job he/she holds? 5. What skills, interests, or personal traits does this person possess? 6. How did this person accomplish what he/she did/does based on the skills, interests, and personal traits identified in the previous question? 7. Why did you choose this person? Solution: Encourage students not to simply copy information off the Internet. Ask them to make some assumptions about the person based on the kinds of activities, interests, hobbies, and educational level the person has attained. Why do they think this person is recognized as an IT leader? 2. Your instructor will identify an IT leader in your city or local area. Locate information about this person and answer the same questions as in the previous activity: 1. Who is this person? 2. What kind of contribution did he/she make or are they currently making to IT? 3. Where does this person work? 4. Why has this person been recognized as an IT leader other than simply by the job he/she holds? 5. What skills, interests, or personal traits does this person possess?

Oracle Academy

3 Copyright 2012, Oracle. All rights reserved.

Appendix A: Leaders in Information Technology

6. How did this person accomplish what he/she did/does based on the skills, interests, and personal traits identified in the previous question? 7. Has this person, either through their experiences in technology or in another way, made a contribution to society? What is the contribution? Has this contribution affected his or her success? Solution: Answers will vary.

Oracle Academy

4 Copyright 2012, Oracle. All rights reserved.

Appendix A: Leaders in Information Technology

Java Fundamentals and Java Programming Instructor Resource Guide


INSTRUCTOR NOTES FOR SLIDES Appendix A Creating a Career Portfolio Slide 1: Creating a Career Portfolio Lesson Preparation Students will need a copy of their completed high-school courses, achievement test results, and certificates and awards. Check with counselors for an easy way to accomplish this task. What to Watch For It may take several weeks for students to gather the information, or it may be impossible to get all the information. Focus on what can be done. Set the stage early for the quality of work required. Check for spelling, writing conventions, and a professional appearance in all work. Some students may not have all the information or a complete academic record. Help them maximize what they have at this point in time. Make students responsible for keeping/storing their own portfolio information. Slide 2: What Will I Learn? No instructor notes for this slide. Slide 3: Why Learn It? No instructor notes for this slide. Slide 4: Why Learn It? No instructor notes for this slide. Slide 5: Tell Me / Show Me What is a Portfolio and How Can It Be Used? In addition to practical ways a portfolio can be used, the process of creating a portfolio also provides a unique opportunity to reflect on achievements and experiences that students have accomplished to date. Oracle Academy 1 Copyright 2012, Oracle. All rights reserved. Appendix A: Creating a Career Portfolio

Slide 6: Tell Me / Show Me What Does a Portfolio Look Like? No instructor notes for this slide. Slide 7: Tell Me / Show Me What is an Online Portfolio? It is important to mention to students that their online portfolio should not be open for all to see. Encode your online portfolio so that it is password protected. Offer the password only to those individuals who are part of your interview process, such as the hiring manager or department manager. By controlling access to your portfolio, you reduce the risk of identity theft while ensuring that appropriate individuals have access. Slide 8: Tell Me / Show Me What Items Can Go Into a Portfolio? No instructor notes for this slide. Slide 9: Tell Me / Show Me Creating a Portfolio No instructor notes for this slide. Slide 10: Tell Me / Show Me Step 1: Your Academic and Personal Achievements No instructor notes for this slide. Slide 11: Tell Me / Show Me Step 1: Your Academic and Personal Achievements (continued) No instructor notes for this slide. Slide 12: Tell Me / Show Me Step 2: Your Interests and Skills No instructor notes for this slide. Slide 13: Tell Me / Show Me Step 2: Your Interests and Skills (continued) No instructor notes for this slide. Slide 14: Tell Me / Show Me Your Work Experience and Community Involvement No instructor notes for this slide.

Oracle Academy

2 Copyright 2012, Oracle. All rights reserved.

Appendix A: Creating a Career Portfolio

Slide 15: Tell Me / Show Me Step 4: Your Resume or Curriculum Vitae Explain that creating a resume or CV is a way to organize the many details of one's experiences. Share your own experiences with getting transcripts, writing a resume, completing job applications, creating a placement folder, obtaining letters of recommendation, etc. when applying for college and looking for a teaching job. Ask the students who the people are who would ask to see their portfolio? Suggested answers: Employers, college admission officers, military personnel, and scholarship committee members. Ask for student volunteers to explain their personal experiences in applying for a job, obtaining transcripts, completing scholarship applications, etc. Slide 16: Tell Me / Show Me Step 5: Your Future Plans No instructor notes for this slide. Slide 17: Tell Me / Show Me Step 5: Your Future Plans (continued) No instructor notes for this slide. Slide 18: Summary No instructor notes for this slide. Slide 19: Try It/Solve It No instructor notes for this slide.

Oracle Academy

3 Copyright 2012, Oracle. All rights reserved.

Appendix A: Creating a Career Portfolio

Practice Solutions LESSON 5 Creating a Career Portfolio Try It / Solve It 1. Write a one-page document that outlines the kind of portfolio you will create. Identify in this document if the portfolio will be a physical portfolio in a three-ring binder or an online portfolio. Identify what you will include in this portfolio and the steps youll take to create this portfolio. Solution: Students will need to collect the information in a central place. Depending on student skill level and your schools curriculum, students may know HTML and may be able to create an online portfolio. If an online portfolio is not possible, students should plan to create a physical portfolio. Student answer may include either using a file folder or envelope for organizing the documentation. 2. Describe ways in which you can use your career portfolio. Will you bring it to job interviews? Use it during college/university interviews? Summarize how you think a career portfolio will benefit you. Solution: Answers will vary. Answer should mention: Provides an opportunity for students to demonstrate their accomplishments, to showcase their competencies, and to collect samples of work for prospective employers or further graduate work. 3. Start thinking about the kinds of documents that you can assemble for your career portfolio. You will collect and develop these documents in future lessons, but for now consider what you have available to you. Step 1: Your Academic and Personal Achievements High School Transcript listing courses completed/to be completed, advanced placement courses, college courses, Oracle Internet Academy participation Achievement Test Results - state/local learning assessment scores College or military assessment test scores SAT ACT PSAT GED GRE GMAT ASFAB Certificates / Awards - industry recognized certifications, citizen of the month, athletic awards, community recognition, outstanding student, perfect attendance, citizenship awards Leadership - class officer, club officer, team captain, tutoring experiences, camp counselor Oracle Academy 4 Copyright 2012, Oracle. All rights reserved. Appendix A: Creating a Career Portfolio

experiences Step 2: Your Interests and Skills Inventories of personal interests and aptitudes with a summary of strengths and/or weaknesses Identification of jobs/careers of interest and/or preference List of educational requirements for jobs/careers of interest Evaluation of current personal skills and career of interest. Justification of aptitude for chosen careers. Step 3: Your Work Experience and Community Involvement Work experience, work responsibilities Volunteer work, community service work record Step 4: Your Resume Resume or CV Step 5: Your Future Plans 13th year/first year out of high school list of specific plans for each month for one year. Where can you go to get the education/training to prepare for a career of your choice? Standard of Living Plan - written description of your preferred life style, where you want to live and work, documentation of earning potential based on chosen career and levels of education. Ten-Year Goals - step by step list of goals to be completed in the next ten years including educational, career, leisure and family. Solution: Students will need to collect the information in a central place. Ask them to use a file folder or envelope for organizing the documentation. If physical documentation cannot be acquired, students can make a list and include the list with the other documentation. Read each item in the list of academic achievements to the students. Give examples and ask students to give examples for each item in the list. Remind students of all the types of certificates and awards that could be listed. Students may not remember certificates and awards they have earned.

Oracle Academy

5 Copyright 2012, Oracle. All rights reserved.

Appendix A: Creating a Career Portfolio

Java Fundamentals and Java Programming Instructor Resource Guide


INSTRUCTOR NOTES FOR SLIDES Appendix A Interests, Skills, and Achievements Slide 1: Interests, Skills, and Achievements Lesson Preparation Preview the list of Internet sites suggested below ensuring that students have access. Select those sites most appropriate for your class. Many Internet resources are appropriate for this lesson. Use key terms to search at http://www.google.com or http://www.yahoo.com that include: careers, job interest inventories, jobs. Review the Career Explorations Worksheet. Interest Inventory and Aptitude Sites: www.careerexplorer.net/aptitude.asp http://career.missouri.edu http://www.myfuture.com/ http://www.careerkey.org/english/ http://www.cmi-lmi.com/kingdomality.html http://www.uncwil.edu/stuaff/career/students/assessments.htm http://www.princetonreview.com/cte/quiz/career_quiz1.asp http://www.jobweb.com/ http://www.funeducation.com/PersonalityProfile/ Career Exploration: http://www.careervoyages.gov/index.cfm http://stats.bls.gov http://www.dice.com

Oracle Academy

Appendix A: Interests, Skills, and Achievements

Copyright 2012, Oracle. All rights reserved.

http://career-advice.monster.com/job-search-essentials/technology/home.aspx http://www.it-careers.ca/ http://www.computerworld.com/careertopics/careers http://www.jobprofiles.org/ http://www.acinet.org/acinet/default.asp http://www.martynemko.com/pub/excerpts/Cool_Careers.shtm Start this section with two or three of the URL addresses listed or obtain written copies of career and interest inventories from your school's career counselor, if available. What to Watch For This is the time to be realistic with students about the qualifications for careers that they may be interested in pursuing. Help them look at the courses theyve completed successfully. Have them look at challenging courses they have taken, such as advanced mathematics, physics, chemistry, writing, and foreign languages. Course choices and achievement are good indicators of student interests. Students are not good at just surfing the net for information. They quickly become derailed. Give them specific website URL addresses to view. Students can also spend too much time completing interest and aptitude inventories. Encourage students to do some of the research at home, if possible. Students may not remember certificates and awards they have earned. Were they Student of the Month, Outstanding Athlete, Math Scholar, or Eagle Scout? Did they have perfect attendance for three or more years? Connections Use the biographies of successful people to show students that they may face many obstacles, but it they have a plan and continue to explore what they would like to do, they have a better chance of reaching their goal. Use the Internet search keywords: biographies of successful people. Some biographical resources include: http://www.google.com/Top/Reference/Biography/ http://www.internet-success-stories.com/index.htm http://www.infoplease.com/people.html http://www.biography.com/ Oracle Academy 2 Appendix A: Interests, Skills, and Achievements

Copyright 2012, Oracle. All rights reserved.

http://www.s9.com/ Slide 2: What Will I Learn? No instructor notes for this slide. Slide 3: Why Learn It? Many students havent really thought much about their lives after graduation nor have a realistic picture of what options they have. Relate your own feelings or experiences. When did you decide to be a teacher? Was it your first career choice? Let students know that they may change their minds many times, but without any plan, they will have trouble setting any career course. Slide 4: Why Learn It?(continued) No instructor notes for this slide. Slide 5: Why Learn It?(continued) No instructor notes for this slide. Slide 6: Tell Me / Show Me Interests No instructor notes for this slide. Slide 7: Tell Me / Show Me Skills No instructor notes for this slide. Slide 8: Tell Me / Show Me Skill Statements No instructor notes for this slide. Slide 9: Tell Me / Show Me Action Words No instructor notes for this slide.

Oracle Academy

Appendix A: Interests, Skills, and Achievements

Copyright 2012, Oracle. All rights reserved.

Slide 10: Tell Me / Show Me Action Words (continued) No instructor notes for this slide. Slide 11: Tell Me / Show Me Skills With Tangibles No instructor notes for this slide. Slide 12: Tell Me / Show Me Skills With Intangibles No instructor notes for this slide. Slide 13: Tell Me / Show Me Skills With People No instructor notes for this slide. Slide 14: Tell Me / Show Me Computer and Technical Literacy Skills No instructor notes for this slide. Slide 15: Tell Me / Show Me Asking Others to Assess Your Skills No instructor notes for this slide. Slide 16: Tell Me / Show Me Aptitude and Interest Surveys Ask students to explain what they think an inventory is. Possible response: A personal inventory is an accounting of ones interests, skills, preferences, and values. A personal inventory is used to take a snapshot in time to decide what you know, what you dont know, and what direction you want to pursue in life. Personal inventories are used to make decisions. These are a number of different sites for interest and skills inventory research. Review these sites and choose which will work best with your students. Write them on the board for class. http://www.careervoyages.gov/index.cfm U.S. government site http://www.careers4you.org/inventory-printable.htm Visit ICPAC at http://icpac.indiana.edu/helpfaq/index.xml for FAQs and activities on how to choose a career based on your interests. http://www.myfuture.com/ 4 Appendix A: Interests, Skills, and Achievements

Oracle Academy

Copyright 2012, Oracle. All rights reserved.

http://www.careerkey.org/english/you/ http://www.cmi-lmi.com/kingdomality.html http://www.pch.gc.ca/special/cyberstation/html/szone1_e.htm provides a list of basic skills that high-school students need to get a job The school's career center/person can also provide career inventories.

Slide 17: Tell Me / Show Me Achievements No instructor notes for this slide. Slide 18: Tell Me / Show Me Examples of Academic Achievements No instructor notes for this slide. Slide 19: Tell Me / Show Me Examples of Personal Achievements No instructor notes for this slide. Slide 20: Tell Me / Show Me Examples of Personal Achievements (continued) No instructor notes for this slide. Slide 21: Tell Me / Show Me Characteristics of Achievements No instructor notes for this slide. Slide 22: Tell Me / Show Me Characteristics of Achievements (continued) No instructor notes for this slide. Slide 23: Tell Me / Show Me Additional Resources No instructor notes for this slide.

Oracle Academy

Appendix A: Interests, Skills, and Achievements

Copyright 2012, Oracle. All rights reserved.

Slide 24: Summary No instructor notes for this slide. Slide 25: Try It/Solve It No instructor notes for this slide.

Oracle Academy

Appendix A: Interests, Skills, and Achievements

Copyright 2012, Oracle. All rights reserved.

Practice Solutions LESSON 6 Interests, Skills, and Achievements Try It / Solve It Answer the following questions. Where indicated, copy your findings to the document called Interests, Skills, and Achievements Summary. After you have filled out this document in entirety, add it to your portfolio. 1. Answer the following questions to assess some of your personal interests. 1. What would you choose to do on a completely free day? 2. What projects are most rewarding to you? 3. What kinds of topics do you enjoy reading about? Solution: Individual Responses 2. Answer the following questions to assess some of your personal skills. 1. Refer to the list of Action Words at the end of this document. Do any of the verbs trigger a thought about a skill that you have? Choose 5 to 10 verbs. 2. Refer to the list of Skills With Tangibles at the end of this document. Do you work with any physical objects? Keep in mind that the objects you identify may not be listed in the slide. Write 3 to 5 objects. 3. Refer to the list of Skills With Intangibles at the end of this document. Do you work with any intangible objects? Once again, keep in mind that the objects you identify may not be listed in the slide. Write 3 to 5 objects. 4. Refer to the list of Skills With People at the end of this document. Do you work with any particular groups of people? Which groups? 5. Now, using the verbs you listed in 2a and the objects and people you listed in 2b, 2c, and 2d, write 3-5 skill statements. Use the following chart as a guide. The Action (verb) Writing Developing Organizing The Object of the Action (noun) Research reports Software programs Student events

Oracle Academy

Appendix A: Interests, Skills, and Achievements

Copyright 2012, Oracle. All rights reserved.

6. Copy the resulting skill statements to the Interests, Skills, and Achievements Summary document. 7. Summarize your computer and technical literacy skills and copy the final chart to the Interests, Skills, and Achievements Summary document. Category Office Productivity Tools Application Development Skills Website Development Graphic Design Programming Networking Product or Skills

Solution: Individual Responses 3. Collect the following information summarizing your academic and personal achievements and copy the results in the Interests, Skills, and Achievements Summary document. High School Transcript listing courses completed/to be completed, advanced placement courses, college courses, Oracle Academy participation Achievement Test Results - state/local learning assessment scores College or military assessment test scores (in the US: SAT, ACT, PSAT, GED, GRE, GMAT, ASFAB) Final projects, papers, etc. that demonstrate mastery of knowledge Solution: Individual Responses 4. (Optional) Take an aptitude and interest survey. Your instructor will provide the survey or direct you to an Internet website. From the aptitude/interest inventory information you obtained, briefly describe what you learned about yourself and your interests. I like to... Oracle Academy 8 Appendix A: Interests, Skills, and Achievements

Copyright 2012, Oracle. All rights reserved.

I prefer to Do the survey results match the results you found in exercises 1 and 2? What are some possible career options related to your aptitude and interests? Solution: Individual Responses 5. (Optional) Write an essay entitled What About Me? that discusses your strengths and interests. Identify three careers that could potentially be a good match to your strengths and interests. Add your essay to your portfolio. Solution: It may help to give students an outline to base their essay on, such as: a) My interests: What do I love to do? What do I spend most of my spare time doing? What would I do for free because I enjoy it so much? b) My skills: What can I do? What am I good at (sports, writing, organizing club activities, math, etc.)? What are my best subjects? What am I always getting compliments on? c) Possible careers: Where do I go from here? Based on my interests, skills, and research, what careers would be most suited to me? What careers would I like to try and why? d) Encourage students to broaden their scope by considering at least three different types of jobs/careers. It is too early for them to get locked into narrow choices. e) The essay should be at least two pages long. They should list the websites they used to find out information about careers. For each possible career, they should list job titles, sample job descriptions, starting salary, average salary, and types of companies that would be employers. Students can start writing the essay in class but can finish it afterward. The assignment should be turned in within two days. f) Please use the grading guidelines established at your school to evaluate comparable student work.

Oracle Academy

Appendix A: Interests, Skills, and Achievements

Copyright 2012, Oracle. All rights reserved.

List of Action Words: Administering Advising Analyzing Arranging Assembling Assessing Balancing Budgeting Building Calculating Classifying Coaching Communicating Completing Composing Connecting Constructing Consulting Coordinating Counseling Creating Deciding Decorating Defending Delivering Demonstrating Designing Detecting Developing Diagnosing Discovering Drawing Driving Eliminating Experimenting Exploring Expressing Facilitating Helping Hosting Identifying Illustrating Implementing Improving Influencing Initiating Inspiring Installing Instructing Integrating Interpreting Interviewing Inventing Investigating Judging Launching Leading Learning Lecturing Listening Logging Maintaining Managing Mastering Memorizing Mentoring Mediating Modeling Modifying Monitoring Motivating Navigating Negotiating Observing Obtaining Operating Ordering Organizing Originating Overseeing Perceiving Performing Persuading Planning Playing Presenting Predicting Preparing Programming Promoting Purchasing Questioning Quoting Raising Reading Reasoning Recommending Recording Repairing Reporting Representing Resolving Retrieving Reviewing Reducing Scheduling Selling Serving Setting up Shaping Solving Studying Summarizing Supervising Surveying Teaching Trading Translating Uniting Writing

List of Skills with Tangibles: Animals Antiques Automobiles Food Furniture Jewelry Musical instruments Office equipment Plants

Oracle Academy

10

Appendix A: Interests, Skills, and Achievements

Copyright 2012, Oracle. All rights reserved.

Chemicals Clothing Computers Electronics List of Skills with Intangibles: drawings/designs Facts Internet Instant messenger/SMS Meetings List of Skills with People: Children Doctors Politicians

Machinery Metals MP3 player Mobile phone

Plastics Sports gear Wireless devices Wood

Movie making Music Questionnaires Records (as in data) Research

Social networking websites Statistics Strategies Training sessions Video games

School Student groups Teachers

Teams Senior citizens

Oracle Academy

11

Appendix A: Interests, Skills, and Achievements

Copyright 2012, Oracle. All rights reserved.

Java Fundamentals and Java Programming Instructor Resource Guide


INSTRUCTOR NOTES FOR SLIDES Appendix A Work Experience and Community Involvement Slide 1: Work Experience and Community Involvement Have copies of Work Experience and Community Involvement Summary document available. Students may not remember soft skills learned in their work or volunteer experiences. Explain and give examples of soft skills such as working as a team, being on time or completing tasks on time. Slide 2: What Will I Learn? No instructor notes for this slide. Slide 3: Why Learn It? Read Why Learn It? aloud. Students may ask why community involvement is important. Possible response: it demonstrates initiative and an ability to work with and for others. There will always be someone who wants to share the exception: My brother never did anything in high school and he got into the university. Possible response: Getting into college doesn't necessarily mean you're guaranteed a job. Employers hire people, not colleges. Connections Most college/trade school applications will ask for a student's work history and community service. Obtain a college or trade school admissions form and show students that this information is a requirement. Online admissions forms can be found using the keyword search online college admission forms. A college application database can be found at: http://www.collegenet.com/about/index_html For an example of a college application, go to: Oracle Academy 1 Appendix A: Work Experience and Community Involvement

Copyright 2012, Oracle. All rights reserved.

http://www.applyweb.com/apply/caltech/evalb.pdf Slide 4: Why Learn It?(continued) No instructor notes for this slide. Slide 5: Tell Me / Show Me Importance of Work and Community Experience No instructor notes for this slide. Slide 6: Tell Me / Show Me Tracking Work Experiences Distribute copies of Work Experience and Community Involvement Summary worksheet. Slide 7: Tell Me / Show Me Tracking Work Experiences (continued) No instructor notes for this slide. Slide 8: Tell Me / Show Me Personal Qualities No instructor notes for this slide. Slide 9: Tell Me / Show Me Personal Qualities No instructor notes for this slide. Slide 10: Tell Me / Show Me Personal Qualities: Scenario 1 No instructor notes for this slide. Slide 11: Tell Me / Show Me Personal Qualities: Scenario 1 (continued) No instructor notes for this slide. Slide 12: Tell Me / Show Me Personal Qualities: Scenario 1 (continued) No instructor notes for this slide. Slide 13: Tell Me / Show Me Personal Qualities: Scenario 2 Oracle Academy 2 Appendix A: Work Experience and Community Involvement

Copyright 2012, Oracle. All rights reserved.

No instructor notes for this slide. Slide 14: Tell Me / Show Me Personal Qualities: Scenario 2 (continued) No instructor notes for this slide. Slide 15: Tell Me / Show Me Personal Qualities: Scenario 2 (continued) No instructor notes for this slide. Slide 16: Tell Me / Show Me College and University Admission Criteria No instructor notes for this slide. Slide 17: Tell Me / Show Me College and University Admission Criteria No instructor notes for this slide. Slide 18: Summary No instructor notes for this slide. Slide 19: Try It/Solve It No instructor notes for this slide.

Oracle Academy

Appendix A: Work Experience and Community Involvement

Copyright 2012, Oracle. All rights reserved.

Practice Solutions

LESSON 7 Work Experience and Community Involvement Try It / Solve It


Locate the document called Work Experience and Community Involvement Summary and answer the following questions. 1. In the Work Experience section, enter the following information for each job you have held. Company Name Dates of Employment Supervisor Name and Contact Information Job Title and Responsibilities

For each job that you have left, be sure to include the end date of your employment and list all of the accomplishments earned and skills acquired while on the job. Solution: Answers will vary. Preview the documents before they are considered acceptable for the portfolio. Make sure student work meets your standards. 2. In the Community Service Experience section, enter the following information for each job you have held. Organization name, program name, and local address Dates of service Point of contact within the organization and contact information Activities, skills learned, accomplishments

Solution: Answers will vary. Preview the documents before they are considered acceptable for the portfolio. Make sure student work meets your standards. 3. Choose 3 of the qualities from the list below. For each quality you have chosen, write a paragraph describing an incident where you have demonstrated that quality. Ability to communicate with others

Oracle Academy

Appendix A: Work Experience and Community Involvement

Copyright 2012, Oracle. All rights reserved.

Ability to work with different personality types Evidence that you give 100 percent to your work or job Evidence that you take responsibility for doing a good job Maturity Willingness to learn

Solution: Answers will vary. Preview the documents before they are considered acceptable for the portfolio. Make sure student work meets your standards.

Oracle Academy

Appendix A: Work Experience and Community Involvement

Copyright 2012, Oracle. All rights reserved.

Java Fundamentals and Java Programming Instructor Resource Guide


INSTRUCTOR NOTES FOR SLIDES Appendix A Creating a Resume Slide 1: Whats in Your Future? There are many resume writing resources available on the Internet. University career offices like Purdue (http://owl.english.purdue.edu/owl/resource/699/01/) are helpful as are the following sites: http://www.jobweb.com/resumes_interviews.aspx http://students.adelphi.edu/career/students/resume.shtml The Microsoft Office Templates website has many resume formats available for download (http://office.microsoft.com/en-us/templates/results.aspx?qu=resume&av=TPL000) It is very easy to spend a lot of time reviewing resume samples, so you may want to provide one or two templates that students can use as a starting point. Slide 2: What Will I Learn? No instructor notes for this slide. Slide 3: Why Learn It? No instructor notes for this slide. Slide 4: Why Learn It? (continued) No instructor notes for this slide. Slide 5: Why Learn It? (continued)

Oracle Academy

1 Copyright 2012, Oracle. All rights reserved.

Appendix A: Creating a Resume

No instructor notes for this slide. Slide 6: Why Learn It? (continued) No instructor notes for this slide. Slide 7: Tell Me / Show Me What is a Resume? Tell students whether your country uses resumes or Cvs. Slide 8: Tell Me / Show Me What is a CV? No instructor notes for this slide. Slide 9: Tell Me / Show Me Creating a Resume No instructor notes for this slide. Slide 10: Tell Me / Show Me Step 1: Analyze Your Skills, Knowledge, and Accomplishments No instructor notes for this slide. Slide 11: Tell Me / Show Me Step 2: Look at Sample Resumes Your schools career center may have sample templates students can use to create their first resume. Slide 12: Tell Me / Show Me Step 2: Look at Sample Resumes (continued) No instructor notes for this slide. Slide 13: Tell Me / Show Me Step 3: Prepare a Draft of Your Resume No instructor notes for this slide. Slide 14: Tell Me / Show Me Step 3: Prepare a Draft of Your Resume (continued) No instructor notes for this slide.

Oracle Academy

2 Copyright 2012, Oracle. All rights reserved.

Appendix A: Creating a Resume

Slide 15: Tell Me / Show Me Step 3: Prepare a Draft of Your Resume (continued) No instructor notes for this slide. Slide 16: Tell Me / Show Me Step 3: Prepare a Draft of Your Resume (continued) No instructor notes for this slide. Slide 17: Tell Me / Show Me Step 3: Prepare a Draft of Your Resume (continued) No instructor notes for this slide. Slide 18: Tell Me / Show Me Step 3: Prepare a Draft of Your Resume (continued) No instructor notes for this slide. Slide 19: Tell Me / Show Me Step 3: Prepare a Draft of Your Resume (continued) No instructor notes for this slide. Slide 20: Tell Me / Show Me Step 4: Have your Resume Reviewed, Edited, and Critiqued No instructor notes for this slide. Slide 21: Tell Me / Show Me Step 5: Email and/or Print No instructor notes for this slide. Slide 22: Tell Me / Show Me Step 5: Email and/or Print (continued) No instructor notes for this slide. Slide 23: Tell Me / Show Me Tips Oracle Academy 3 Copyright 2012, Oracle. All rights reserved. Appendix A: Creating a Resume

No instructor notes for this slide. Slide 24: Tell Me / Show Me Sample Resume There are many different formats for resumes. Use the sample provided as a guide. Students need to know what types of information should be included. In this section, students will prepare a rough draft of a personal resume. Slide 25: Tell Me / Show Me Sample Resume (continued) No instructor notes for this slide. Slide 26: Tell Me / Show Me Sample Resume (continued) No instructor notes for this slide. Slide 27: Tell Me / Show Me Sample Resume (continued) No instructor notes for this slide. Slide 28: Tell Me / Show Me Additional Resources No instructor notes for this slide. Slide 29: Summary No instructor notes for this slide. Slide 30: Try It/Solve It No instructor notes for this slide.

Oracle Academy

4 Copyright 2012, Oracle. All rights reserved.

Appendix A: Creating a Resume

Practice Solutions LESSON 8 Creating a Resume

Try It / Solve It
1. Use the Internet and find 3 sample resumes that you can review. Answer the following questions about the 3 sample resumes: What are the main components of the resume? Can you easily find each section? What information is included in the Education section? Does the author include his or her GPA? How about his or her academic achievements? What information is included in the Work Experience section? Does the candidate include skill statements and achievements? Does the candidate include community or volunteer experience? What do you think of the design of the resume? Is the formatting clean? Are the fonts easy to read? Is there white space on the document? Do you notice any spelling or grammatical errors? Finally, how many seconds do you think you would spend on this resume and would you invite the candidate back for an interview?

Solution: In this example, students are asked to critically review three sample resumes. Ask the students to submit one of the resumes as well as their analysis for review. 2. Use the Internet to find two resumes to compare and contrast. Write 5 reasons why one resume is more appealing than the other. Comment on both the design and layout of the resume as well as the contents of the resume. Solution: Answers will vary. 3. Locate a resume template that you want to use for your own resume. 4. Using the information you collected in the Interests, Skills, and Achievements Summary worksheet, begin writing your resume. Dont forget to include: Contact information Objective 5 Copyright 2012, Oracle. All rights reserved. Appendix A: Creating a Resume

Oracle Academy

Education background Work experience Achievements and activities

5. Ask three people to review, edit, and critique your resume. Establish a time where you can meet with them to ask them the questions listed below. Summarize each of the interviews with the three people that reviewed your resume. Is the work experience listed in chronological order with the most recent jobs listed first? Are achievements emphasized? Is the writing clear and concise? Are there any spelling or grammar errors? Is the formatting clean?

Solution: Answers will vary. 6. After enhancing and completing your resume add it to your online portfolio. Solution: Preview the resume before it is considered acceptable for the portfolio. Make sure student work meets your standards.

Oracle Academy

6 Copyright 2012, Oracle. All rights reserved.

Appendix A: Creating a Resume

Java Fundamentals and Java Programming Instructor Resource Guide


INSTRUCTOR NOTES FOR SLIDES Appendix A The Changing Nature of the Job Market Slide 1: The Changing Nature of the Job Market For the Activity, you can direct students to the following links: http://www.bls.gov/emp/emptab3.htm http://www.bls.gov/emp/emptab5.htm These are links to the U.S. Department of Labor, Bureau of Labor Statistics. Outside the U.S., provide the website link that is relevant to your location. Connections Discuss how the school systems have changed over the years, from online systems (registration, exams, classes), to sports (rising popularity of girls soccer and basketball teams), to special-interest clubs (clubs for different ethnic groups), etc. What does this mean for the careers available in a school? Possible responses include: hiring database administrators and developers, women coaches for sports teams, rising need for people with multilingual skills, etc. Slide 2: What Will I Learn? No instructor notes for this slide. Slide 3: Why Learn It? No instructor notes for this slide. Slide 4: Why Learn It? No instructor notes for this slide. Oracle Academy 1 Copyright 2012, Oracle. All rights reserved. Appendix A: The Changing Nature of the Job Market

Slide 5: Tell Me / Show Me The Job Market No instructor notes for this slide. Slide 6: Tell Me / Show Me Factors Affecting the Job Market In terms of changes in demographics: You could also point out that baby boomers born after World War II are now approaching old age, increasing the demand for different products and services such as expanded health care, retirement homes, and medicines. These demands create new technologies, new products, and a new skilled workforce. In terms of how global markets have changed: Why would a worldwide burger chain offer vegetarian entrees in some countries? Answer: To meet the needs of the local market Why do some high-end clothes designers create separate clothing labels that are more affordable? Answer: To compete with the discount and bargain stores that sell knockoffs of designer clothes Have students check their coats or backpacks or shoes. Where are they made or assembled? What does this mean for the job market? Answer: Very few items are totally manufactured in one country. A car is designed in Germany, some parts are made in the U.S., the steel can come from different countries, and it is be assembled in Mexico and sold worldwide. This means that you should pay attention to what your own country contributes to global production. This is where a lot of jobs will be. However, this constantly changes, so you should keep track of current trends. Slide 7: Tell Me / Show Me Technological Changes More examples of how extinction of technology affected businesses: What happened to the electric-typewriter manufacturers and the service industry that employed workers to repair them? Possible responses include: Those workers had to learn to repair newer machines and computers to stay employed in the same industry.

Oracle Academy

2 Copyright 2012, Oracle. All rights reserved.

Appendix A: The Changing Nature of the Job Market

What changes did the companies undergo that designed and made television antennas that were mounted on every household roof? Possible responses include: They had to learn newer technology, such as satellite dishes or cable TV. How has DNA profiling and testing changed police work? Possible responses include: It has created new jobs in police departments for scientists familiar with DNA procedures. Slide 8: Tell Me / Show Me Technological Changes (continued) Possible answers are: Automatic windows Digital cameras Hybrid or electric cars Online stores and music download sites DVDs, VCDs CDs Plasma screens (in case students ask, CRT stands for cathode ray tube this is a very old type of computer screen; you could only display text and it was in one color) Automatic light (motion) sensors

Slide 9: Tell Me / Show Me Technological Changes (continued) No instructor notes for this slide. Slide 10: Tell Me / Show Me Technologies on the Rise No instructor notes for this slide. Slide 11: Tell Me / Show Me Changing Nature of Work No instructor notes for this slide. Slide 12: Tell Me / Show Me Changing Nature of Companies No instructor notes for this slide. Oracle Academy 3 Copyright 2012, Oracle. All rights reserved. Appendix A: The Changing Nature of the Job Market

Slide 13: Tell Me / Show Me 21st Century Skills No instructor notes for this slide. Slide 14: Tell Me / Show Me 21st Century Skills (continued) No instructor notes for this slide. Slide 15: Tell Me / Show Me 21st Century Skills (continued) No instructor notes for this slide. Slide 16: Tell Me / Show Me Additional Resources No instructor notes for this slide. Slide 17: Summary No instructor notes for this slide. Slide 18: Try It/Solve It No instructor notes for this slide.

Oracle Academy

4 Copyright 2012, Oracle. All rights reserved.

Appendix A: The Changing Nature of the Job Market

Practice Solutions LESSON 9 The Changing Nature of the Job Market

Try It / Solve It
1. What is the status of the job market in your country or area? Look for a local news article from the past month describing the job market, or read one provided by your instructor. Does the article mention any factors affecting the job market? For example: 1. Demographics: population, growth, immigration 2. Educational background: elementary, secondary, postsecondary, vocational or employer based, apprenticeship programs 3. Technology: communications, information processing, design, production 4. Global Markets: businesses have more customers and suppliers 5. Internet: business have increased opportunities without having a physical business location 6. Increased use of technology: demand for more sophisticated, skilled workers 7. Outsourcing to other countries: globalization has forced companies to cut positions and move them to places where labor is less expensive 8. Downsizing and corporate restructuring: loss of jobs in order to be more efficient Does it mention any other factors? After reading the article, list at least 3 thoughts about what types of jobs may have a better outlook in your country in the next 5 years? Solution: Answers will vary. Your instructor will provide websites listing the fastest-growing jobs as well as those that are in decline. Use the data to answer the following questions. 2. Choose three jobs that you are interested in from the fastest-growing list and 1. Write a reason why you think this is a growing area. 2. Describe how this affects your plans for future education or acquisition of skills. Solution: Possible responses for fastest-growing list: 1. Java developers: As companies continue to build their technical infrastructure, professionals are in high demand who know how to translate business requirements into well engineered, Oracle Academy 5 Copyright 2012, Oracle. All rights reserved. Appendix A: The Changing Nature of the Job Market

tested, and deployed business application systems. 2. Hazardous-materials-removal workers: As the need for cleaning up and preserving the environment grows, professionals who know how to deal with hazardous materials will be in demand. 3. Fitness trainers and aerobics instructors: As obesity becomes a bigger problem, fitness becomes a more- important issue. 3. Choose three jobs from the declining list and 1. Write a reason why you think the jobs in that area are predicted to decline. 2. Describe what technology is replacing it, if any. Solution: Possible responses for declining list: 1. Postal-service mail sorters, processors, and processing-machine operators: To be replaced with email and electronic transfer of information 2. Meter readers for utilities: Gas/water/electrical usage will be electronically recorded 3. Bank tellers: Electronic online banking services 4. Choose a company and describe the changing nature of work that would impact you if you were employed at that company. Include in your description educational requirements that you could pursue to prepare for the changing nature of work. For example, the automobile industry is changing and employees can increase their knowledge in the area of robotics to prepare for the future. Your description should be at least one paragraph in length. Solution: Answers will vary. 5. Describe a career choice consideration you would make based on your example in question 4. For example, for the automobile industry a potential employee may consider a career in graphic design or robotic design because of the changing nature. Solution: Answers will vary.

Oracle Academy

6 Copyright 2012, Oracle. All rights reserved.

Appendix A: The Changing Nature of the Job Market

Java Fundamentals and Java Programming Instructor Resource Guide


INSTRUCTOR NOTES FOR SLIDES Appendix A Searching for a Job Slide 1: Searching for a Job Ask students to identify jobs that match the areas of interest previously identified. Internet access is required for this lesson. The following Internet sites are good places for students to begin looking (search-engine keywords: best colleges, trade schools): http://www.usnews.com/usnews/edu/college/rankings/rankindex_brief.php United States listings http://univ.cc/ worldwide listings http://www.scholarstuff.com/colleges/colleges.htm http://www.myfuture.com/t2_milops.html military careers

What to Watch For Discourage students from searching for professional skateboarder, rock star, and pro soccer player types of jobs. Help them to be realistic in their choices at least in their search here! Connections Encourage students to always be looking at current job offerings and reading about new types of jobs and jobs of the future. Ask students to bring to class articles and news stories about jobs and the job market. Slide 2: What Will I Learn? No instructor notes for this slide.

Oracle Academy

Appendix A: Searching for a Job

Copyright 2012, Oracle. All rights reserved.

Slide 3: Why Learn It? Explain to students that the purpose of this activity is to begin looking at what job skills are needed in the current job market in the areas of their interest. For those students who still have another year or two before graduation, encourage them to look at the job qualifications. What additional courses in school could they take to make themselves more marketable? Let students know its not too late to improve their math skills, take an advanced-placement course, add a foreign language, etc. before graduation. Slide 4: Why Learn It? No instructor notes for this slide. Slide 5: Tell Me / Show Me Job Search Methods No instructor notes for this slide. Slide 6: Tell Me / Show Me Job Search Methods (continued) You may want to share with students the process that you followed to find your current position. Students may also be interested in asking their parents and/or relatives how they found their current positions. Slide 7: Tell Me / Show Me Job Search Methods (continued) No instructor notes for this slide. Slide 8: Tell Me / Show Me Job Search Methods (continued) No instructor notes for this slide. Slide 9: Tell Me / Show Me Job Search Methods (continued) No instructor notes for this slide. Slide 10: Tell Me / Show Me School Career Planning Services No instructor notes for this slide. Slide 11: Tell Me / Show Me Classified Ads Oracle Academy 2 Appendix A: Searching for a Job

Copyright 2012, Oracle. All rights reserved.

No instructor notes for this slide. Slide 12: Tell Me / Show Me Classified Ads (continued) No instructor notes for this slide. Slide 13: Tell Me / Show Me Internet Resources No instructor notes for this slide. Slide 14: Tell Me / Show Me Internet Resources (continued) No instructor notes for this slide. Slide 15: Tell Me / Show Me Your Network of Contacts No instructor notes for this slide. Slide 16: Tell Me / Show Me Your Network of Contacts (continued) No instructor notes for this slide. Slide 17: Tell Me / Show Me Employers No instructor notes for this slide. Slide 18: Tell Me / Show Me Employers (continued) No instructor notes for this slide. Slide 19: Tell Me / Show Me Additional Resources No instructor notes for this slide. Slide 20: Summary Oracle Academy 3 Appendix A: Searching for a Job

Copyright 2012, Oracle. All rights reserved.

No instructor notes for this slide. Slide 21: Try It/Solve It No instructor notes for this slide.

Oracle Academy

Appendix A: Searching for a Job

Copyright 2012, Oracle. All rights reserved.

Practice Solutions LESSON 10 Searching for a Job Try It / Solve It 1. Below are five techniques for searching for a job. Explore each technique to see which one would work best for you in your situation. Briefly summarize your findings after exploring each technique. a) School Career Planning and Placement Offices: Does your school have a career office? If so, what types of services do they offer? Which services can you take advantage of to find a job? b) Classified ads: What newspapers do you have available in your community? Review the classified job ads in one of the community newspapers. Are there any jobs that interest you? What are the qualifications and skills required? What is the process for applying for the job? c) Job-listing Websites: Work with your instructor to identify the job-listing websites available for your community or country. Visit the websites and search for jobs that interest you in your community or elsewhere. What keywords did you type in? Are there any jobs that are of particular interest? What are the qualifications and skills required? What is the process for applying for the job? d) Your Network: First, create a list of friends to include in your network. Second, create a list of relatives to include in your network. Identify five people in your overall network whom you would contact if you were searching for a job. How would you contact them? By email? By phone? In person? Write a script outlining what you would say to ask them about helping you in your job search. e) Employer: Are there any companies or organizations in your community for which you would like to work? If there are no companies in your immediate community that interest you, are there any elsewhere for which you would like to work? Visit the company website to see if there are any job openings available. Are there any openings that interest you? What are the qualifications and skills required for the job? What is the process for applying for the job? Do you know anyone who works at the company? Would this person be able to introduce you to a hiring manager or be able to talk to you in general about the company and perhaps tell you about job openings? Solution: Answers will vary. 2. Of the above job search techniques, which two do you think will work best for you and why?

Oracle Academy

Appendix A: Searching for a Job

Copyright 2012, Oracle. All rights reserved.

Solution: Answers will vary. 3. Search the internet for job-listing databases. Produce a list of 10-20 different job-listing databases. Solution: Answers will vary but can include: www.usajobs.gov www.careerbuilder.com/ www.monster.com/ hotjobs.yahoo.com www.simplyhired.com/ www.jobbankinfo.org/ www.craigslist.com Local newspaper websites 4. Develop a list of 10 personal contacts and 5 companies (or company contacts) you can consider your personal network. What information would you need to keep track of in a personal network listing and why? Solution: Answers will include different names of contacts. Some information that is useful to keep track of in a personal network is: name, title, company, industry, how you know the individual, phone #, email.

Oracle Academy

Appendix A: Searching for a Job

Copyright 2012, Oracle. All rights reserved.

Java Fundamentals and Java Programming Instructor Resource Guide


INSTRUCTOR NOTES FOR SLIDES Appendix A Written Communication Slide 1: Written Communication One of the themes of this lesson is first impressions. You may want to share with students a story about how a first impression affected you (positively or negatively). Detail is critical when applying for a job. It is important to emphasize that students need to make sure that all of their written communication (including letters, resumes, etc.) is free of errors. Slide 2: What Will I Learn? No instructor notes for this slide. Slide 3: Why Learn It? No instructor notes for this slide. Slide 4: Why Learn It?(continued) No instructor notes for this slide. Slide 5: Why Learn It?(continued) No instructor notes for this slide. Slide 6: Tell Me / Show Me Cover Letter No instructor notes for this slide.

Oracle Academy

1 Copyright 2012, Oracle. All rights reserved.

Appendix A: Written Communication

Slide 7: Tell Me / Show Me Cover Letter Purpose No instructor notes for this slide. Slide 8: Tell Me / Show Me Tips for Writing a Cover Letter No instructor notes for this slide. Slide 9: Tell Me / Show Me Cover Letter Format Guidelines The letter-writing conventions may be different in your region or country. Slide 10: Tell Me / Show Me Cover Letter Format Guidelines (continued) No instructor notes for this slide. Slide 11: Tell Me / Show Me Cover Letter Format Guidelines (continued) No instructor notes for this slide. Slide 12: Tell Me / Show Me Cover Letter Format Guidelines (continued) No instructor notes for this slide. Slide 13: Tell Me / Show Me Cover Letter Format Guidelines (continued) No instructor notes for this slide. Slide 14: Tell Me / Show Me Cover Letter Format Guidelines (continued) No instructor notes for this slide. Slide 15: Tell Me / Show Me Sample Cover Letter No instructor notes for this slide. Slide 16: Tell Me / Show Me Sample Cover Letter (Continued) No instructor notes for this slide. Oracle Academy 2 Copyright 2012, Oracle. All rights reserved. Appendix A: Written Communication

Slide 17: Tell Me / Show Me Follow-Up Letter Purpose No instructor notes for this slide. Slide 18: Tell Me / Show Me Tips for Writing a Follow-Up Letter No instructor notes for this slide. Slide 19: Tell Me / Show Me Sample Follow-Up Letter #1 No instructor notes for this slide. Slide 20: Tell Me / Show Me Sample Follow-Up Letter #2 No instructor notes for this slide. Slide 21: Tell Me / Show Me Letter of Recommendation Purpose No instructor notes for this slide. Slide 22: Tell Me / Show Me Whom Should You Ask for a Letter of Recommendation? If you have been asked to write a letter of recommendation in the past, share with students how the requesting student approached you and the process you followed to complete the letter and mail it. Could the process have been made easier? Could the student have done anything to help? Slide 23: Tell Me / Show Me Approaching Letter Writers No instructor notes for this slide. Slide 24: Tell Me / Show Me Sample Request for Letter of Recommendation No instructor notes for this slide. Slide 25: Tell Me / Show Me Sample Request for Letter of Recommendation (continued) No instructor notes for this slide.

Oracle Academy

3 Copyright 2012, Oracle. All rights reserved.

Appendix A: Written Communication

Slide 26: Tell Me / Show Me Sample Request for Letter of Recommendation (continued) No instructor notes for this slide. Slide 27: Tell Me / Show Me Sample Letter of Recommendation No instructor notes for this slide. Slide 28: Tell Me / Show Me Sample Letter of Recommendation (continued) No instructor notes for this slide. Slide 29: Tell Me / Show Me Additional Resources No instructor notes for this slide. Slide 30: Summary No instructor notes for this slide. Slide 31: Try It/Solve It No instructor notes for this slide.

Oracle Academy

4 Copyright 2012, Oracle. All rights reserved.

Appendix A: Written Communication

Practice Solutions LESSON 11 Written Communication Try It / Solve It 1. In your own words, describe what a cover letter is and why it is important. Solution: A cover letter is a business letter written to a prospective employer to express your interest in and qualifications for a position. A resume is of limited value to an employer if he or she doesn't know what kind of work you want to do. A cover letter tells the employer the type of position you're seeking, and exactly how you are qualified for that position. 2. In your own words, describe what a follow-up letter is and why it is important. Solution: A follow-up letter is a letter sent to an interviewer thanking them for their time and providing further information and showing continued interest after an interview. A follow-up letter is important because it allows you to recap important points and remind the interviewer about your interest in the position. 3. Use Internet resources to look for a database-related job or use a job description provided by your instructor. a) What are the qualifications required for the job? b) Where is the job located? c) What benefits does the job offer? d) What is the pay range? e) Write a cover letter. f) Assume that you were interviewed. Write a follow-up letter thanking the interviewer for the opportunity to interview for the position. Solution: Answers will vary. 4. Below is a sample letter to give to a teacher or supervisor requesting a letter of recommendation. Fill in the details as they apply to you. <ENTER DATE> Dear <ENTER NAME HERE>, I would appreciate your consideration in writing a letter of recommendation for me. If you agree, I would need this letter by <FILL IN DATE HERE>.

Oracle Academy

5 Copyright 2012, Oracle. All rights reserved.

Appendix A: Written Communication

The following would be helpful when you write this letter: 1. Please write on company/school letterhead, if possible. If this is not possible, please include the following information: a) Company/school school name, address, city, state, and zip code b) Company/school phone number 2. Please type the letter. If you do not have the time to do so, please give me a handwritten copy and I will type it. 3. Please date the letter. 4. Please include the dates I have known or worked for you. 5. Please include the capacity in which you have known me (student, employee, co-worker, and so on). 6. Please include your complete name and title in your signature. 7. Please sign the letter. 8. As you write the letter, the following information might be helpful to you: a) Classes I am taking: <ENTER CLASSES HERE> b) Skills: <ENTER SKILLS HERE> c) Personal Qualities: <ENTER QUALITIES HERE> d) Future plans and goals: <FUTURE PLANS AND GOALS HERE> Thank you for your help and consideration. Sincerely, <Your signature> <YOUR NAME> Solution: Answers will vary.

Oracle Academy

6 Copyright 2012, Oracle. All rights reserved.

Appendix A: Written Communication

Java Fundamentals and Java Programming Instructor Resource Guide


INSTRUCTOR NOTES FOR SLIDES Appendix A Interviewing Slide 1: Whats in Your Future? For the interview activity in the practice, break students into groups of 3-4 and give them the following job description. Ask each student to be the interviewee, interviewer and reviewer (the reviewer critiques the candidate and the interviewer using the interview rubric). Job Description for Information Technical Staff Assistant Description: Under general supervision, provides administrative support to City Departments. Orders and tracks the delivery of computer equipment; troubleshoots problems and performs maintenance and minor repairs to hardware and software; provides ongoing user support to City personnel. Provides one-on-one training on request. Gathers and manipulates data enabling residents to access data via the City website. Slide 2: What Will I Learn? Ask a school official or someone who hires employees to speak to the class about what qualities they look for in a candidate when conducting a job interview. Some students in the class may have been interviewed for a job, a scholarship, or an internship. Have students relate their experiences. Relate your own experiences in getting a teaching job and the interview process for the job. Discuss why interviews are conducted and the types of interviews students might expect seeking a job, entrance into college, a scholarship, or internship. Internet keyword search types of interviews.

Oracle Academy

1 Copyright 2012, Oracle. All rights reserved.

Appendix A: Interviewing

Slide 3: Why Learn It? Interviewing No instructor notes for this slide. Slide 4: Why Learn It? Interviewing No instructor notes for this slide. Slide 5: Tell Me / Show Me What is a Job Interview? No instructor notes for this slide. Slide 6: Tell Me / Show Me Types of Interviews No instructor notes for this slide. Slide 7: Tell Me / Show Me Types of Interviews (continued) No instructor notes for this slide. Slide 8: Tell Me / Show Me Traditional Interview Questions No instructor notes for this slide. Slide 9: Tell Me / Show Me Traditional Interview Questions (continued) No instructor notes for this slide. Slide 10: Tell Me / Show Me Behavioral Interview Questions No instructor notes for this slide. Slide 11: Tell Me / Show Me Behavioral Interview Questions (continued) No instructor notes for this slide.

Oracle Academy

2 Copyright 2012, Oracle. All rights reserved.

Appendix A: Interviewing

Slide 12: Tell Me / Show Me Behavioral Interview Questions (continued) No instructor notes for this slide. Slide 13: Tell Me / Show Me The Interview Process Mention any cultural subtleties to students if applicable in your country or region. Slide 14: Tell Me / Show Me Before the Interview Mention any cultural subtleties to students if applicable in your country or region. Slide 15: Tell Me / Show Me Day of the Interview Mention any cultural subtleties to students if applicable in your country or region. Slide 16: Tell Me / Show Me Greeting the Interviewer Mention any cultural subtleties to students if applicable in your country or region. Slide 17: Tell Me / Show Me During the Interview: Body Language Mention any cultural subtleties to students if applicable in your country or region. Slide 18: Tell Me / Show Me During the Interview: Answering Questions Mention any cultural subtleties to students if applicable in your country or region. Slide 19: Tell Me / Show Me During the Interview: Communication Skills Mention any cultural subtleties to students if applicable in your country or region. Slide 20: Tell Me / Show Me During the Interview: Number One Rule Mention any cultural subtleties to students if applicable in your country or region.

Oracle Academy

3 Copyright 2012, Oracle. All rights reserved.

Appendix A: Interviewing

Slide 21: Tell Me / Show Me During the Interview: What Questions Do You Have? Mention any cultural subtleties to students if applicable in your country or region. Slide 22: Tell Me / Show Me What Questions Do You Have? (continued) Mention any cultural subtleties to students if applicable in your country or region. . Slide 23: Tell Me / Show Me During the Interview: The End Mention any cultural subtleties to students if applicable in your country or region. Slide 24: Tell Me / Show Me Interview Rubric No instructor notes for this slide. Slide 25: Tell Me / Show Me Additional Resources No instructor notes for this slide. Slide 26: Summary No instructor notes for this slide. Slide 27: Try It/Solve It No instructor notes for this slide.

Oracle Academy

4 Copyright 2012, Oracle. All rights reserved.

Appendix A: Interviewing

Practice Solutions LESSON 12 Interviewing

Try It / Solve It
1. What is the purpose of an interview? Solution: The purpose of the interview is for the company to get a good look at you. It is the companys chance to ask you questions about your work experience. It is the companys opportunity to see if you would fit in with the other employees. 2. How does a behavioral interview differ from a traditional interview? Solution: Traditional Interview focuses on what the candidate has accomplished such as completed college or worked as a graphic artist. Behavioral Interview focuses on past experiences and demonstrated competencies that relate to the job requirements, such as having been a team leader that completed an important project under extenuating circumstances. 3. What is expected of the job candidate in a behavioral interview? Solution: Rather than merely telling the interviewer what they would do in a situation, as in a regular interview, in a behavioral interview the candidate must describe, in detail, how they handled a situation in the past. 4. Find a job posting that interests you by searching on irecruitment.oracle.com or on another joblisting database. Assuming that you have the qualifications for the job, what are the steps you would follow to prepare for a job interview? What behavioral and traditional questions would you be prepared to answer for this job? Solution: Look for plans that include elements such as, research company via the web; write three questions to ask the interviewer at the end of the interview; list my current qualifications that would make me an excellent candidate; what Ill say when asked why I feel I am the best candidate. 5. Participate in a mock interview for a sample job opportunity as described by your instructor. Use the Interview Rubric to evaluate your skills as an interviewer and interviewee. Solution: Sample questions include: 1. How are you qualified for this job? 2. Tell us about your present job. A: Focus on the aspects of your current job that are the most relevant to the job you're interviewing for. 3. What steps would you take prior to approving payment for computer equipment? A: Among other things be sure to check the purchase order and verify receipt in working condition.) Oracle Academy 5 Copyright 2012, Oracle. All rights reserved. Appendix A: Interviewing

4. What experience have you had in creating graphics? 5. Assume that you been appointed as a Technical Staff Assistant. You've been asked to train one of the Department manager's on a PC application. What will you do to make sure that the training is as effective as possible? A: Identify the training needs and address those needs. 6. What is your greatest strength? A: This is a people job, so emphasize a people "related" skill. 7. What aspect of your current job do you dislike the most? A: Don't focus on those aspects which are vital to the job you're interviewing for. 8. Is there anything we've missed?

Oracle Academy

6 Copyright 2012, Oracle. All rights reserved.

Appendix A: Interviewing

Java Fundamentals and Java Programming Instructor Resource Guide


INSTRUCTOR NOTES FOR SLIDES Appendix A Networking Slide 1: Networking Networking can be done either in person or online. A social networking website can be a good way to make connections with people with similar interests and goals. They can be a way to connect with or "meet" people that a student may not have had the opportunity to beforeincluding other students, staff, faculty and even alumni. Depending on the type of information students provide online, social networking sites can also negatively affect a job search, especially if students post embarrassing photos or text. Information found on social networking sites can have negative repercussions. In addition to mentioning the above to students, it may be useful to remind them about keeping safe online. Do not post private information, including your cell phone number, home address, class schedule, social plans, etc. unless you are prepared for anyone to find you/track you down, any time of the day or night. Slide 2: What Will I Learn? No instructor notes for this slide. Slide 3: Why Learn It? Your Network of Contacts Networking is a skill that is very useful to hone at a young age. If students practice networking, it will become easier as they get older. Slide 4: Why Learn It? Your Network of Contacts No instructor notes for this slide. Oracle Academy 1 Copyright 2012, Oracle. All rights reserved. Appendix A: Networking

Slide 5: Tell Me / Show Me What is Networking? No instructor notes for this slide. Slide 6: Tell Me / Show Me How to Build Your Network Have your students do an informal in-school exercise to network. Have them talk to 6-8 of their friends to find out what their mother and/or father do for a living and where they work. If time allows, have the friends to to the parents of the other friends to ask more direct questions on how the people they know in business could help someone find a job. Slide 7: Tell Me / Show Me Useful Skills for Networking No instructor notes for this slide. Slide 8: Tell Me / Show Me Maintaining Your Network No instructor notes for this slide. Slide 9: Tell Me / Show Me Benefits of Networking No instructor notes for this slide. Slide 10: Tell Me / Show Me Online Networking An informal exercise that can be completed online would be the same as the informal exercise described for slide 5. Have the students use their online social networking environment to ask their friends what their parents do for a living and where they work. Slide 11: Tell Me / Show Me Online Networking (continued) No instructor notes for this slide. Slide 12: Summary No instructor notes for this slide.

Oracle Academy

2 Copyright 2012, Oracle. All rights reserved.

Appendix A: Networking

Slide 13: Try It/Solve It No instructor notes for this slide.

Oracle Academy

3 Copyright 2012, Oracle. All rights reserved.

Appendix A: Networking

Practice Solutions LESSON 13 Networking

Try It / Solve It
1. In your own words, define the term networking. Solution: Networking is the process of developing and maintaining contacts and personal connections with a variety of people who might be helpful to you and your career. Networking involves meeting people who can be of help to you, collecting and updating contact info, like phone numbers and e-mail addresses, keeping in regular contact with those in your network, thanking people for their help, and helping others when asked. 2. Identify your initial network of contacts by listing your: a) Friends b) Relatives c) Co-workers d) Former co-workers e) Any other contacts Solution: Answers will vary. 3. What do you see as possible future benefits of creating your own personal network? Solution: Answers will vary but can include: Help find a job Introduce you to a mentor who will advise you on how to grow your business Provide expertise in an area that you may not have developed yourself Someone in your network may know or even discover tools and resources that can help you Provide leads and referrals for sales Provide leads for jobs and informational interviews

4. Are you a member of any online networking websites? List the networking websites you utilize. If a potential employer searched on your name, what type of information would appear? Solution: Answers will vary. 5. Describe how online networks help your job search. Also describe how they can negatively affect your job search. Solution: Answers will vary but should include: Oracle Academy 4 Copyright 2012, Oracle. All rights reserved. Appendix A: Networking

Someone in your network may tell you about a job opening Someone in your network may be able to introduce you to someone who is looking to fill a position or is willing to give you an informational interview Networks can negatively affect a job search if information offers a negative reflection of their personal character. For example: Compromising and inappropriate pictures Negative statements about current or previous employer

6. Optional. Go into several work environments and ask people how they found their job. If they found their job through another person ask them if they asked that person for help in finding a job or if they just mentioned it to them casually. Solution: Answers will vary.

Oracle Academy

5 Copyright 2012, Oracle. All rights reserved.

Appendix A: Networking

Section 1 Instructor Resource Guide


INSTRUCTOR NOTES FOR SLIDES SECTION 1 LESSON 1 Welcome Slide 1: Welcome No instructor notes for this slide. Slide 2: What Will I Learn No instructor notes for this slide. Slide 3: Why Learn It - Purpose This slide is intended to generate interest in the course. Ask students to consider how Java is used in their daily lives. Examples are: Play games and watch videos on-line Google Maps Blu-ray Disc Mobile phones Amazon Kindle

Slide 4: Course Goal Explain to the students that the course is designed for beginners. The actual Java programming will come later in the course after the students first learn techniques for thinking like a programmer via tools like Alice3 and Greenfoot. Slide 5: Course Map Explain to students how the lessons will be covered over the course of the unit or semester, using the course map in Section 0 of Oracle iLearning as a guide. Slide 6: Course Map (cont.) Explain to the students the value in the completion of both Java Fundamentals and

Programming in terms of future career paths in addition to Advanced Placement and/or Oracle Java certification. Slide 7: Teaching and Learning Strategy No instructor notes for this slide. Slide 8 and 9: Oracle iLearning Provide the students a brief overview of the iLearning system including: How they will get accounts Where they will log-in How to launch the Java course How to access slides and quizzes Guidelines for taking quizzes and exams

Slide 10: Software Provide the students an overview of the lab set-up. Any special instructions should be pointed out at this time (e.g., lab hours, log-in and password). Direct students to the applications that will be used during the course as well as the folder structure for saving work. Slide 11: Integrated Development Environment No instructor notes for this slide. Slide 12: Teamwork Although students may have worked on teams in the past, they may not have been given guidance on how to work on teams. The key on this slide is that teams comprise individuals with unique talents who work together toward a common goal. Slide 13: Importance of Teamwork Teamwork has become an integral part of the working world and managers examine teamwork skills when evaluating a person for employment. Some companies rely on teamwork because their products are so complex that it requires a team with multiple skills to produce and support. It is important that students learn teamwork skills. Further reading: Teamwork in the Classroom. NDT Resource Center. Accessed on January 2, 2012, URL: http://www.ndt-ed.org/TeachingResources/ClassroomTips/Teamwork.htm

Slide 14: Teamwork Some students may think that teams of 1 are better than multi-person teams. Ask the class if anyone feels that way? This may be because they have had negative experiences with teams in the past. Future slides show ideas for working around team conflict. Ask the class why a team of 4 is more desireable than a team of 1. (Because a productive team of 4 can accomplish four times as much as 1 person.) Now ask the benefits of multi-person teams. (Lots of ideas because many heads are better than one.) Discuss with the students their experiences with teams, both positive and negative. It is common for teams to have conflict. This is referred to as Storming in Bruce Tuckman's model of team development. As the team works more closely, students may become more vocal and compete with each other. Students can get discouraged at this stage, but it is productive and is an essential part of teambuilding in the workplace. All issues and concerns are brought out in the open and this is important, as long as the conflict is constructive and comments are positive. Discuss how you need to learn teamwork skills and how choosing to work with people on a challenging team will help you to develop your own skills and prepare you for the workforce where your salary could be jeopardized by not performing on a team well. Here are some ways to address team conflict and challenges: 1. Use a self-assessment so individuals can report on their efforts 2. Use a team rubric so individuals can report on their peers' efforts 3. Identify a process for escalating issues if the team project is in jeopardy Slide 15: Challenges of Working on a Team Below are some tips to address the issues on the slide: Make sure that everyone in the group is clear about their expectations for the project. Regular meetings and detailed progress reports by all group members will allow advance warning of possible time shortages. Make sure that everyone in the group understands the situation of the others. Be understanding and patient with each other. It is in your best interests to attend all group meetings, even if you don't have much to report, because you can keep up with what the rest of group is doing. You don't have any right to complain about the end result if you don't attend meetings and participate in the group. Offer support to group members when they seem behind. In the worst case, be prepared to have someone else finish the task or tasks. Make the effort to communicate with other group members promptly. It takes less than a minute to send a short reply to an email, and that is usually all that is required. Provide input and feedback to others, but concentrate on your own tasks, and trust the others to do the same. Slide 16: Challenges of Working on a Team (cont.) No instructor notes for this slide.

Slide 17: Characteristics of Effective Teams A team must have a clear understanding of their common goal. It is shared desire-not talentthat creates teamwork. Team members do not have to like each other to be successful, they need to respect each other and have the shared interest in completing the goal. Slide 18: Step 1: Forming and Introducing Teams There are many different ways to form teams, and there are advantages and disadvantages to each. You may want to ask the students how their teams have been created in the past and the pros and cons. Assigned teams (i.e., the teacher assigns the teams): Instructor can balance the teams in terms of knowledge, skills, experience, discipline, and demographic characteristics. Random team assignment: for quick tasks such as those lasting one class period, an instructor may choose to randomly assign teams. This is quick and easy to implement and students perceive it to be fair as there is no teacher bias. Self-selected team assignment: Students tend to choose their friends creating homogenous groups which may limit learning opportunities. However, as students tend to know each other and their outside schedules, these groups may be easier for them to coordinate.

Further reading: The Team Developer: An Assessment and Skill Building Program. By Jack McGourty and Kenneth P. De Meuse. Accessed on January 2, 2012, URL: http://www.gatewaycoalition.org/files/team_developer/Instructor_Manual.pdf Slide 19: Step 2: Establish Team Roles A good team is like an orchestra, each musician has unique role to play. When every member is willing to play in harmony, teamwork evolves. The roles and responsibilities will change depending on the project/task at hand. Slide 20: Step 3: Define Tasks Requests students to openly brainstorm tasks that could be possible for a software project. Tell students that tasks could also have a value rating. If you find you have a team with a slacker you can refer back to the value rating when doing a teamwork self assessment at the end of a project. Slide 21 Step 4: Assign Tasks What to watch for Requests students to openly brainstorm tasks that could be possible for a software project. Slide 22: Building an Effective Team

Below are tips for working effectively with a team: Make sure that everyone in the group is clear about their expectations for the project. Regular meetings and detailed progress reports by all group members will allow advance warning of possible time shortages. Make sure that everyone in the group understands the situation of the others. Be understanding and patient with each other. It is in your best interests to attend all group meetings, even if you don't have much to report, because you can keep up with what the rest of group is doing. You don't have any right to complain about the end result if you don't attend meetings and participate in the group. Offer support to group members when they seem behind. In the worst case, be prepared to have someone else finish the task or tasks. Make the effort to communicate with other group members promptly. It takes less than a minute to send a short reply to an email, and that is usually all that is required. Provide input and feedback to others, but concentrate on your own tasks, and trust the others to do the same.

Slide 23: Try It Ask students to work together and form teams of three to five people. Learn each others names Determine roles Brainstorm tasks Assign tasks Create a team name

Students are encouraged to share their team name and roles with the class. Slide 24: Terminology No instructor notes for this slide. Slide 25: Summary No instructor notes for this slide. Slide 26: Practice Vocabulary 1. IDE A software tool used by computer programmers to develop software applications that includes tools for writing, editing,

compiling, deploying, and debugging programs. 2. Task A very specific work related responsibility that requires completion, usually within a specified period of time; it is always assigned to a single owner. This account will provide you access to the course curriculum, quizzes, and exams. A group of individuals with unique talents sharing those talents to achieve a common goal.

3. iLearning 4. Team

Try It/Solve It 1. Power on your computer. 2. Explore the software and folders provided for this course. 3. Introduce yourself to one person in the room and tell them two interesting things about yourself. 4. Introduce the person you have met to your class. 5. In this exercise, you will work with a team to explore the structure of the Java Fundamentals course in iLearning. You will document and present your findings. Form a team of 3 to 5 people. Establish roles, such as technical lead(s), writer, presenter. Identify tasks for each role. Explore the curriculum for Java Fundamentals. Identify all of the components (presentations, try its, resource files, quizzes, exams) and how they are organized. Present your findings to the rest of the class.

6. In your journal, create an entry entitled Teamwork. Describe what teamwork entails, and what you need to do to be a good team member during project work. 7. In your journal, create an entry entitled Course Goals. In your own words, describe the goals of the course in paragraph or list form. 8. In Oracle iLearning, review the course map. In your journal, create an entry entitled Course Map. Describe how much time you will devote to the course each week, and which topics will be covered. Describe which section you are most excited to learn about and why. 9. In your journal, create an entry entitled Teaching Format. Describe the teaching format that will be used for this course.

SECTION 1 LESSON 2 Introduction Slide 1: Introduction No instructor notes for this slide. Slide 2: What Will I Learn No instructor notes for this slide. Slide 3: Why Learn It? No instructor notes for this slide. Slide 4: What is an Animation? No instructor notes for this slide. Slide 5: 3D Objects No instructor notes for this slide. Slide 6: Virtual World No instructor notes for this slide. Slide 7: Virtual World (cont.) No instructor notes for this slide. Slide 8: View an Alice 3 Animation No instructor notes for this slide. Slide 9: Step 1: Launch Alice 3 No instructor notes for this slide. Slide 10: Step 2: Locate Example Animation The example files are located on the videos page for this lesson. Students should now: 1. Go to the videos page for this lesson in Oracle iLearning. 2. Locate and click-on the URL entitled Greetings Animation Example Code. 3. Save the zip file to a location you will remember.

4. Extract the files to a location you will remember. If students are unable to run the Alice file for any reason, they can watch the Greetings video example, located on the videos page for this lesson. Slide 11: Step 3: Play the Animation At this point, you may want to run the Greetings animation in class with your students, or have them watch the corresponding video. Slide 12: Greenfoot No instructor notes for this slide. Slide 13: Greenfoot (cont.) No instructor notes for this slide. Slide 14: Play a Greenfoot Game No instructor notes for this slide. Slide 15: Step 1: Launch Greenfoot No instructor notes for this slide. Slide 16: Step 2: Open Game File The example file is located on the videos page for this lesson. Students should now: 1. Go to iLearning. 2. From the videos page for this lesson, locate and click-on the URL entitled Flying Frog Example Code. 3. Save the zip file to a location they will remember. 4. Extract the files to a location they will remember. Slide 17: Step 3: Set Up the Game No instructor notes for this slide. Slide 18: Step 4: Play the Game At this point, you may want to have students play the game in Greenfoot. Slide 19: Greenfoot Objects

No instructor notes for this slide. Slide 20: Greenfoot Classes No instructor notes for this slide. Slide 21: Greenfoot Objects and Classes Example At this point, you may want to do the following activity with your students: 1. Identify three objects in your classroom. For each object, have your students: Identify three states. Identify three behaviors.

Slide 22: Why Learn These Programs? No instructor notes for this slide. Slide 23: Why Learn Alice 3? No instructor notes for this slide. Slide 24: Why Learn Alice 3? (cont.) No instructor notes for this slide. Slide 25: Why Learn Greenfoot? No instructor notes for this slide. Slide 26: Skills Needed to Generate Animations and Games No instructor notes for this slide. Slide 27: Skills Needed to Generate Animations and Games (cont.) No instructor notes for this slide. Slide 28: Define a Scenario No instructor notes for this slide. Slide 29: Define a Scenario (cont.) No instructor notes for this slide.

Slide 30: Scenario Example Try the following activity with your students (the following can be completed individually or with a group): 1. Study an animation. 2. Go to an animation website of your choosing. 3. Watch a short animation. Describe the scenario for the animation. Ensure the scenario contains the three parts (story, objects, actions). Clearly indicate the result of your scenario. 4. Create a new scenario. 5. Ensure that the scenario contains the three necessary parts story, object, and actions. 6. Be sure to clearly indicate the result of your scenario. 7. When you are finished, present the scenario and the result to the class. Slide 31: Components of a Team Project No instructor notes for this slide. Slide 32: Standards for Team Success No instructor notes for this slide. Slide 33: Standards for Team Success (cont.) No instructor notes for this slide. Slide 34: Standards for Team Success (cont.) No instructor notes for this slide. Slide 35: Journal Review the Cookbook to Success file in the resources section. Slide 36 Journal (cont.) No instructor notes for this slide. Slide 37: Journal (cont.) No instructor notes for this slide. Slide 38: Code of Ethics No instructor notes for this slide.

Slide 39 Code of Ethics (cont.) No instructor notes for this slide. Slide 40 Code of Ethics (cont.) No instructor notes for this slide. Slide 41 Code of Ethics (cont.) No instructor notes for this slide. Slide 42: Cyber Security No instructor notes for this slide. Slide 43: Cyber Attacks and Cyber Security Discuss cyber security and its impact to your country, including your government and local corporations. You may find recent news articles describing security breaches. Slide 44: Terminology No instructor notes for this slide. Slide 45: Summary No instructor notes for this slide. Slide 46: Practice Vocabulary 1. 3D 2. Rubric 3. Object-oriented programming (OOP) 4. Cyber ethics 5. Virtual world 6. Cyber security An object that that displays height, width and depth. A team defined set of rules and standards used for project assessment. Programming that allows the programmer to manipulate objects. A code of behavior for using the Internet. A world that contains 3D objects and simulates a real or imaginary physical environment. The establishment of processes with the sole objective of mitigating cyber attacks.

7. 2D 8. State/behavior 9. Class Try It/Solve It

An object that that displays height and width only. All objects have which two characteristics? The general set of instructions and rules that objects will follow.

1. Identify three states for the object class airplane. Type (e.g., Propeller, Jet) Color (e.g., white, blue, red) Number of wings (one or two) Flying up Flying down Looping

2. Identify three behaviors for the airplane.

3. Open, set-up and run the flying_frog Greenfoot game. Identify at least three changes you could make to the game to make it better. The frog stops once the final fly is eaten The game sets itself up The frog only has X seconds to catch all the flies

4. In your journal, create an entry entitled First Scenario. Draw a picture of your own scenario using two moving and three non-moving objects. Clearly draw and label each object. Identify the objects to move and those to remain stationary. Identify how each object will move. Describe the result of your scenario.

5. Gather in teams and review the IEEE Code of Ethics. Does your team unanimously support the Code? What will occur if a member breaks a rule of the Code? 6. Gather in teams and draft a team assessment rubric. Use the following template as a guide. Think about team projects you have worked on in the past and answer the following questions out loud: What criteria made the final product and team contributions great? What made working on a team particularly challenging? Is everyone on your team in agreement about the criteria and scores?

7. Creatively imagine a cyber attack at your school. Consider what and who would be affected. In your journal, create an entry entitled Cyber Attack. Create a plan to mitigate such an attack.

8. In your journal, create an entry entitled Purpose of Alice 3 and Greenfoot. Describe how you will use both to learn Java. 9. In your journal, create an entry entitled Programming Skills. List the skills needed to create an animation or generate a game. 10. In your journal, create an entry entitled Document Programming Projects. Describe how you will use your journal to document the projects you will work on throughout the course. Team Assessment Rubric Category Contributions 4
Routinely provides useful ideas when participating in the group and in classroom discussion. A leader who contributes a lot of effort. Actively looks for and suggests solutions to problems. Is never publicly critical of the project or the work of others. Always has a positive attitude about the task(s).

3
Usually provides useful ideas when participating in the group and in classroom discussion. A strong group member who tries hard.

2
Sometimes provides useful ideas when participating in the group and in classroom discussion. A satisfactory group member who does what is required.

1
Rarely provides useful ideas when participating in the group and in classroom discussion. May refuse to participate.

Problem Solving

Refines solutions Does not suggest or suggested by others. refine solutions, but is willing to try out solutions suggested by others. Is rarely publicly critical of the project or the work of others. Often has a positive attitude about the task(s). Is occasionally publicly critical of the project or the work of other members of the group. Usually has a positive attitude about the task(s). Focuses on the task and what needs to be done some of the time. Other group members must sometimes nag, prod, and remind to keep this person ontask. Often listens to, shares with, and supports the efforts of others, but not always.

Does not try to solve problems or help others solve problems. Lets others do the work. Is often publicly critical of the project or the work of other members of the group. Is often negative about the task(s). Rarely focuses on the task and what needs to be done. Lets others do the work.

Attitude

Focus on the Task

Consistently stays focused on the task and what needs to be done. Very self directed.

Focuses on the task and what needs to be done most of the time. Other group members can count on this person.

Collaboration

Almost always listens to, shares with, and supports the efforts of others. Tries to keep people working well together and mentors team members when appropriate.

Usually listens to, shares, with, and supports the efforts of others. Does not cause "waves" in the group.

Rarely listens to, shares with, and supports the efforts of others. Often is not a good team player.

Section 2 Instructor Resource Guide


INSTRUCTOR NOTES FOR SLIDES SECTION 2 LESSON 1 Telling a Story Visually Slide 1: Telling a Story Visually What to Watch For This is a lesson to introduce students to the problem solving process and how it will help them plan and organize their animation before they program it in Alice3. Students learn the concept of storyboarding: an effective method to visually and textually plan the animation before programming takes place. Relate the idea of how professionalsboth in the animation industry and in computer programmingplan out their requirements specifications in detail before implementing them. In short, it is important to know what you are programming before you program it. Connections Ask students to find examples of computer animations on the internet. Sources could include websites, films, short videos, or games. Ask them to brainstorm three planning activities that they think would need to take place before the animators could develop the animation in a computer program. At this point, students will not know the planning process, but can make an educated guess. Have students present their findings to the class. Slide 2: What Will I Learn? Objectives No instructor notes for this slide Slide 3: Why Learn It? Purpose Ask students: Think of an animation that you have seen recently. How long was it? Describe what it looked like and what the story was about. Do you think that you could create that same animation on your own? Would you need to work in a team? What would you need to do to plan the animation? Even simple animations require detailed planning. Animations as complex as a full-length feature film or video game could require tens or hundreds of professionals to work on them for years. The time that you use to plan your animation, coupled with your programming skills in Alice 3, will make a big difference in the quality of the animation you produce. Slide 4: Problem Solving Approach to Animation

There are no instructor notes for this slide. Slide 5: Problem Solving Approach to Animation (cont.) Ask students to think about when they have used the problem solving process in school. Provide some examples to familiarize them with this concept. Examples: Science experiments, math problems, or writing a fictional story with a conflict and resolution. The following slides define the animation vocabulary terms (e.g., scenario, storyboard, program, etc.) Students may not be familiar with these terms, however, you can provide a brief explanation here of what each step entails. Slide 6: Animation Defined There are no instructor notes for this slide. Slide 7: Step 1: Define the Scenario There are no instructor notes for this slide. Slide 8: Step 1: Define the Scenario (cont.) Explain to students that the step missing in this table between defining the scenario and creating the animation is the process to create the storyboard. The scenario starts with the problem or task, and then the animation is produced based on all of the details that you document in the storyboard. At this point, you may want to do an In-class activity with your students. Have students try the following activity below: 1. Define a scenario with a partner. 2. Physically act out the scenario. 3. List the objects in the scene and the actions that took place. Example: Scenario: Person plays fetch with his dog Objects in the scene: Ball, person, dog Actions: Person throws a ball Dog runs to catch the ball in his mouth etc...

Slide 9: Step 2: Design a Storyboard

There are no instructor notes for this slide. Slide 10: Step 2: Design a Storyboard (cont.) Explain that a textual storyboard has more detailed text. Instead of showing what happens (as in the case of a visual storyboard), a textual storyboard lists what each object does in each scene. Students will start by creating a visual storyboard to map out their story, then create an algorithm for each scene of their story. A combination of the visuals and algorithms will guide the development of their animation. Slide 11: Step 2: Design a Storyboard (cont.) Explain that for their first animation, especially with those who are beginners to Alice3, students should keep it simple. The animation should have no more than two main characters that act and move, with no more than a few non-moving objects. The main characters should have limited movements. Animals or people with limited motions are best. Slide 12: Step 2: Design a Storyboard (cont.) No instructor notes for this slide. Slide 13: Step 2: Design a Storyboard (cont.) Explain the difference between the visual storyboard and this textual storyboard example. Explain how the textual storyboard gives all of the instructions for what the animator should program to make the objects in the animation move and interact. Within these basic instructions, there are many sets of mini-instructions that will need to be programmed. For example, Boy walks away will be a sequence of programmed actions in Alice3 such as Boy turns to left. Boy walks 4 meters. At this point, you may want to do an In-class activity with your students. 1. Using the scenario you developed earlier in the lesson, students should create a short visual and textual storyboard in their journal. 2. Then, they should create a flowchart of the storyboard in their journal. 3. They should review their work with a partner. For this exercise, students will draw a visual storyboard in their journal with a pencil. To create the storyboard template, students can draw a table using a ruler. Within each cell of the table, they draw an image of what happens in the scene, with a short textual explanation underneath that explains what happens. Explain to students that this is a way to form their ideas for what the scenes and objects will look like, how many scenes will take place, how many objects will be included, and where the objects will be placed in the scene. They should not be afraid to erase, make changes, or even start over. This is the time to do all of the brainstorming and planning. Once the visual storyboard is done, on a separate page of their journal, students will create a textual storyboard. To do this, they examine each scene separately, writing the actions that occur in each scene in sequential order. Explain to students that these instructions will be

used to program the objects in the animation, so they know exactly what the objects need to do. Remind them that within each basic action (e.g., walk, fly) there are many instructions that need to be programmed to tell the object what to do. Students should keep their animations very simple if this is their first time using Alice3, with limited object movements. Finally, students should create a flowchart that documents the storyboard's process flow. They should ensure the story works in a logical order and fix any issues that come up. Students should think of all of the possible effects of each object's action. Slide 14: Step 3: Program the Animation There are no instructor notes for this slide. Slide 15: Step 4: Run the Animation There are no instructor notes for this slide. Slide 16: Step 4: Run the Animation (cont.) There are no instructor notes for this slide. Slide 17: Terminology There are no instructor notes for this slide. Slide 18: Summary There are no instructor notes for this slide. Slide 19: Practice Vocabulary 1. Program Code 2. Animation 3. Problem Solving Process 4. Bug 5. Functional Decomposition 6. Debugging 7. Rendering 8. Algorithm The instructions written in Alice3 that tell the animation what to do. A sequence of actions that simulate movement. Identify the problem, develop a solution, implement the solution, test and revise the solution. An error or break in a software program. The process of taking a complex problem or process and breaking it down into smaller parts that are easier to manage. The process of finding software bugs in a software program. The process whereby the system converts the image frames into a seamless animation. A list of actions to perform a task or solve a problem.

9. Visual Storyboard 10. Scenario 11. Textual Storyboard

Series of illustrated images that represent the main scenes in the animation. Called a requirements specification in computing, this is a story in the form of a problem to solve or task to perform. Detailed, ordered list of the actions each object performs in each scene in the animation.

Try It/Solve It 1. In your journal, create an entry entitled Animation vs. Scenario. Then, create a table that lists the differences between an animation and a scenario. Animation Sequence of actions that simulate movement Series of image frames 2. Label the following descriptions as either an animation or a scenario. Animation or Scenario? scenario animation scenario scenario animation Penguin moves to the ball. Ball moves to the center of the circle. Bunny hops along a path. Bunny hops onto a rock to uncover a bug. A car drives through a city trying not to run into buildings A frog jumps up over a pond to eat a mosquito Description Demonstration of a chemistry experiment Scenario Story in the form of a problem to solve or task to perform

3. In your journal, create an entry entitled Professional Animations. Write three examples of professional animations. For each example, list the objects that acted in each animation, and describe the background scenery. Use the following format: Animation Example Penguin kicks the ball and the ball goes into the water. Objects in Animation Penguin Ball Blue circle Object Action Background Scenery

Penguin moves to ball Igloo Ball moves to circle

4. In your journal, create an entry entitled Animation Development Process. List the four animation development steps. Then, write a plan for your animation using steps 1 and

2 from the lesson as a guide. Four animation steps: Define the scenario, design a storyboard, program the animation, and run the animation. The plan that students write for their animation will vary. 5. Apply the concept of functional decomposition to the following scenario: An animator wants to create an animation to raise awareness about the steps we can take to protect dolphins, but she is overwhelmed with all of the work that it takes to create an animation, and doesn't know where to start. In your journal, help this animator by breaking down the steps to create a dolphin animation into tasks that will be easier for the animator to manage. 6. In your journal, list the objects that would need to be animated in the following story: A duck swims alongside a swan in a pond. The swan, after eating a fish in the water, is annoyed by a bee buzzing overhead. Eventually, the bee flies back to its beehive in a tree and leaves the swan alone. Objects: Duck, swan, pond, fish, bee, beehive, tree. 7. Search for and watch a short, 1-2 minute animation on the internet. In your journal, create an entry entitled Internet animation. Describe the animation you watched and list the scenario, objects, and actions that took place. 8. In your journal, create an entry entitled Define a Scenario. Define a scenario for an animation you want to create. Describe what type of scenario you picked and why. 9. In your journal, create an entry entitled Visual Storyboard. Create a visual storyboard for the following scenario: A dragon breathes fire onto a tree, which causes the tree to burn up. A cloud approaches and rains onto the tree to stop the fire. 10. In your journal, create a textual storyboard for the following scenario: A bird is flying through the sky when it approaches a plane. The pilot of the plane and the bird exchange greetings. Create a flowchart for the storyboard. 11. In your journal, create an entry entitled My Scenario. Then, define a scenario for an animation you want to create. Then, create a visual and textual storyboard. 12. Create a flowchart for the following animation: A girl walks towards her car. She takes off her gloves and sets them on the top of the car. She takes her keys out of her purse and gets into the car. She drives away and the gloves fall off of the car Answer:

true Girl walks toward car false end Gloves on car? Takes keys out Gets into car Drives away

Gloves fall off car

SECTION 2 LESSON 2 Creating a Scene by Adding and Positioning Objects Slide 1: Creating a Scene by Adding and Positioning Objects What to Watch For This is a lesson to introduce students to the scene development tools in Alice3. Students learn how to create a new project, define the elements of the scene, and add objects from the 3D model gallery to the scene. Discuss the importance of scenes and how they give us a sense of time and space in an animation. They provide the space for the actors to act out the scenes defined in a storyboard (during the planning stages of the animation development process). Developing the initial scene is the first step to the animation implementation process. Slide 2: What Will I Learn? No instructor notes for this slide. Slide 3: Why Learn It? Share the value of Alice3 in terms of saving students' time. Students can accomplish far more in their animationand do it fasterwith the Alice3 tools. They can also play around and try out different scenery, objects, and positioning to get the animation to display just the way they want it. Slide 4: Initial Scene This differs from other scenes in the animation because it's the first scene in the animation. Students at the beginning stages of programming will likely create an animation with only one scene. As students become more proficient with Alice3, they can utilize multiple camera perspectives and set up different scenes in a project to give the appearance of different locations, etc. Slide 5: Initial Scene (cont.) At this point, you may want to do the following activity with your students: 1. On the internet, go to an animation website of your choosing. Watch a short animation as a class, or have students do this in groups. 2. In their journals, students should create an entry entitled Initial scene. Students should describe how the animators created the initial scene. Include descriptions of the template, scenery objects, and acting objects in the scene. 3. Then, students should describe the initial scene that they want to create. They should list the template, scenery objects, and acting objects they would include in the scene. Slide 6: Develop a Scene

Students may not understand some of the terminology at this point, but will learn it throughout the course of the lesson. Slide 7: Step 1: Create a New Project Students should designate a location where they will save all of their animation projects. The folder should be named, Alice 3 Projects. Slide 8: Step 1: Create a New Project (cont.) No instructor notes for this slide. Slide 9: Step 1: Create a New Project (cont.) At this point, you may want to do the following activity with your students. They can do this activity individually or in groups: 1. Open Alice 3, and select a template for a project. 2. In the File menu, select Save As... and give the file a descriptive name. 3. Save the project. They should keep this file open or handy, as they will use it again later in the lesson. Slide 10: Step 2: Locate Classes No instructor notes for this slide Slide 11: Step 2: Locate Classes (cont.) No instructor notes for this slide. Slide 12: Step 2: Locate Classes (cont.) You cannot design or import objects created in other design programs. Slide 13: Step 2: Locate Classes (cont.) No instructor notes for this slide. Slide 14: Step 2: Locate Classes (cont.) No instructor notes for this slide. Slide 15: Step 3: Add Instances No instructor notes for this slide.

Slide 16: Step 3: Add Instances (cont.) No instructor notes for this slide. Slide 17: Step 3: Add Instances (cont.) With instances, you can: Use all properties of the class (e.g., instance of a dog can bark and walk) Change the object's properties, such as color, size, orientation, etc. Program the object to perform new types of tasks (e.g., program the cat instance to hop like a bunny, in addition to walking and meowing) Save the objects to use in other projects

Slide 18: Step 3: Add Instances (cont.) At this point, you may want to try the following activity with your students: 1. Using the animation project students created earlier, have students add 2-3 acting objects and 2-3 scenery objects to the scene. 2. In their journals, students should create an entry entitled Instances. They should document the instances of objects they added to their scene, and include the following: Name of the instance Class it belongs to Whether the instance is scenery or an actor.

Slide 19: Step 4: Save the Project No instructor notes for this slide. Slide 20: Step 4: Save the Project (cont.) Explain that animators do not start over with completely new scenery to develop. Reusing scenery, objects, and programming code wherever possible is crucial to save time. At this point, you may want to do the following In-class activity with your students. Have students open the animation they created previously. They should re-position all of the objects, and save the animation as a different file name. They should open each file and compare how the object's positions have changed. Slide 21: Step 5: Position Objects No instructor notes for this slide. Slide 22: Step 5: Position Objects (cont.)

No instructor notes for this slide. Slide 23: Step 5: Position Objects (cont.) No instructor notes for this slide. Slide 24: Step 5: Position Objects (cont.) No instructor notes for this slide. Slide 25: Step 5: Position Objects (cont.) No instructor notes for this slide. Slide 26: Step 5: Position Objects (cont.) No instructor notes for this slide. Slide 27: Step 5: Position Objects (cont.) No instructor notes for this slide. Slide 28: Step 5: Position Objects (cont.) No instructor notes for this slide. Slide 29: Step 5: Position Objects (cont.) At this point, you may want to try the following activity with your students. 1. Create a new animation project called Positioning Objects. Save the project. 2. Create a scene for the following scenario: Two dolphins are swimming on the lagoon floor. 3. Position the objects in your scene in the following ways: Reposition the first dolphin's head so it tilts slightly upward. Reposition the second dophin's tail so it points slightly upward. Reposition both dolphins to face the left, then right, then back of the scene. Use each handle style to experiment with different positioning of the dolphin's full body, and body sub-parts (tail, head, fins, etc.) Use three different procedures to position the dolphins. Save the animation.

If there is time, discuss object positioning as a class. Have students share how they positioned the objects and what tools they used.

Slide 30: Terminology No instructor notes for this slide. Slide 31: Summary No instructor notes for this slide. Slide 32: Practice Vocabulary 1. Initial Scene 2. Instance 3. Orientation 4. Template 5. Gallery 6. Scene Editor 7. Axes The first scene in the animation that contains the animation's objects and background template. An object from a class once its created and added to the scene. An object's sense of direction. Provides the sky and ground for the scene. A collection of 3D models that can be inserted into the scene. Contains the tools required to edit the scene. The three dimensional x, y, and z coordinates that each object resides on. They can be manipulated to change the object's position and appearance. The specifications that define the appearance and movement of a 3D object. A set of instructions, or programmed code, for how the object should perform a task. Default, rotation, movement, and resizing.

8. Class 9. Procedure 10. Handle Styles Try It/Solve It

1. Watch a short animation online on a website of your choosing. Create a journal entry entitled Initial Scene. Describe the components of the initial scene of the animation you watched. 2. In your journal, create an entry entitled Developing a Scene. List the steps to develop a scene. Describe the sub-tasks that take place within each of the steps. Steps to develop a scene: 1. Create a new project and select a template. 2. Locate objects in the gallery. 3. Add an instance to a scene. 4. Position objects within the scene. 5. Save your scene.

3. Describe the difference between the Scene editor and the Code editor. Indicate which editor displays by default when an Alice project is opened. 4. Open Alice3. Review the gallery of classes. In your journal, document three different folders, and one class that appears in each folder. 5. Create a folder on your computer, network, or memory stick where you will save all of your animation projects. Name this folder Alice3 Animation Projects. Then, create an initial scene for the following scenario: Scenario: A cheshire cat and march hare sit next to each other, in a desert, in front of two mushrooms. Note: You will need to add procedures that manipulate the joints of each object in order to make them sit down. 6. Create a new scene for the following scenario: a school of fish swim through a coral reef and notice trash dumped by humans. Create an underwater scene with a school of fish that are positioned to the left of the scene (the viewer's left), as if they are going to swim across the scene. Add many scenery objects to make the underwater area look like a coral reef. Then, add a few objects that should not be in a coral reef that were dumped there by humans, and position them to appear as if they have fallen to the ocean floor. Save the project. 7. Create a new scene for the following scenario: a family celebrates a birthday. Create a scene with a dining room table, chairs, and have four people stand around the table. A birthday cake should be on the table. Use the handle styles and drag and drop positioning to position the objects. Save the project. 8. Create a new scene for the following scenario: the Queen of Hearts addresses her subjects in Wonderland. Create a scene using the Wonderland template where the Queen of Hearts stands to the back and center of the scene, facing the viewer, on top of a Tea Tray. Facing her should be 10 playing cards. Use a one-shot procedural method to precisely position the playing cards in four rows of five cards each. Each card should stand about 1 meter apart (hint: When you add a new card to the scene, place it directly on top of the previously-added card. Then use a procedure to move the new card one meter away from the previously-added card). Save the project. 9. Using the previously-created Queen of Hearts scene (Practice #8), change the configuration of the playing cards so they stand in a diamond shape, facing the viewer and not the Queen of Hearts. Save a new version of the project. 10. Create a new scene for the following scenario: a tea party is held in Wonderland. Create a scene using the Wonderland template where several of the Alice storybook characters are positioned as if they are running in a circle around a tea table covered with fun objects, such as teacups and cakes. Save the project. 11. Create a new scene for the following scenario: a submarine is exploring through the ocean. Create a scene using the sea floor or lagoon floor template with a submarine positioned to move forward towards the camera through lots of seaweed. The front of the submarine should be peeking out from the seaweed. Save the project. 12. Create a new scene for the following scenario: a giant chicken has landed on the ground, scaring the people away. Using the template of your choice, create a scene where the chicken is several times larger than 3-4 people, who are positioned as if they

are running away from the chicken. Add scenery objects to make the scene more interesting. Using procedures to precisely position objects. Save the project. 13. Create a new scene for the following scenario: dogs are lined up to be judged in a dog show. Create a scene with the template of your choice. Use drag and drop positioning to line up a set of dogs next to each other, facing the viewer. Have a judge to the left of the scene facing the dogs. Put each dog on top of the prop of your choice as if each are standing on a pedestal. Save the project. 14. In your journal, create an entry entitled Precise versus Drag and Drop Positioning. Then, create a table that describes how each are used when setting up a scene. 15. In your journal, create an entry entitled Multiple Scene Versions. Then, write three reasons why it is useful to save multiple versions of a scene. 16. The x, y, z axis is used to position objects. Define x, y, and z. 17. If you were creating an animation where a spaceship was coming in and landing in a scene, which positioning method would you use to place the spaceship initially? Defend your positioning method with an explanation.

SECTION 2 LESSON 3 Using Procedures Slide 1: Using Procedures What to Watch For In this lesson, students will start to create procedures that turn their initial scenario into an animation. They will learn basic procedures to move objects, understand how actors are oriented in the world and how to manipulate an object's position, and learn how to test and modify the movements of actors. Connections Ask students to physically perform basic actions, such as waving, walking, and talking. Ask them to break down the components of each action (e.g., walking means that the left leg moves forward, then the right leg, and so on). Students need to keep this in mind as they animate 3D objects. 3D objects can move in six directions, just like humans, and even basic movements are the result of many programmed instructions that tell an object how to move. Luckily, Alice3 makes it easier for us to animate objects, because much of the work is done by the program. We just need to tell the objects how to move, and Alice3 will render the animation. Slide 2: What Will I Learn? Objectives No instructor notes for this slide. Slide 3: Why Learn It? Purpose An animator's role is much like a director's role in a movie. The animator will instruct the objects on how to move. Alice3 will take those instructions and render them into an animation. Slide 4: Prepare to Program There are no instructor notes for this slide. Slide 5: Prepare to Program (cont.) Reviewing the storyboard to determine what actions you need to program for each object. Slide 6: Prepare to Program (cont.) The Program Instructions column are the procedure and argument values, or complete instructions. The Order of Instructions column are the control statements. Students will learn these later in the lesson. At this point, you might want to do an activity where students create a textual storyboard. Students can do this individually or in groups. Try the following activity: 1. In their journal, students create a short textual storyboard for the following scenario: A hare hops quickly past a slow-moving tortoise. When the hare passes the tortoise, the tortoise says, Hey! Stop running so fast!

2. Students create a table with the following columns, then complete the information for the storyboard. Storyboard actions Instructions Order of instructions

Note: Even though students do not know the instruction and control statement concepts yet, they can make an educated guess about how the objects should move, and in what order. They will make these connections later in the lesson. Slide 7: Prepare to Program (cont.) Emphasize that students should always pay close attention to the actor that is being programmed. Slide 8: Prepare to Program (cont.) Explain that comments in a program can help logically break down tasks and organize programming efforts. Slide 9: Prepare to Program (cont.) Reiterate that one-shot procedures are only used for positioning objects, and that they are not the same procedures that are written into programming code. While they appear the same, the difference is that one-shot procedures happen once and only once, whereas procedures written in a program will execute every time the program is run. Slide 10: Prepare to Program (cont.) No instructor notes for this slide. Slide 11: Writing the Animation Program An animation program consists of a set (or sets) of instructions, written in the code editor, that tell the objects in the animation how to perform tasks. You can program the animation in the code editor. Slide 12: Writing the Animation Program (cont.) Select the object to program to access the object's properties, functions, and procedures. Slide 13: Writing the Animation Program (cont.) Students can declare new procedures so they can be used for instances over and over in an animation, for instance, when they want a group of objects to perform the same action, or

when they want a single object to repeat an action at various points of the animation. In general, it is good practice to separate out procedures to keep your code short and organized. Explain to students that the procedures command the objects to move, and provide the specifications (or arguments) for each movement, including direction, or amount of meters to move. Slide 14: Writing the Animation Program (cont.) No instructor notes for this slide. Slide 15: Writing the Animation Program (cont.) At this point, you should create a new animation project, add a single object, then demonstrate dragging a procedure into the code editor to show students how this works. Slide 16: Programming Statements There are no instructor notes for this slide. Slide 17: Programming Arguments There are no instructor notes for this slide. Slide 18: Programming Arguments (cont.) There are no instructor notes for this slide. Slide 19: Programming Arguments (cont.) There are no instructor notes for this slide. Slide 20: Programming Arguments (cont.) There are no instructor notes for this slide. Slide 21: Executing a Program There are no instructor notes for this slide. Slide 22: Object Direction There are no instructor notes for this slide. Slide 23: Move Procedure

There are no instructor notes for this slide. Slide 24: Move Toward Procedure There are no instructor notes for this slide. Slide 25: Move Away From Procedure There are no instructor notes for this slide. Slide 26: Move To Procedure There are no instructor notes for this slide. Slide 27: Move and Orient To Procedure There are no instructor notes for this slide. Slide 28: Delay Procedure There are no instructor notes for this slide. Slide 29: Say Procedure There are no instructor notes for this slide. Slide 30: Rotation Procedures There are no instructor notes for this slide. Slide 31: Turn and Roll Procedures Compared There are no instructor notes for this slide. Slide 32: Roll Procedure Example There are no instructor notes for this slide. Slide 33: Examining Sub-part Rotation At this point, you might want to do an in-class activity where students create an animation project, add two objects to the scene, and program the object to move using the various procedures reviewed in these slides. This will have students practice dragging and dropping procedures, and allow them to experiment with how different procedures work. Try the following activity:

1. Create a new animation project and name the file Procedures. Save the project. 2. Create an animation for the following scenario: Add the Stuffed Tiger object and Pig object (MyBiped class folder) to a scene. Position them a few meters apart from each other. Drag procedures into the code editor to make the Stuffed Tiger do the following actions in order: Move forward 1 meter. Move toward the Pig 1 meter. Move away from the Pig 1 meter. Move To the camera 1 meter. Orient to the pig. Delay for 5 seconds. Say I am tired from all this moving! Turn left 0.5 meters. Roll left 0.5 meters.

Slide 34: Edit Programming Statements There are no instructor notes for this slide. Slide 35: Edit Programming Statements (cont.) At this point, you might want to do an activity where students modify the procedures in the animation they previously created. This will allow them to experiment with editing arguments and procedures. Have students try the following activity: Open the previously-created animation project Procedures. Change the values of arguments in a procedure. Click the Run button to see how the values change how the object moves. Right click on instructions to delete them. Change the order of instructions. Click the Run button to see the animation changes.

Slide 36: Control Statements There are no instructor notes for this slide. Slide 37: Control Statements (cont.) There are no instructor notes for this slide.

Slide 38: Step 1: Insert Control Statement The control statements are located at the bottom of the code editor. Slide 39: Step 2: Select Instance Select the instance that you want to write programming statements for. Slide 40: Step 3: Enter Procedure There are no instructor notes for this slide. Slide 41: Step 4: Select Argument Values Students should always test an instruction after they write it, to make sure it works as intended. The values can be altered and retested as needed. Slide 42: Step 5: Repeat Steps 1-4 Students should remember to change the instance to program instructions for a different instance. Slide 43: Step 6: Run the Animation Even though students will run their animation throughout the programming process, it's important to view the full animation as a whole to make sure everything works as intended. Slide 44: Step 7: Edit Programming Statements At this point, you might want to do an activity where students create an animation project, add two objects to the scene, and program the objects to simultaneously move, turn, and roll using the Do Together control statement and procedures. Have students try the following activity: 1. Create a new animation project and name the file Control Statements. Save the project. 2. Create a scene for the following scenario: There is an underwater shipwreck scene with a pirate ship, treasure, and underwater plants. Add two sharks to the scene. 3. Program the animation. Drag the Do In Order control statement into the code editor. Enter the procedures so that the first shark moves, turns, and then rolls in order. 4. Copy the first Do In Order control statement and paste it directly below, so that a second Do In Order control statement is added with all of the procedures. Change the object for each procedure to the second shark. 5. Drag a Do Together control statement into the code editor. Drag the two complete Do In Order statements into the Do Together. This will ensure that both sharks move, turn, and roll in order, but at the same time.

6. Run the animation to test that it works. Debug the animation if necessary by changing the procedures and arguments, to ensure it works as you intended. 7. If there is time, have a few students share their animations with the class. Discuss the steps students took to program their animations, and what additional motions they could add to make the animations even more interesting. Slide 45: Debug the Animation There are no instructor notes for this slide. Slide 46: Random Numbers There are no instructor notes for this slide. Slide 47: Random Numbers (cont.) Ask students to think of other examples of random movements. Examples: Monkey swinging from a tree, snake sliding across the grass, child hopping and jumping. Slide 48: Random Numbers (cont.) There are no instructor notes for this slide. Slide 49: Random Numbers (cont.) Students could also select the first option (nextRandomRealNumberInRange 0.0, 1.0) if they want to use this set range and do not want to select custom numbers. Slide 50: Random Numbers (cont.) The minimum value is the least distance that the object will move. The maximum value is the greatest distance that the object will move. The program will select a number between these two values. Slide 51: Random Numbers (cont.) At this point, you might want to do an in-class activity where students program random motion for an animal object. Slide 52: Terminology There are no instructor notes for this slide. Slide 53: Summary There are no instructor notes for this slide.

Slide 54: Practice Vocabulary 1. Orientation 2. One-shot procedure 3. Control Statement 4. Program 5. Procedure 6. Random Numbers 7. Argument 8. Instructions Try It/Solve It 1. In your journal, create an entry titled Scene Editor vs. Code Editor. Then, write a paragraph that describes three differences between the scene editor and code editor. Then, list the features of each. 2. In your journal, create an entry titled Features of Code Editor. List the features that you have learned about thus far, and what each does. List three features you have not used yet. 3. Plan an animation for the following scenario using a top-down development approach: A stuffed tiger lays on the ground in the park. A girl walks up to the tiger, pauses for a moment, and picks up the tiger. Then she says, This is the tiger that I lost! The storyboard should have two columns: one for the actions in the storyboard, and one for the procedures and control statements that would need to be written for each action in the animation. 4. Plan an animation for the following scenario using a top-down development approach: Two people have a conversation about the weather. The first person turns to the second person and says Nice weather today! The second person says Yes, but I think it is going to rain tomorrow. The storyboard should have two columns: one for the actions in the storyboard, and one for the procedures and control statements that would need to be written for each action in the animation. 5. Create an animation with the correct procedures, directions, and distances based on the following scenario: A camel starts at the back left corner of the scene (the viewer's left), walks towards the camera 3 meters, then walks towards a rock 2 meters, stops for 2 seconds, then turns to the left 0.5 meters and walks forward 10 meters. Ensure that the animation works as intended at run-time, and debug if necessary. 6. Create an animation with the correct procedures, directions, and distances based on An object's sense of direction. Program code executed once to define a single movement for an object in a scene. Tells Alice 3 how to implement the instructions in a program. A list of instructions that are required to accomplish a task. A piece of program code that defines how the object should execute a task. Sequence of numbers generated by a computer with no pattern in their sequence. Describes how to perform the procedure. Tell the objects in the animation how to perform tasks.

the following scenario: A ship starts at the back left corner of the scene (viewer's left), moves toward the camera 5 meters, then turns 1 meter to the right while simultaneously moving forward 10 meters. Ensure that the animation works as intended at run-time, and debug if necessary. 7. Add an object to a scene. Use a procedure to position the object so that it is 8 meters right, 1 meter above, and 15 meters in front of the center of the virtual world. 8. Add a tortoise and a hare to a scene in the grass template. Using the drag and drop method and handle styles, do the following: Drag and drop the objects so that the tortoise is to the left of the hare. Move the hare so it faces the back of the scene. Resize the tortoise so it is two times larger than the hare. Make the hare appear to lie down on the grass.

9. Create an animation for the following scenario: Five playing cards simultaneously move, turn, and roll in order. Create a new procedure for this motion. Run the animation, then alter the distance and duration argument values in the procedure and run the animation again to see how the playing card's movements change. 10. Create an animation that uses the roll procedure to make three penguins appear to roll from the back to the front of the scene simultaneously. Hint: The penguins must be positioned on their side in the scene editor to achieve this motion. Once you make all three penguins roll, change the number of rolls to a random number between 1 and 5. 11. Create an animation for the following scenario: Place a teacup on top of a tea plate (MyProps class folder). Have the tea cup and tea plate turn simultaneously in opposite directions. Run the animation. In your journal, describe how the objects behave when you run the animation. 12. With a classmate, conduct a peer review of your animation's code for one of your completed animations. Discuss what procedures and arguments you used, and what worked and didn't work. In your journal, write one thing you learned from reviewing your classmate's code. 13. In your journal, create an entry entitled Move Procedures. Create a table that lists 5 different procedures and describes how each procedure makes objects move. 14. In an animation scene, use five procedures that you have not yet used before. In your journal, create an entry entitled New Procedures. List the procedures you used, and describe how each instructed the objects to move.

SECTION 2 LESSON 4 Declaring Procedures Slide 1: Declaring Procedures What to Watch For In this lesson, students will learn how procedures can be created to pass actions to superclasses or subclasses. They will learn how to recognize a series of programming tasks that can be abstracted into a procedure to simplify programming code. Procedures can be created from the initial program design, or, can be a result of procedural abstraction. This difference should be emphasized throughout this lesson. Slide 2: What will I Learn? There are no instructor notes for this slide. Slide 3: Why Learn It? There are no instructor notes for this slide. Slide 4: Inheritance There are no instructor notes for this slide. Slide 5: Inheritance (cont.) There are no instructor notes for this slide. Slide 6: Inheritance (cont.) At this point, you may want to do an In-class activity where students explore the code editor and look at the class hierarchy and inherited procedures for objects. Have students add a few objects to an animation. Then, have them open the code editor and look at the inherited procedures for each object. Have them select each class in the class hierarchy and look at what each class inherits. Slide 7: Procedural Abstraction There are no instructor notes for this slide. Slide 8: Procedural Abstraction (cont.) There are no instructor notes for this slide. Slide 9: Procedural Abstraction (cont.) There are no instructor notes for this slide. Slide 10: Procedural Abstraction (cont.) There are no instructor notes for this slide.

Slide 11: Procedural Abstraction Example 1 There are no instructor notes for this slide. Slide12: Procedural Abstraction Example 2 There are no instructor notes for this slide. Slide 13: Default Features of Code Editor The myFirstMethod tab is compiled and executed when the Run button is clicked because the Scene tab calls the myFirstMethod as its first, or main, program. Think of the myFirstMethod as the main program of the Scene class. Slide 14: Default Features of Code Editor (cont.) More information on the MyScene tab will be covered when event listeners and variables are covered in later lessons. It is important to note that there are four major components of the MyScene class. The components include constructors, procedures, functions, and properties. This section will focus on creating procedures. Slide 15: Class Hierarchy Menu It is important to correlate this class hierarchy menu to the classes in the Gallery. Understanding this menu will help students understand inheritance. If a procedure is declared at the MySwimmer level then all of the subclasses below MySwimmer will have access to the procedure. Slide 16: Class Hierarchy Menu (cont.) Emphasize the location of the Add Procedure button as well as having the correct class tab selected. Slide 17: Declare A Procedure There are no instructor notes for this slide. Slide 18: Declare A New Procedure (cont.) There are no instructor notes for this slide. Slide 19: Declare A New Procedure (cont.) There are no instructor notes for this slide. Slide 20: Declare A New Procedure (cont.)

There are no instructor notes for this slide. Slide 21: Add Procedure to myFirstMethod There are no instructor notes for this slide. Slide 22: Add Procedure to myFirstMethod There are no instructor notes for this slide. Slide 23: Add Procedure to myFirstMethod There are no instructor notes for this slide. Slide 24: Add Procedure to myFirstMethod There are no instructor notes for this slide. Slide 25: Edit Declared Procedures There are no instructor notes for this slide. Slide 26: Edit Declared Procedures (cont.) There are no instructor notes for this slide. Slide 27: Edit Declared Procedures (cont.) There are no instructor notes for this slide. Slide 28: Edit Declared Procedures (cont.) There are no instructor notes for this slide. Slide 29: Edit Declared Procedures (cont.) At this point, you may want to do an In-class activity where students add their own procedures to the MyBiped or MyQuadruped classes so that the objects of those classes inherit the procedure. Have students try the following activity: 1. Create a new project called Inherited Procedures. Save the project. 2. Create a new animation for the following scenario: Three Scotty dogs stand in a park around a tree. All of them turn simultaneously in a wide circle around a tree. Position the dogs so they are all at different positions around the tree, ready to walk in a circle. 3. Program the animation. Create a new procedure in the MyQuadruped class called TurnInCircle. Program the motions for moving and turning simultaneously in a circle.

Hint: When you create the new procedure, immediately drag it into MyFirstMethod, then go back to programming the procedure. That way, when you click the Run button, you can repeatedly test and debug the new procedure as you develop it. 4. When you are done programming the procedure, go back to MyScene and MyFirstMethod. Assign the procedure to all three Scotty dogs. Notice how the procedure now appears in each Scotty dog's procedures. Test and debug the animation until the three dogs move and turn in a circle around the tree. 5. If there is time, have a few students share their animations with the class. Discuss the steps required to make the dogs move and turn in a circle. Slide 30: Identify Opportunities for Declared Procedures There are no instructor notes for this slide. Slide 31: Terminology There are no instructor notes for this slide. Slide 32: Summary There are no instructor notes for this slide. Slide 33: Practice Vocabulary 1. Inheritance 2. Procedural Abstraction Each subclass receives the methods and properties of its superclass. A process to identify and remove repetitive programming statements from a main program, and put them into their own procedure.

Try It/Solve It 1. In your journal, diagram the inheritance hierarchy for the Pig subclass that belongs to the Biped class. List 3 properties and 3 procedures that the subclass inherits from its superclass, and 3 properties that are specific to the subclass. Answers may vary. Answers: Biped Superclass

Pig Subclass

Three properties inherited from superclass: moves on two legs, stands upright, has two arms. Three procedures inherited from superclass: move, turn, roll. Three properties specific to subclass: size, pink color, round body shape.

2. In your journal, create an entry titled Inheritance. Write a paragraph that describes inheritance and why its important when declaring procedures. Answers may vary. Sample answer: Objects inherit the characteristics of their class, including all of the class's procedures. When an object is created, it inherits a set of procedures, functions, and properties from its superclass and subclass that you can view in the code editor. It's important to understand inheritance when declaring procedures, so that you know which classes will automatically inherit the new procedure you are declaring, and which classes will not. 3. Create an animation and add a dophin object. Open the code editor and review the class hierarchy for the dolphin. Document this hierarchy in your journal. If you declared a procedure for the dolphin, which classes in the hierarchy would inherit the procedure? Answers: Swimmer > +Whale > ++Dophin Only the dophin would inherit the new procedure.

4. In your journal, create an entry titled Procedural abstraction. Write three examples of how you can use this technique as you code your animations to make code simpler and easier to reuse. Answers may vary. Sample answers include: Motions that do not have a default procedure, motions that need to be used by multiple objects, motions that need to be used by multiple classes, singular motions that are complicated and take up a lot of space in myFirstMethod that could be pulled out and put in their own procedure. 5. In the following code example below, identify a procedure that could be declared to simplify the code. You may need to put this code into Alice to understand how it works. Answers may vary. The correct answer should declare a procedure for kicking the ball, and the ball's movement after it is kicked. Some answers may be: Kick, ballMoves, ballFlies.

6. In your journal, create an entry titled Declaring procedures. Document the steps to declaring a procedure. Answers: Select the class that should inherit the procedure from the class menu. Click Add Procedure... Name the procedure, then click OK. Create the programming statements for the new procedure. Select an instance that inherits the procedure, then drag the new procedure into myFirstMethod so that during coding and debugging, you can run the animation to test how the procedure works.

7. Create an animation for the following scenario: A tortoise and a hare race to a tree. The tortoise crawls slowly to the tree, while the hare hops quickly. Declare a procedure for the tortoise's crawling motion, and a procedure for the hare's hopping motion. Run the animation and debug as necessary. Save the animation. 8. Create an animation for the following scenario: A school of six fish move forward, turn left, then roll. They should flap their fins and tails as they move. Then, do the following: Code the animation entirely in myFirstMethod without using procedural abstraction techniques. Save this animation. Then, in your journal, write (or copy and paste) the first version of your code and list all of the ways that you can simplify the code by declaring procedures. Note: you can print your animation's code by selecting File > Print > Print Current Code. Go back to the animation and simplify the code by declaring procedures. Save this second version of your animation by selecting Save As from the File menu, and giving the file a different name.

In your journal, write (or copy and paste) the new code. Describe how the code looks different in comparison to the first version of your code. On the Internet, search for videos of penguins and observe how they move. Create an animation for the following scenario: A family of five penguins walks through the snow in a line, and walks into a cave. Resize three of the penguins to be smaller, like they are baby penguins. Position the penguins so they walk in a line, one behind the other. Then, code a lifelike walking motion for each penguin. Save this animation. Then, save a second version of this animation. Simplify the code by declaring procedures. In your journal, write (or copy and paste) the first version of code and second version of code. Compare how the code changed once procedures were declared, and list the procedures you declared and what each does.

9. Complete the following activity:

10. Create an animation for the following scenario: Five playing cards simultaneously move, turn, and roll in order. Declare a procedure for this motion. Run the animation, then alter the distance and duration argument values in the procedure and run the animation again to see how the playing cards' movements change. 11. With a classmate or a few different classmates, conduct a peer review of your animation's code for one of your completed animations that has declared procedures. Share declared procedures that you have created for objects. In your journal, list the code for some of the new declared procedures you learned.

SECTION 2 LESSON 5 Using Control Statements and Functions Slide 1: Using Control Statements and Functions What to Watch For This lesson teaches students how to add precision to their animations and create coordinated movements. With basic procedures, objects move in various ways, but the movements may not appear lifelike, or realistic. Using control statements and functions, students can create more complicated movements for objects, such as having a person walk, sit, and ride on a vehicle object. Connections Have a student volunteer to simply walk from one wall to another wall, then sit down in a chair. Notice how the student: Subtly moves up and down with each step Moves legs independently, but both legs are moving simultaneous to the each other Moves many party of the body to complete the walking motion and sit down

This includes: Head, Arms, hands, thighs, legs, and feet. Slide 2: What will I Learn? There are no instructor notes for this slide. Slide 3: Why Learn It? There are no instructor notes for this slide. Slide 4: Editing Arguments Demonstrate how a procedure's arguments can be altered. Stress to students that getting objects to move just the way they want will require many rounds of experimentation and testing. Students will need to try different procedures and arguments, test their effectiveness, and make modifications many times during an animation's development. Slide 5: Editing Arguments (cont.) There are no instructor notes for this slide. Slide 6: Editing Arguments (cont.) Demonstrate how to use the Instance menu to select a sub-part of an object using a person object (MyBiped folder), or another object that has many sub-parts. Slide 7: Simultaneous Movements Ask students to provide examples of simultaneous movement in the real world:

Person - Walking, running, jumping Car wheels turning while car moves forward Airplane propellers move, wings bow right and left, plane moves forward

Slide 8: Simultaneous Movements (cont.) There are no instructor notes for this slide. Slide 9: Simultaneous Movements (cont.) There are no instructor notes for this slide. Slide 10: Simultaneous Movements (cont.) Demonstrate how to drag the Do Together control statement into the code editor and add procedures to it. Create a simple animation with two acting objects. Drag two move procedures into the control statement, one for each object, and run the animation to show how both objects move at the same time. Discuss how the Do Together control statement introduces the concept of 'nesting', embedding one line of code within another. Slide 11: Simultaneous Movements (cont.) At this point, you might want to do an in-class activity where students create an animation of a person walking. The animation should have no scenery objects, just the background template and the person. Start by showing an animation example of a person object walking (See the video page for this lesson for an example). Break the class into groups of 2-3 students each. Have students start by physically walking, and talk about what programming statements should be required. Then, have each team create a textual storyboard for the walking motion. Then students should create the animation following these steps: 1. Create a new animation project with a background template and person object. Save the animation with the file name Walking. 2. In the code editor, select the MyScene drop-down list (next to the Run button). Select +MyPerson from the hierarchy. Students are going to create a new procedure that all MyPerson class objects will inherit, meaning that all of the class's objects can use it as well. 3. Under Procedures, click Add Procedure... 4. Name the procedure Walk. 5. Code the walk procedure. Students should program a realistic walking motion. When you are finished, click Back to My Scene in the scene window. 6. In the myFirstMethod tab, drag the new Walk procedure into the code editor. Run the animation.

7. Save the animation. If there's additional time, a few teams should share their animations with the class. Slide 12: Vehicle Property There are no instructor notes for this slide. Slide 13: Vehicle Property (cont.) In the scene editor, the boy was positioned on the camel first before the movements were programmed. In the Object Properties menu on the left, you can select the boy's sub-parts to move and position each leg so the boy appears to sit on the camel. Slide 14: Vehicle Property (cont.) Demonstrate to students how they can set an object as a vehicle of the Alice 3 camera. Talk about when this would be useful to do in their animations. For example, students may want to do this if they create a game, or to follow a character around in a story. Slide 15: Vehicle Property (cont.) There are no instructor notes for this slide. Slide 16: Vehicle Property (cont.) There are no instructor notes for this slide. Slide 17: Vehicle Property (cont.) There are no instructor notes for this slide. Slide 18: Vehicle Property (cont.) At this point, you might want to do an in-class activity where students set an object as a vehicle of another object. Students can do this with a person sailing on a ship as found in the slides, a person riding another type of object, or create a scene with a person who walks around and is the vehicle to the camera, so that the camera follows the person's every move. To program the person as the vehicle for the camera, students should follow these steps: 1. Create a new project and save the project as Set Vehicle. Select a template and add a person and scenery objects to the scene. Students should briefly discuss and agree on a scenario for the scene so the animation has a purpose. For example, the person could walk, turn around to face the camera, and wave hello. 2. In the code editor, select the person instance. 3. Drag the setVehicle procedure into the code editor, at the top above any other code. 4. Select the vehicle object (this.camera) from the drop-down menu.

5. Program the person to move about the scene (allow students to select the movements). 6. Run the animation to test how it works. 7. Modify the animation to change the person's vehicle from the camera back to this, so that the camera no longer follows the person around. Note how the animation looks different with this change. If there is time, allow a few students to present their animations to the class. Slide 19: Functions There are no instructor notes for this slide. Slide 20: Functions (cont.) Demonstrate how to access Functions Experiment with a few of the functions in front of the students.

Slide 21: Functions (cont.) There are no instructor notes for this slide. Slide 22: Functions (cont.) There are no instructor notes for this slide. Slide 23: Functions (cont.) There are no instructor notes for this slide. Slide 24: Functions (cont.) There are no instructor notes for this slide. Slide 25: Functions (cont.) There are no instructor notes for this slide. Slide 26: Functions (cont.) There are no instructor notes for this slide. Slide 27: Functions (cont.) There are no instructor notes for this slide.

Slide 28: Functions (cont.) There are no instructor notes for this slide. Slide 29: Functions (cont.) There are no instructor notes for this slide. Slide 30: Functions (cont.) At this point, you might want to do an in-class activity where students demonstrate using functions to make a person or animal walk a precise distance to a stationary object. Students should create the animation following these steps: 1. Create a new project called Functions. Save the project. 2. Add a stationary object to the scene, such as a tree, bush, or rock. Add a moving object to the scene, such as a person or animal. Position the moving object so it is facing the stationary object. 3. In the code editor, select the moving object from the Instance menu. Add the move procedure to the code editor, and select an arbitrary distance. 4. Add the getDistanceTo function to the existing distance argument in the move procedure to make the moving object move forward the distance to the stationary object. 5. Run the animation. Notice how the moving object walks to the center of the stationary object. 6. Use math operators to reduce the distance that the person moves to the stationary object. Run the animation to test how it works. 7. Then, add the getDepth function to the distance argument to subtract the depth of the moving object. Run the animation to test how it works. If there's additional time, have a few student teams share their animations with the class. Discuss how functions reduce the time required to get objects to move precisely where the animator wants them to go. Slide 31: Comments There are no instructor notes for this slide. Slide 32: Comments Steps Reviewed At this point, you might want to do an in-class activity where students take the animation they previously created, and add comments in the code that describe what the program does. Discuss how comments should be descriptive and be entered after each segment of code so that others know how the program works. Slide 33: Terminology There are no instructor notes for this slide.

Slide 34: Summary There are no instructor notes for this slide. Slide 35: Practice Vocabulary 1. Center Point 2. Comments 3. Functions An object's motions are relative to its own________________________ . Notes that help other programmers understand what the code in your program does. Answers questions about an object, such as its distance to another object.

4. Procedure Arguments This allows the programmer to adjust the object, motion, distance amount and time duration. 5. Vehicle 6. Simultaneous 7. Sub-part 8. Collision 9. Synchronized A procedure used to synchronize objects. When motions occur at the same time they are________________________. The many parts that may make up an object as a whole; each can be controlled. When an object unintentionally overlaps with another. When objects are ________________________ they have the same sense of direction.

Try It/Solve It 1. Create an animation for the following scenario: Two bunnies hop forward simultaneously, from the left to the right of the scene. Then, one of the bunnies hops forward faster than the other. The slower bunny says Hey! Stop hopping so fast! Create comments that explain what the program does. Save the animation. 2. Create an animation for the following scenario: A person (MyBiped class folder) walks into a library (Room template) and sits down at a desk in a chair (furniture is in the MyProps class folder). The person then says Let's read! Create comments that explain what the program does. Save the animation. 3. Create an animation for the following scenario: A lion walks through a forest that has three birds in the trees. When the birds see the lion approaching, they scream Oh no! A lion! and fly away. Create a walking motion for the lion so that all four legs move in a realistic manner. 4. Create a scene with the following objects: Two people Volleyball

Tree

Create an animation for the following scenario: Two people run to the volleyball at the same time and bump into each other, both saying Hey! I want the ball! as they run towards the ball. Save the animation. 5. Create an animation for the following scenario: A person rides on the back of a camel through the desert, from the back of the scene to the front of the scene. They then turn and walk to approach a mirage (use the objects of your choosing to create the mirage) and the person asks the camel Is this real? Save the animation. 6. Create an animation for the following scenario: Create a tea party in a garden. The March Hare, Queen of Hearts, White Rabbit, Cheshire Cat (MyBiped folder), and other objects of your choosing stand around a table which is covered in tea pots and tea cups (MyProps folder). The Mad Hatter enters the scene riding on a teacup, which spins around as it simultaneously moves into the scene, stopping before it collides with the table. 7. Create an animation for the following scenario: Person 1 moves into the camera view, and faces the camera. Person 2 moves into the camera view, and faces the camera. Person 1 and Person 2 turn to face each other simultaneously. Both people talk to each other in order, Person 1 first, then Person 2. They should each speak three times during the conversation. Both people say goodbye to each other, turn and walk away.

8. Create an animation for the following scenario: two fish swim alongside each other, up to the entrance of a cave. Then, they quickly turn around, swimming apart from each other and away from the cave in different directions until they are out of view. Then, a shark exits the cave slowly. 9. Create an animation for the following scenario: 3 playing cards stand at different points in the scene. The Queen of Hearts and the March Hare stand at the back of the scene. The Queen of Hearts and March Hare walk up together to the center of the scene and stand on a pedestal (select an object for the pedestal). The March Hare says Everyone stand at attention. Then, the playing cards rush up to the Queen of Hearts, but stop before they land on top of her. 10. Using your journal, create a textual storyboard for an animation that makes use of the following procedures and control statements: Do in Order control statement Do Together control statement Move Toward procedure Move Away procedure Orient To procedure Delay procedure

Use the objects of your choosing to create this animation. Save the project when you are finished. 11. Create an animation for the following scenario: A birthday cake sits on a table in a livingroom or sitting room. Two children walk up to the table at the same time, with their arms stretched out in front of them reaching for the cake, but they stop before they touch it. An adult walks in the room and says Do not touch the cake! Hint: Use functions to avoid the children's collision with the table. Save the project. 12. Create an animation for the following scenario: An owl flies out of one tree and lands on a second tree. Hint: Use functions to ensure the owl lands properly in the tree. Save the project. 13. In your journal, create an entry entitled Comments. Write a paragraph that explains the importance of comments in programming and how you have used them thus far in the course. 14. In your journal, create an entry entitled Functions. For the MyPerson object, list five functions and what each tells us about the object. 15. Watch the video on Control Statements on the videos page for this lesson. In your journal, create an entry entitled Control Statements Video Questions. Answer the following questions about the video: In the scene editor, where do you change the color of an object? What are two reasons why you would create a new procedure, instead of just using the ones listed in the Procedures tab?

16. Watch the video on Functions on the videos page for this lesson. In your journal, create an entry entitled Functions Video Questions. Answer the following questions about the video: When using the getDistanceTo function in the move procedure, why does the moving object move to the center of the target object? When using the getDistanceTo function and math operators, what is one reason why you would want to reduce the distance that an object travels?

SECTION 2 LESSON 6 Using the IF and WHILE Control Statements Slide 1: Using the IF and WHILE Control Statements What to Watch For This is a lesson to teach students how to further control the movements in their animations using the IF and WHILE control statements. In this lesson, both statements will be used to avoid collisions between objects, a common use for these control statements. These control statements will be used in Alice 3 and beyond if students use other IDEs to develop Java applications and games. Slide 2: What Will I Learn? There are no instructor notes for this slide. Slide 3: Why Learn It? There are no instructor notes for this slide. Slide 4: Control Statements There are no instructor notes for this slide. Slide 5: Control Statements Nested There are no instructor notes for this slide. Slide 6: Control Statements IF and WHILE There are no instructor notes for this slide. Slide 7: IF Statement There are no instructor notes for this slide. Slide 8: If Statement Flowchart Flow charts are used by programmers to think out how their code will flow; this is especially useful when handling conditions. Flowchart Basics Diamond This shape indicates a decision point Rectangle This shape indicates a process to be completed; this could be a calculation or execution of a statement Elongated circle Ends the program

A second example; this to work through with students. Have the students provide the flowchart for: If I see a spider, then I will scream, "YAAHHHHAA!"; otherwise, I will not scream (i.e., do nothing). Decision point True result False result

Ask: What is the:

Slide 9: If Statement Flowchart (cont.) There are no instructor notes for this slide. Slide 10: If Statement Flowchart (cont.) Reiterate that you must select a true or false placeholder when you first create the IF construct in the code editor. Once the construct is created you can then go back and refine the true condition to reflect the actual condition to be tested. Students may struggle with this concept of selecting an argument as a placeholder. Additional examples for using true or false conditions may be required. Slide 11: Creating an IF Statement There are no instructor notes for this slide. Slide 12: Creating an IF Statement (cont.) There are no instructor notes for this slide. Slide 13: Creating an IF Statement (cont.) There are no instructor notes for this slide. Slide 14: Creating an IF Statement (cont.) At this point, you might want to do an in-class activity where students demonstrate using conditional execution by inserting an if statement to have a person or animal object avoid collision with another object. Students should create the animation following these steps: 1. Create a new project called If Statement. Save the project. 2. Add a stationary object to the scene, such as a tree, bush, or rock. Add a moving object to the scene, such as a person or animal. Position the moving object so it is facing and in the path of the stationary object. 3. Create a textual storyboard to detail what happens in the animation for the moving object's movement and collision. This should include the movement before the if

statement, and the if statement with both if and else conditions considered. 4. Use the moveToward procedure and the getDistanceTo function to program the moving object to collide with the stationary object. 5. Program the conditional execution. Insert the if statement to program what happens if the moving object collides with the stationary object, and what happens if the moving object does not collide with the stationary object. Students should be creative and not limit themselves to what happens in the slide. They can have the objects do a number of things: run away from each other, say something, etc. 6. Run the animation to test how it works. Debug as necessary. 7. If there is time, have a few students share their animations with the class. Slide 15: IF Statement Steps Summarized There are no instructor notes for this slide. Slide 16: WHILE Statement There are no instructor notes for this slide. Slide 17: WHILE Statement Flowchart In this lesson, students will be programming what happens in the event of a collision. They can also program other actions with a WHILE statement. Ask students to think about other ways they could use this statement in their animations. Slide 18: WHILE Statement Placeholder Reiterate the process of creating a placeholder value for the WHILE construct. Slide 19: WHILE Statement Steps There are no instructor notes for this slide. Slide 20: WHILE Statement Steps (cont.) There are no instructor notes for this slide. Slide 21: WHILE Statement Steps (cont.) There are no instructor notes for this slide. Slide 22: WHILE Statement Steps (cont.) There are no instructor notes for this slide. Slide 23: WHILE Statement Steps (cont.) There are no instructor notes for this slide.

Slide 24: WHILE Statement Steps (cont.) At this point, you might want to do an in-class activity where students demonstrate using the WHILE statement to program a looping movement, as well as what happens if the person or animal object collides with another object. Students should create the animation following these steps: 1. Create a new project called WHILE Statement. Save the project. 2. Students should develop their own scenario, then develop a textual storyboard to detail what happens in the WHILE loop. 3. Then, they should add the moving object to the scene. Add the second object, moving or stationary, that the moving object will collide with. Position the moving object so it is facing and in the path of the object it will collide with. 4. Program the WHILE loop and collision. 5. Run the animation to test how it works. Debug as necessary if it doesn't work as intended. 6. If there is time, have a few students share their animations with the class. Then, have a discussion about how this loop could be used in other animations. Emphasize to students that if they continue their Java education, they will use this and the IF statement often with other Integrated Development Environments. Slide 25: Terminology There are no instructor notes for this slide. Slide 26: Summary There are no instructor notes for this slide. Slide 27: Practice Vocabulary 1. Process Flow 2. While control statement 3. If control statement 4. Conditional Loop A graphical representation of a process that uses shapes to represent the actions in the model. This control performs instructions while a condition is true; otherwise it will stop the instructions. This control performs a process if a condition is true; otherwise it performs another process. A loop that will continue until a specific condition occurs; then the loop ends.

Try It/Solve It 1. Create an animation for the following scenario: A bird flies in the path of a tree, but

stops and lands on the ground if it is within 1 meter of the tree. Else, it keeps flying. Ensure that you put the moving object in the path of the stationary object for this action to work. Create lifelike flying motions for the bird (flap wings as it soars forward). Debug the animation to ensure it works as you intended. Save the animation. 2. Create an animation for the following scenario: A girl waves at a boy human object walking towards her. If the boy is within one meter of the girl, then the girl stops waving and says Hello, how are you? Else, the girl continues to wave. Debug the animation to ensure it works as you intended. Save the animation. 3. Create an animation for the following scenario: Create a scene with at least three stationary bjects and one person object. The human should move with lifelike walking motions. Use the while statement to program the human to move forward in a repetitive motion. However, if it collides with an object, it should stop, turn around to face the camera, and say Ow! That hurt! Otherwise, the person continues walking. 4. Create an animation for the following scenario: The Queen enters a tea party attended by several playing cards, the Mad Hatter, Cheshire Cat, and White Rabbit. She moves forward in a repetitive motion. If she collides with the table, she says, Get me some tea! And all of the characters say Yes, your majesty! Otherwise, she continues walking forward. 5. In your journal, create an entry entitled Control Statements. Create a table that lists each control statement you have learned how to use thus far in the course, and describe what each does. Provide an example of how you have used each in a scenario, with an example segment of code.

SECTION 2 LESSON 7 Using Expressions Slide 1: Using Expressions What to Watch For In more advanced animations, students will want their objects to move to precise positions. This is a lesson to teach students how to use math expressions and functions to further refine the movement of objects in their animations so they move precisely as the students intend them to. They will learn how to create expressions using the getDistanceTo function, getDepth function, and math calculations. They will also learn how to modify expressions, which is helpful to adjust distance during the testing and debugging process. Slide 2: What Will I Learn? There are no instructor notes for this slide. Slide 3: Why Learn It? There are no instructor notes for this slide. Slide 4: Expressions There are no instructor notes for this slide. Slide 5: Expressions (cont.) There are no instructor notes for this slide. Slide 6: Expressions (cont.) There are no instructor notes for this slide. Slide 7: Expressions (cont.) There are no instructor notes for this slide. Slide 8: Expressions (cont.) There are no instructor notes for this slide. Slide 9: Expressions (cont.) The person collides with the rock. The collision occurs because the getDistanceTo function measures to and from the rock's center point. Since this is not what is expected, the getDistanceTo function requires a math operation to adjust for the rock's center point. We must subtract half the distance of the rock.

Using trial and error, we can identify the best value to subtract or we can subtract the exact value using the getWidth/Height/Depth from functions. Slide 10: Expressions (cont.) There are no instructor notes for this slide. Slide 11: Expressions (cont.) There are no instructor notes for this slide. Slide 12: Expressions (cont.) Add to the previous example by inserting the getDepth function (getDepth was determined based on the positioning of the rock object). Slide 13: Expressions (cont.) There are no instructor notes for this slide. Slide 14: Expressions (cont.) There are no instructor notes for this slide. Slide 15: Expressions (cont.) There are no instructor notes for this slide. Slide 16: Expressions (cont.) At this point, you might want to do an activity where students create an expression where a moving object lands precisely in front of a stationary object. Students should create the animation following these steps: 1. Create a new project called Expressions. Save the project. 2. Create a scene for the following scenario: A bunny makes a big hop the distance to a bush. Position the bunny object so it is facing and in the path of the bush. 3. Create a new hop procedure for the bunny. This is a single up and down motion. 4. In the code editor, code the bunny to hop and move forward the distance to the bush simultaneously. Hint: This is a Do Together statement with one hop procedure and one move procedure, using the getDistanceTo function. 5. Run the animation to test how it works. Debug the animation using math operators to get the bunny to stop right in front of the bush. 6. Have a few students share their animations with the class and talk about how they coded the expression.

Slide 17: Expressions (cont.) There are no instructor notes for this slide. Slide 18: Expressions (cont.) There are no instructor notes for this slide. Slide 19: Expressions (cont.) At this point, you might want to do an activity where students modify an expression using the getDepth function. Students should complete the following activity: 1. Open the project called Expressions that they previously created. Save a second version of this project called Expressions_getDepth. Use this version of the project. 2. Modify the expression in the move procedure to use the getDepth function in place of a distance. Subtract the depth of the bush from the expression. 3. Test the animation and debug if necessary. Discuss the differences in coding the procedure, and how the bunny object moved. Was it easier or harder to code the expression using the getDepth function? Why or why not? Slide 20: Interpret an Expression There are no instructor notes for this slide. Slide 21: Interpret an Expression (cont.) There are no instructor notes for this slide. Slide 22: Interpret an Expression (cont.) There are no instructor notes for this slide. Slide 23: Terminology There are no instructor notes for this slide. Slide 24: Summary There are no instructor notes for this slide. Slide 25: Practice Vocabulary 1. Expression A combination of values that, when arranged correctly, will result in a final value.

Try It/Solve It

1. Create an animation for the following scenario: A fish moves toward an underwater cave, but stops at the entrance of the cave, then turns around and swims out of the scene. Use expressions and functions to achieve this motion. 2. Create an animation for the following scenario: A bird flies and lands perfectly on the top of a tree. Use expressions and functions to achieve this motion. 3. In your journal, create an entry entitled, Steps to Create an Expression. Document the steps to create an expression from the lesson. Write three examples of code with expressions with a description of what each expression does. 4. In your journal, describe what the following math expressions do: this.Dog move forward {this.Dog getDistanceTo this.Tree this.Tree getDepth} The dog moves forward the distance to the tree, minus the tree's depth. The dog moves to the tree but does not go through the tree, because the tree's depth is subtracted. If the tree's depth was not subtracted, the dog would move forward the distance to the center of the tree and land in the center of the tree. this.Abyssinian move forward {this.Abyssinian getDistanceTo this.Dog / 2} The Abyssinian moves forward half the distance to the Dog (or the distance to the dog divided by two). 5. Using Alice 3, create a scene using at least three fish objects. Position the fish in random locations. Create an animation with the following conditions: Every fish move randomly about the fish tank The fish cannot go below the sea floor or above the surface If a fish touches another fish it will say, Excuse me and turn around (and continue the random motion)

Make the program more fun: Record yourself saying, Excuse me using a different voice, one for each fish. Then assign each fish to Play Audio when a fish touches another fish. Use the Checklist for Animation Completion to ensure your animation is complete. 6. Create an underwater world! Create an animation with the following conditions: Dolphin, Shark and Clownfish objects at least five Seaweed objects at least 3 additional objects (e.g., Cave, Pirate Ship, Sea Plant)

Make the world as lifelike as possible using random motion and conditional loops. Use the Checklist for Animation Completion to ensure your animation is complete. 7. Create a scene using the two animal objects. Position the two animal objects at least 5 meters apart. Create an animation using math operators where: Animal object #1 moves toward animal object #2. If animal object #1 gets within 1 meter of animal object #2, then animal object #2 says, Pardon me, friend.

SECTION 2 LESSON 8 Using Variables and Keyboard Controls to Manipulate Motion Slide 1: Using Variables and Keyboard Controls to Manipulate Motion

What to Watch For In this lesson, students will learn what variables are and how to declare and initialize variables. They will also learn how to make their animations more interesting by introducing keyboard controls so that the viewer can control objects in the animation. This is an exciting lesson! It gives students the knowledge to create animations and games that include interactivity. Students will become more professional in their approach to animations as they will test their animations and ensure completeness with the animation checklist. Connections Have students imagine the following scenario: They would like to make a game that moves a helicopter to a destination using the arrow keys on the keyboard. What do the students need to consider when creating the game? Some considerations are: How far will the helicopter advance forward when the button is pressed? What if another object is in the helicopter's path? Will the helicopter stop? And what will happen to the other object? Should the propellers on the helicopter rotate? If so, how will they continue rotating while the helicopter is in motion?

Slide 2: What Will I Learn? There are no instructor notes for this slide. Slide 3: Why Learn It? There are no instructor notes for this slide. Slide 4: Variables There are no instructor notes for this slide. Slide 5: Variables (cont.) There are no instructor notes for this slide. Slide 6: Variables (cont.) There are no instructor notes for this slide. Slide 7: Local Variables Explain to students that especially during the testing phase, local variables are helpful. Instead of updating the values for each procedure as you test and refine movements, you can just update the value in the variable. All of the procedures that were assigned the variable will

automatically update their values. Slide 8: Local Variables (cont.) There are no instructor notes for this slide. Slide 9: Local Variables (cont.) Students should drag the local tile (declare variables) at the top of the code, above the procedures and comments. Slide 10: Local Variables (cont.) There are no instructor notes for this slide. Slide 11: Local Variables (cont.) There are no instructor notes for this slide. Slide 12: Local Variables (cont.) There are no instructor notes for this slide. Slide 13: Local Variables (cont.) There are no instructor notes for this slide. Slide 14: Local Variables (cont.) There are no instructor notes for this slide. Slide 15: Local Variables (cont.) Explain to students that they can also perform math calculations on the declared variable itself, so the changes cascade to all procedures that have the variable assigned to it. Just click on the arrow next to the initialized value and perform the math calculation. All of the procedures assigned the variable will automatically update their values as well. Slide 16: Local Variables (cont.) At this point, you might want to do an activity where students declare and initialize a variable, then assign this variable to multiple procedures and perform a math calculation to change the value of the variable. Try the following activity: 1. Create a scene for the following scenario: Three cats are positioned side-by-side at the back of a scene in a grassy field.

2. Have students code the cats to simultaneously move, then turn, then roll. For each distance argument, assign an arbitrary value. 3. Then, students should declare a local variable at the top of their code. The variable should be named NumMoves and be initialized to a whole number value of their choosing. 4. Students should drag the NumMoves variable into each distance argument. 5. Run the animation to test how it works. Then, have students perform a math calculation to double the amount that the cats turn. 6. Run the animation to test how it works. Slide 17: Local Variables (cont.) There are no instructor notes for this slide. Slide 18: Keyboard Controls There are no instructor notes for this slide. Slide 19: Keyboard Controls Example There are no instructor notes for this slide. Slide 20: MyScene Activation Listeners There are several types of listeners. This lesson will focus on keyboard listeners. The steps for creating other listener types are very similar and knowledge transfer will be easy for students once they understand the steps for creating a keyboard listener. Slide 21: MyScene Keyboard Listener The fundamental concept to convey is that a listener has a true or false condition either the system hears they keystroke (true) or it does not (false). You can create a single listener that listens for many keyboard keystrokes in one listener. You do not need to create a separate listener for each keyboard key. Slide 22: Keyboard Listener Steps There are no instructor notes for this slide. Slide 23: Keyboard Listener Steps (cont.) There are no instructor notes for this slide. Slide 24: Keyboard Listener Steps (cont.) There are no instructor notes for this slide.

Slide 25: Keyboard Listener Steps (cont.) There are no instructor notes for this slide. Slide 26: Keyboard Listener Steps (cont.) There are no instructor notes for this slide. Slide 27: Keyboard Listener Steps (cont.) There are no instructor notes for this slide. Slide 28: Keyboard Listener Steps (cont.) There are no instructor notes for this slide. Slide 29: Keyboard Listener Steps (cont.) There are no instructor notes for this slide. Slide 30: Keyboard Listener Steps (cont.) There are no instructor notes for this slide. Slide 31: Keyboard Listener Steps (cont.) There are no instructor notes for this slide. Slide 32: Keyboard Listener Steps (cont.) There are no instructor notes for this slide. Slide 33: Keyboard Listener Steps (cont.) There are no instructor notes for this slide. Slide 34: Keyboard Listener Steps (cont.) There are no instructor notes for this slide. Slide 35: Keyboard Listener Steps (cont.) There are no instructor notes for this slide. Slide 36: Keyboard Listener Steps (cont.) There are no instructor notes for this slide. Slide 37: Keyboard Listener Steps (cont.) There are no instructor notes for this slide.

Slide 38: Keyboard Listener Steps (cont.) There are no instructor notes for this slide. Slide 39: Keyboard Listener Steps (cont.) There are no instructor notes for this slide. Slide 40: Keyboard Listener Steps (cont.) There are no instructor notes for this slide. Slide 41: Keyboard Listener Steps (cont.) At this point, you might want to do an activity where students create keyboard controls for a submarine. Try the following activity: 1. Create a scene for the following scenario: A submarine is in a scene of caves and rocks underwater. It needs to maneuver around the objects to find a treasure chest in the distance in a hide and seek type game. 2. Have students sketch a quick visual storyboard for their underwater scene. Then, students should create a textual storyboard of the keyboard controls. The storyboard should include: Keyboard key, direction to move, distance to move that direction. 3. Students then program their keyboard controls and run the animation to test it. They may need to adjust the distance values to get the submarine to move as they desire. 4. For added interest, students may program additional movements for keyboard keys, such as rolling. 5. Have students play each other's games and find the treasure chests. Discuss the process of creating keyboard controls, challenges, and what students did to improve their animations. Slide 42: Animation Checklist There are no instructor notes for this slide. Slide 43: Terminology There are no instructor notes for this slide. Slide 44: Summary There are no instructor notes for this slide. Slide 45: Practice Vocabulary 1. Event Keystrokes, or mouse clicks.

2. Keyboard Controls 3. Variables

Create animated games or movies where the user is required to control an object to win the game. A place in memory where data of a specific type can be stored for later retrieval and use by your program. It is used to store and retrieve data. A guideline to ensure an animation fulfills animation principles. The coding of events to handle each procedure.

4. Animation Checklist 5. Event Handling Try It/Solve It

1. Create an animation with one object added to the scene. Drag the local tile into the code editor and review the value types available. In your journal, create an entry entitled value types. Create a table with two columns. In one column, list the value types available in Alice 3. In the second column, describe one example of how you can use each value type in your animations. 2. Create an animation for the following scenario: Create an ocean floor scene with some furniture on the ocean floor that represents trash and litter in the ocean. A school of five fish are positioned to the left of the scene out of view. They all move simultaneously into the scene. Have them simultaneously move and turn to maneuver around a piece of litter on the ground, then say Don't litter in the ocean!. Once this animation is programmed, do the following: For each set of simultaneous movements, declare a variable that holds the value for the distance arguments (for example, the set of procedures within a Do Together to have the fish turn left, declare a variable called numTurns). You should use variables with both whole number and decimal number value types. Assign the variable to each distance argument. Remember to declare all variables at the top of your code before the procedures. Declare a variable with a TextString value to manage the statement Don't litter in the ocean!. In total, your animation should declare at least three variables, each with a different value type.

3. Correctly write a declared numSpins variable as it would appear in Alice 3 that has a DecimalNumber value type, is initialized to a value of 0.5, and is multiplied by 10. Answer: DecimalNumber numSpins {0.5 x 10.0} 4. Correctly write a declared numHops variable as it would appear in Alice 3 that has a WholeNumber value type, is initialized to a value of 23, and is subtracted by 2. Answer: WholeNumber numHops {23 - 2} 5. Create an animation for the following scenario: A person walks through a park trying to locate their missing cat, which is hiding behind a bush. In this animation, the person should be keyboard-controlled, and able to move and turn in all directions. 6. Create an animation for the following scenario: A person rides on a camel through the desert looking for a treasure chest. Hide the treasure chest somewhere in the scene.

Set the camel as the vehicle to the person. Have the movements of the camel be keyboard-controlled. Have someone else play your game and locate the hidden object. If you want to experiment with more advanced movements, create procedures that program the camel to walk with lifelike motions (slumping up and down as it moves, moving the legs forward realistically, moving in a slightly random pattern etc.). Assign these procedures to your keyboard controls.

7. Create an animation for the following scenario: Two dogs run and bark through a park with trees and bushes. Use random motion to make their running and jumping movements more lifelike. 8. Use the Checklist for Animation Completion to ensure that all of the animations you have created in this lesson are complete. If some animations are incomplete, go back and complete them, then re-check the animation using the checklist. 9. In your journal, create an entry entitled Animation Checklist. Write a paragraph that talks about why its useful to check your animations for completion, and how testing plays a role in this process. Discuss what steps you take to test your animations to ensure they function correctly and are complete. 10. Debug an animation that you created previously to ensure that it works as you had intended. Review the animation's code and run the animation. Fix any bugs, or errors in your programming, and ensure that the animation works properly. In your journal, create an entry entitled Debugging Process. Discuss the steps you took to review and debug your animation to ensure it worked properly. 11. Create an entry entitled Testing and Debugging Animations. Write a paragraph that explains why the testing and debugging process is critical to creating great animations.

SECTION 2 LESSON 9 Correlating Java Variables, Data Types, and Expressions with Alice3 Tools Slide 1: Correlating Java Fundamentals with Alice3 Tools What to Watch For

This lesson introduces Java programming code in the context of Alice 3 programming constructs. Throughout this lesson, objects are used that are in the current gallery for the most recent version of Alice. If an object is not available that is listed on a slide or in a practice activity, substitute that object for another object. Connections As you go through each construct, ask students to think of Alice 3 examples and how they correlate to Java constructs. Slide 2: What Will I Learn? Objectives There are no instructor notes for this slide. Slide 3: Purpose There are no instructor notes for this slide. Slide 4: Alice vs. Java This slide compares the differences between the Alice and IDE environments as well as what can be created using both programs. Slide 5: Variables in Alice There are no instructor notes for this slide. Slide 6: Variables in Alice (cont.) There are no instructor notes for this slide. Slide 7: Variables in Alice (cont.) There are no instructor notes for this slide. Slide 8: Variables in Alice (cont.) The practice will allow the students to create a variable called NumSets, the number of sets of exercises a child will do. Slide 9: Variables in Java There are no instructor notes for this slide.

Slide 10: Data Types in Alice All programming languages have built-in data types. Alice has fewer data types than Java. Slide 11: Data Types in Alice (cont.) There are no instructor notes for this slide. Slide 12: Data Types in Java There are no instructor notes for this slide. Slide 13: Data Types in Java (cont.) There are no instructor notes for this slide. Slide 14: Java Simple Types There are no instructor notes for this slide. Slide 15: Java Simple Types (cont.) There are no instructor notes for this slide. Slide 16: Arithmetic Operators in Alice It is tricky to find the arithmetic operators in Alice, you have to keep choosing submenus until you build the expression you want. Slide 17: Arithmetic Operators in Java There are no instructor notes for this slide. Slide 18: Arithmetic Operators in Java (cont.) Output: a=4, b=12, c=3, d=-1, e=1 Slide 19: Relational Operators There are no instructor notes for this slide. Slide 20: Relational Operators in Alice Like arithmetic operators, maneuver your way through the submenus until you build the expression you want. Slide 21: Relational Operators in Java There are no instructor notes for this slide.

Slide 22: Relational Operators in Java (cont.) There are no instructor notes for this slide. Slide 23: Logical Operators There are no instructor notes for this slide. Slide 24: Logical Operators in Alice There are no instructor notes for this slide. Slide 25: Logical Operators in Java There are no instructor notes for this slide. Slide 26: Logical Operators in Java (cont.) There are no instructor notes for this slide. Slide 27: Assignment Operators in Alice There are no instructor notes for this slide. Slide 28: Assignment Operators in Alice (cont.) There are no instructor notes for this slide. Slide 29: Assignment Operators in Java There are no instructor notes for this slide. Slide 30: Assignment Operators in Java (cont.) There are no instructor notes for this slide. Slide 31: Assignment Operators in Java (cont.) There are no instructor notes for this slide. Slide 32: Terminology There are no instructor notes for this slide. Slide 33: Summary There are no instructor notes for this slide.

Slide 34: Practice

Vocabulary 1. Relational Operators A lexical unit used to express a relation, such as equality or greater than, between two expressions. 2. Data Type 3. Logical Operators 4. Variable 5. Arithmetic Operators A set of data with values having predefined characteristics. Boolean operators (AND, OR and NOT). A place in memory where data of a specific type can be stored for later retrieval and use. A lexical unit used to perform basic mathematical operations by taking two operands and returning the result of the mathematical calculation.

Try It/Solve It 1. In Alice 3, you will create an animation of a child exercising. You will also declare variables. Create a world with a child. Save the project as Child Exercising.

Have the child wave. Assign the value of the wave to happy.

Have the child say I would like to exercise today.

Have the child do several exercises (side stretches, touch toes, jumping jacks). After exercising, have the child stand up and say, I'm all done exercising.

Change the code so that before the child exercises, you declare a variable of type Integer called numSets. Set the default value to 3. Save your animation.

2. In Alice 3, create an animation with an alien riding a vehicle of your choosing. Save the project as Alien Landing. Program the alien to fly through the air, then spin as it slowly lowers to the ground. Declare a local variable to count the number of times the alien should spin and lower to the ground. 3. In your journal, create an entry entitled Java Simple Types (Primitives). Write a statement that explains the purpose of primitives. Then, create a table that lists each data type with an example and description of how it is used in programming. 4. In your journal, create an entry entitled Arithmetic Operators. Create a table that lists the arithmetic operators and how each are used. Then, create four examples of Alice 3 expressions using four different arithmetic operators. 5. In Alice 3, create an animation entitled Bouncing Ball. Add a ball to a scene with three stationary objects. Have the ball bounce on the ground, then bounce off each stationary object. Use expressions to fine tune the distance the ball travels to hit the various stationary objects in the scene. 6. In your journal, create an entry entitled Relational Operators. Create a table that lists the relational operators in Java, what each does, and an Alice 3 programming statement that shows an example of how each would be used. 7. In Alice 3, create an animation entitled Flying Birds. Add two birds to the scene, each in a random location, and one tree in the center of the scene. Using variables, an ifelse statement, and relational operators, test the distance of each bird to the tree by programming the birds to act in accordance with the following textual storyboard (Review slides on Relational Operators for programming hints): If bird 1 is currently a shorter distance to the tree than bird 2, then, bird 1 flies to the tree else bird 2 flies to the tree 8. In your journal, create an entry entitled Logical Operators. Create a table that lists the logical operators in Java, what each does, and an Alice 3 programming statement that

shows an example of how each would be used. 9. In your journal, create an entry entitled Assignment Operators. List three examples of assignment operators. Describe how assignment operators are used in Java programming. 10. Complete the following Java Syntax Cheat Sheet: Construct Assignment operator Arithmetic operators Equality operators Relational operators Logical operators Syntax = +, -, *, / == !=, >, >=, <, <= & AND && Conditional AND | OR || Conditional OR ! NOT

SECTION 2 LESSON 10 Correlating Java Methods, Classes, and Other Structures with Alice 3 Tools Slide 1: Correlating Java Methods, Classes, and Other Structures with Alice 3 Tools What to Watch For

This lesson introduces Java programming code in the context of Alice 3 programming constructs. This transition from a graphical environment to a code-based syntax environment may be challenging for some students. Additional examples of code comparison may be needed to help students understand how to correlate procedures in Alice to methods in Java. Connections As you go through each construct, ask students to think of Alice 3 examples and how they correlate to Java constructs. Slide 2: What Will I Learn? Objectives There are no instructor notes for this slide. Slide 3: Purpose There are no instructor notes for this slide. Slide 4: Alice vs. Java This slide compares the differences between the Alice and IDE environments as well as what can be created using both programs. Slide 5: Methods (aka Procedures) in Alice There are no instructor notes for this slide. Slide 6: Methods (aka Procedures) in Alice (cont.) There are no instructor notes for this slide. Slide 7: Methods in Java There are no instructor notes for this slide. Slide 8: Methods in Java (cont.) There are no instructor notes for this slide. Slide 9: Methods in Java (cont.) There are no instructor notes for this slide. Slide 10: Methods in Java (cont.) There are no instructor notes for this slide.

Slide 11: Methods in Java (cont.) There are no instructor notes for this slide. Slide 12: Classes in Alice There are no instructor notes for this slide. Slide 13: Classes in Java There are no instructor notes for this slide. Slide 14: Classes in Java (cont.) There are no instructor notes for this slide. Slide 15: Classes in Java (cont.) There are no instructor notes for this slide. Slide 16: Instances in Alice There are no instructor notes for this slide. Slide 17: Instances in Java There are no instructor notes for this slide. Slide 18: Instances in Java (cont.) There are no instructor notes for this slide. Slide 19: Control Structures There are no instructor notes for this slide. Slide 20: IF Control Structures There are no instructor notes for this slide. Slide 21: IF Control Structures (cont.) There are no instructor notes for this slide. Slide 22: IF Control Structures (cont.) There are no instructor notes for this slide. Slide 23: WHILE Control Structures There are no instructor notes for this slide.

Slide 24: WHILE Control Structures (cont.) There are no instructor notes for this slide. Slide 25: Input and Output There are no instructor notes for this slide. Slide 26: Input and Output (cont.) There are no instructor notes for this slide. Slide 27: Input and Output (cont.) There are no instructor notes for this slide. Slide 28: Terminology There are no instructor notes for this slide. Slide 29: Summary There are no instructor notes for this slide. Slide 30: Practice Vocabulary 1. Decision Control Structure 2. Instance 3. Repetition Control Structure or WHILE loop 4. Method 5. Class Control structure that allows you to select specific sections of code to be executed. An object of a class. Control structure that allows you to execute specific sections of the code a number of times. A piece of code that sends a message to an object asking it to perform an action. A specification, such as a blueprint or pattern and a set of instructions, of how to construct something.

Try It/Solve It 1. In Alice 3, you will create an animation of a child exercising. You will set variables and define a while control statement. You will ask the end user for input and have the child say something (similar to creating output). Note: If you already created the first part of the Child Exercising animation in a previous practice activity, open the animation and skip to step 6 of these instructions. Create a world with a child. Save the project as Child Exercising.

Have the child wave. Assign the value of the wave to happy.

Have the child say I would like to exercise today.

Have the child do several exercises (side stretches, touch toes, jumping jacks). After exercising, have the child stand up and say, I'm all done exercising.

Change the code so that before the child exercises, you define a variable of type Integer called numSets. Set the default value to 3.

Create a while condition that has the child do the series of exercises numSets number of times. For example, if numSets is 3, the child should do one set of side stretches, toe touches and jumping jacks, and then do a second set, and then do a third set.

Modify the numSets variable so that it asks the user how many sets the child should do. (Hint: use the getIntegerfromUser function.)

Have the child say the number of sets remaining. When there is one set remaining, the child should say Last set. (Hint: use an IF control statement.) Save your animation.

2. Build on the previous animation from practice activity #1 above and add two other children to the animation, with different exercise movements and different variables to control their movements. 3. Open up an animation that you created in a previous activity. Evaluate its syntax. In your journal, create an entry entitled Java Syntax Evaluation. Describe the animation, then define the methods, classes, and instances in the Java syntax. 4. In your journal, create an entry entitled Methods, Classes, and Instances. Define a method, class, and instance. Give three examples of each in Alice 3. Compare the differences between methods, classes, and instances written in Alice 3, and written in Java syntax. 5. In your journal, create an entry entitled Control Structures. Write the Java syntax form for both the IF and WHILE control structures. 6. In your journal, create an entry entitled IF Control Structure. Describe three different examples of when you could use this control structure in an animation. 7. In your journal, create an entry entitled WHILE Control Structure. Describe three different examples of when you could use this control structure in an animation. 8. In Alice 3, create an animation that uses both the IF and WHILE control structures to control an object's movement. In your journal, create an entry entitled Control Structures Used in Alice 3. Describe the scenario for the animation, and how you used the IF and WHILE control structures to control the object's movement. 9. In your journal, create an entry entitled Input and Output. Describe what this is, and

how it is used in Java programming. Give at least one example of input and output in Alice 3 and in Java syntax. 10. Complete the following Java Syntax Cheat Sheet: Construct If else syntax Syntax if(condition){ statement; } else { statement; } while syntax while (expression) { statement; }

Section 3 Instructor Resource Guide


INSTRUCTOR NOTES FOR SLIDES SECTION 3 LESSON 1 Getting Started with Greenfoot Slide 1: Getting Started with Greenfoot What to Watch For In this lesson, students will become familiar with Greenfoot and how it works. They will learn how to launch Greenfoot, the components of the IDE, learn how to add classes and instances to a scenario, and learn how to create a subclass. Connections Ask students if they have created or participated a game before (whether digital, paper, physical, etc.) What components were required? What is necessary for a complete game? Slide 2: What Will I Learn? Objectives There are no instructor notes for this slide. Slide 3: Why Learn It? There are no instructor notes for this slide. Slide 4: Launch Greenfoot There are no instructor notes for this slide. Slide 5: Greenfoot Scenarios These scenarios were authored by Michael Kolling, author of the textbook Introduction to Programming with Greenfoot. Slide 6: Download A Scenario Students must have zip file software installed on their computers to extract the contents of the zip file. Visit 7zip.com for free, open source zip file extraction software. Students should save the scenarios to a location on their computer, or another location you designate. Slide 7: Open A Scenario in Greenfoot

Students should have Greenfoot open first before opening a scenario. Highlight to students that the scenario will appear empty, and won't do anything when first opened. We have to use the execution controls and add objects to the scenario first before anything will happen. Slide 8: Execution Controls to Run a Game Explain that these controls are key as students develop their games, because they will use them to run and test their programming statements. Try the following activity with your students: 1. Watch the video on execution controls to run a scenario: JF_V01_S03_L01_V01_leaves_wombats. 2. Download and install Greenfoot. 3. Open the leaves-and-wombats scenario from the Chapter 1 folder of the Greenfoot textbook scenarios. 4. Review the Greenfoot environment and its components. In your journal, describe the environment and the execution controls. 5. Play the leaves-and-wombats game. To make the wombat eat leaves, you need to add one instance of the wombat and several instances of leaves to the scenario. To do this, right click on the class name, then select new [class name] (example: new Wombat() or new Leaf()). With your cursor, click on the world to add the instance. Have students run the scenario to see the wombat eat the leaves in his path. Slide 9: Classes Example There are no instructor notes for this slide. Slide 10: Classes Explain to students that the classes are required first before we can put objects in the world. Slide 11: Subclasses and Superclasses There is another type of superclassa vector classbut students will not use this in this course. Explain to students that the class can have any image associated with it. Greenfoot has a library of images, or the students can use paint or drawing software to create their own images, or import other images that are saved on their computer. Slide 12: Subclass Properties There are no instructor notes for this slide.

Slide 13: Superclass Types There are no instructor notes for this slide. Slide 14: Steps to Create a Subclass There are no instructor notes for this slide. Slide 15: Create a Subclass and Import an Image There are no instructor notes for this slide. Slide 16: Draw a New Image For a Subclass There are no instructor notes for this slide. Slide 17: Compilation There are no instructor notes for this slide. Slide 18: Understanding When Compilation Occurs There are no instructor notes for this slide. Slide 19: Compile the Program There are no instructor notes for this slide. Slide 20: Saving a Scenario There are no instructor notes for this slide. Slide 21: Opening a Scenario Try the following activity with your students: 1. Watch the video on adding a subclass to a scenario and compiling a scenario: JF_V01_S03_L01_V02_add_subclass. 2. In your scenario, create a new subclass of the World superclass. 3. Create two new subclasses of the Actor superclass. 4. Compile the program. 5. In the Scenario menu, select Save a Copy As... 6. Give the scenario file a descriptive name, then save it in your Greenfoot Scenarios folder. 7. In your journal, describe your scenario, including the world and acting objects.

As students develop source code, they will want to have scenarios in many different versions. They may drastically change their source code, but want to be able to use source code from previous versions. This is why creating versions is so important. It helps them develop a library of source code to use, along with documenting in their journal. Slide 22: Instances of a Class There are no instructor notes for this slide. Slide 23: Instances There are no instructor notes for this slide. Slide 24: Adding Instances to a Scenario Try the following activity with your students: 1. Watch the video on adding instances to a scenario: JF_V01_S03_L01_V03_add_instances. 2. Add a new class to your scenario. 3. Right click on an actor class to add an instance of that class to your scenario. 4. Add three instances of the class to your scenario. 5. Save a copy of the scenario. Slide 25: Source Code There are no instructor notes for this slide. Slide 26: Viewing Source Code There are no instructor notes for this slide. Slide 27: Code Editor There are no instructor notes for this slide. Slide 28: Terminology There are no instructor notes for this slide. Slide 29: Summary There are no instructor notes for this slide.

Slide 30: Practice There are no instructor notes for this slide. Vocabulary 1. Subclass 2. Class 3. Superclass 4. Instance 5. Compilation More specific types of a class. The template that defines the substance of an object, such as its appearance, features, and movement. The more generic, overarching class of a group of classes. An object of the class. Translates the source code into a machine code that the computer can understand. This ensures that you added the source code or class correctly before you proceed. Defines what all instances of each class are capable of doing. The behavior of each instance is determined by the source code of its class.

6. Source Code

Try It/Solve It 1. In your journal, create an entry entitled 'Greenfoot IDE'. Document five components of the Greenfoot environment and what each does. 2. In Greenfoot, create a new subclass of the Actor class. Add an image to this class one of two ways: by drawing a new image in your computer's paint program, or importing an existing image on your computer. If you cannot draw or import an image, select an image from the Greenfoot library. 3. True or false: The Run execution control executes the statements in the act method repeatedly. True 4. Create a new scenario. Create three Actor classes and one World subclass, and add an instance of each class to the world. In your journal, document the classes that were added to your scenario. 5. In your journal, create an entry entitled Class Diagram. Create a diagram that shows the relationship between an instance, subclass, and superclass using a real-world animal or plant example. 6. In your journal, create an entry entitled Classes. In this entry, explain to someone who doesn't understand classes and subclasses what each are, how they are related, and their significance in programming. 7. In your journal, document the Java syntax used to correctly create a subclass in your scenario.

SECTION 3 LESSON 2 Using Methods, Variables and Parameters Slide 1: Using Methods, Variables and Parameters What to Watch For In this lesson, students will learn how to add classes and instances to a scenario, and learn how to write, compile, and test source code. Slide 2: What Will I Learn? Objectives There are no instructor notes for this slide. Slide 3: Why Learn It? There are no instructor notes for this slide. Slide 4: Methods Example There are no instructor notes for this slide. Slide 5: Methods There are no instructor notes for this slide. Slide 6: Display an Object's Methods There are no instructor notes for this slide. Slide 7: Inheritance Another example for students: Students inherit characteristics from their parents, grandparents, etc. They also inherit all of the characteristics of humans. Slide 8: Viewing Methods in the Code Editor There are no instructor notes for this slide. Slide 9: Method Summary Students will refer to the documentation often to see what methods their classes can use, and what's inherited. Slide 10: Method Components Methods are the key to commanding objects to move. Much of your source code will be comprised of methods that command the objects to perform actions, or ask the objects questions, such as their coordinates, whether something is true or false, etc.

Slide 11: Method Signature There are no instructor notes for this slide. Slide 12: Return Types There are no instructor notes for this slide. Slide 13: Void Return Types There are no instructor notes for this slide. Slide 14: Invoking Methods with Void Return Types There are no instructor notes for this slide. Slide 15: Ask Objects Questions Ask students if they can think of other similar scenarios. Slide 16: Non-void Return Types Try the following activity with your students: 1. Watch the video on invoking methods with void return types: JF_V01_S03_L02_V01_invoke_void_method. 2. In the scenario, right click on an object, then invoke a method with a void return type. Invoke at least three different methods with void return types. 3. Document in your journal how the object acts when you invoke each method. 4. Watch the video on invoking methods with non-void return types: JF_V01_S03_L02_V02_invoke_nonvoid_method. In many cases, a method with a non-void return type will determine whether other methods in a statement are executed. For example, if an object is not at coordinate x =133 in the world, then it doesn't turn 15 degrees. Slide 17: Examples of Non-void Return Types There are no instructor notes for this slide. Slide 18: Method Parameters There are no instructor notes for this slide. Slide 19: Method Parameter Lists Try the following activities:

In your scenario, invoke two different methods that require parameters. In your journal, document the method signature, and what happened to the instance after the method was invoked. In your journal, document the steps you took to invoke the methods.

Slide 20: Object Properties There are no instructor notes for this slide. Slide 21: View Object Properties Students can also view a world object's properties by opening the code editor for the World subclass. This constructor contains information about the size and resolution of the world. Try the following activity with your students: 1. In your scenario, right click on an Actor class. 2. Select Open Editor. 3. Select Documentation from the drop-down list. 4. Review the object's properties. 5. In your journal, describe the properties for this object, including the inherited methods. Students should pay particular attention to the inheritance of classes, and the diagrams that show the superclass and subclass relationships. Slide 22: Variables There are no instructor notes for this slide. Slide 23: View Instance Variables Try the following activity with your students: 1. Review an instance's variables in the object inspector. 2. Answer the questions: How do you think each variable is useful to the instance? What do the variables tell us?

Slide 24: Programming Syntax Explain to students that the words source code and syntax are used interchangeably. Slide 25: Display Class Source Code There are no instructor notes for this slide.

Slide 26: Act Method There are no instructor notes for this slide. Slide 27: Body of Act Method Students should understand that the curly brackets are already inserted into the act method. When students create other types of methods, such as defined methods, they will have to enter their own brackets and structure the method on their own. Greenfoot will help create indentations to help students structure their programming statements correctly. Slide 28: Act Method Example To help students learn how to write programming statements correctly, they should review lots of examples. In the Greenfoot Scenarios provided, they should review the source code for various scenarios to see how its structured. Slide 29: Invoke Methods in Act Method Explain to students that this is the structure to call singular methods in the act method. Other types of more advanced methods, such as defined methods, will be written differently. Watch the video on calling methods in the act method and running the game to view results of programming statements. Try the following activity with your students: 1. Watch the video: JF_V01_S03_L02_V03_act_method. 2. Create a subclass of the actor superclass, then compile. 3. Open the editor for the class. 4. Program syntax in sequence to make the objects in the class do the following when the Act or Run buttons are clicked: Move 3 steps Turn 18 degrees

5. Compile the syntax. 6. Run the scenario to see how it works. 7. In your journal, list the steps you took to program your scenario. Slide 30: Debug a Greenfoot Program Note to students that not all error messages, or highlighted areas of the source code, will be easy for them to understand. If you have trouble understanding the error, sometimes helpful to show a peer, and have them review your code and work to find a solution. The solution to fixing the errors is in the Try-It any other errors will be caused by the student. Check for spelling and syntax errors.

Slide 31: Syntax Error Example There are no instructor notes for this slide. Slide 32: Error Message Example There are no instructor notes for this slide. Slide 33: Error Explanations Try the following activity with your students: 1. Watch the video on debugging a program and reviewing error messages: JF_V01_S03_L02_V04_debugging. 2. Open the code editor for one of the acting classes in your scenario. 3. Enter programming statements into the act method to make the class's objects move and turn. 4. Create an error in your programming statements, such as: Missing semicolon Incorrect characters, or capitalized methods

5. Compile the code. 6. Review the error messages displayed. 7. In your journal, document the error messages you received, and what steps were required to correct them. Slide 34: Terminology There are no instructor notes for this slide. Slide 35: Summary There are no instructor notes for this slide. Slide 36: Practice Vocabulary 1. Instance Variable 2. Variable 3. Parameter The memory that the instance of the class has. That memory can be saved and accessed later as long as the instance exists. A field used to store information about the class to use immediately or later. Used to pass values to methods to specify how objects are to

move, or to tell objects what type of response we expect when we ask objects a question. 4. Inheritance 5. Return Type 6. Method Each subclass can use (inherits) the methods from its superclass. Word at the beginning of the method that tells us what type of information a method call will return. Set of operations or tasks that instances of a class can perform. When a method is invoked, it will perform the operation or task specified in the source code. A method call instructs the instance to perform an operation or task. You can read the method to understand what operation or task is to be performed. Access, return type, name, and parameters for a method. Process of finding and removing bugsor errorsin a computer program.

7. Method Call

8. Method Signature 9. Debug

Try It/Solve It 1. In your journal, list three different methods. Explain how each of their parameters are used. 2. Open the code editor for an actor subclass. Program instances of the class to move an amount of steps that you specify. Run the scenario to see how the parameters you entered in the Act method impact the instance's movement. Describe how the instance moves in your journal. 3. In your journal, create an entry entitled 'Inherited Methods'. Document the methods that the subclass inherits. 4. In your journal, create an entry entitled 'Inheritance'. Write a paragraph that describes why inheritance is important in programming. 5. In your scenario, add an instance to the world. Inspect the instance's properties. In your journal, describe the properties of the instance, including inheritance, methods, and coordinate position. 6. In your journal, create an entry entitled 'Return Types'. Describe the difference between methods with a void and specific data return type. Document two examples of each. 7. In your scenario, program an instance of a class to move 3 steps, then turn 18 degrees. Compile the code, then test the results of your programming statements. 8. Edit your source code to create 3 different errors. In your journal, document the errors, and the error messages that Greenfoot displayed. Document how to resolve the errors. 9. True or false: empty parameter lists will need data to invoke the method. False 10. In your journal, create an entry entitled Method Components. Document the components of a method, and what each component does.

SECTION 3 LESSON 3 Working with Source Code and Documentation Slide 1: Working with Source Code and Documentation What to Watch For In this lesson, students will begin to understand how source code is the key to manipulating all of the object behavior in their game. They will see the results of their programming statements and how the code directly commands the instances to act. Connections Ask students if they have been exposed to writing source code before. Students should search the Internet for examples of applications developed using Java source code. Slide 2: What Will I Learn? Objectives There are no instructor notes for this slide. Slide 3: Why Learn It? There are no instructor notes for this slide. Slide 4: Source Code There are no instructor notes for this slide. Slide 5: Code Editor Open Greenfoot, then open the code editor for an Actor class as you show students its components. Slide 6: Functions of the Code Editor There are no instructor notes for this slide. Slide 7: Components of Source Code There are no instructor notes for this slide. Slide 8: Class Description Students can modify the class description at any time. Slide 9: Class Definition There are no instructor notes for this slide.

Slide 10: Act Method Explain to students that the act method is where they will execute methods that tell instances how to behave in the environment. Slide 11: Defining Classes Explain to students that these are the components of their source code. Slide 12: Method Signature Students should understand that we will always view the method signature to understand what the method does. It is the blueprint to knowing what the method requires to run, what it returns, etc. Slide 13: Comments Highlight to students that anything in blue text in the source code are comments, and can be modified without changing or affecting the program. The program doesn't read the comments, it just passes over them. Comments are for humans to read. Slide 14: Documentation Students should refer to the documentation often to understand what methods each class has, and more information about the class. Open a class, and show the class documentation. Point out the elements of the documentation that students should know about (what superclass the class belongs to, constructor, methods, etc.) Slide 15: Invoke Methods Programmatically There are no instructor notes for this slide. Slide 16: Invoking Methods in Act Method If possible, enter a method such as move(1); in the act method of an Actor subclass, so students can see this in action. Slide 17: Invoking Methods Example Students should be mindful of typing their methods correctly even one typo or missing character can cause an error during compilation. Each method should end with a semicolon. Slide 18: Method Examples These are just a few examples. In the class documentation or Greenfoot class API, you can

view a variety of methods that students can use. Slide 19: View Available Methods Explain that in more complicated programs, a method may not be straightforward. There may be several methods that are needed to complete a single action. Slide 20: Sequential Tasks There are no instructor notes for this slide. Slide 21: Sequential Methods There are no instructor notes for this slide. Slide 22: If-Then Relationships There are no instructor notes for this slide. Slide 23: If-decision Statements There are no instructor notes for this slide. Slide 24: If-decision Statement Components There are no instructor notes for this slide. Slide 25: If-decision Statement Example There are no instructor notes for this slide. Slide 26: isKeyDown Method The method used for this example is new for the students to learn. Slide 27: Object Orientation in the Real World There are no instructor notes for this slide. Slide 28: Display an Object's Orientation Explain to students that object orientation is a key concept in object oriented programming. In order for objects to perform certain actions, they need to know if they are near or touching other objects so they can bounce off objects (such as turning at the edge of the world) or eat objects that they land on.

Slide 29: Methods to Verify an Object's Orientation Explain to students that we can use these methods to know where an object is located, so that if the object is in a certain location, then something can happen. For example, if an object is on top of a chair, it sits down on the chair. We can also use these methods as part of larger defined methods to make an instance perform a task. For example, getX() and getY() methods are used as part of helping an instance know its location in the world so it knows when to turn at the edge of the world. Slide 30: Display an Object's Orientation There are no instructor notes for this slide. Slide 31: Terminology There are no instructor notes for this slide. Slide 32: Summary There are no instructor notes for this slide. Slide 33: Practice Vocabulary 1. Sequential Methods 2. Invoking a Method 3. Comments 4. Object Oriented Analysis 5. If-statement 6. Class Description Multiple methods executed by Greenfoot in the order in which they are written in the program. Tells the object which methods to perform, and in what order. Describe what the code does to other humans. Greenfoot does not read it, nor does it impact the functionality of the program. The analysis process where Java technology programmers analyze a problem and then create objects to build a system, or more specifically, to solve the problem. Statement written to tell your program to execute a set of instructions only if/when a certain condition is true. A set of comments that the programmer can modify to let others who view the source code know what the class is, what it does, the author of the code, and the date it was last modified.

Try It/Solve It 1. True or false: Source code is the blueprint that defines how your program functions. True

2. Open the code editor for an Actor subclass. Identify each component of the code editor, and write it in your journal with a definition of what each component does. 3. Open the code editor for an Actor subclass. Modify the class description to include your name, a description of the class, and the version number or date it was last modified. 4. In the Act method for an Actor subclass, program the class to move 3 steps whenever the Act or Run buttons are clicked in the environment. public void act() { move(3); } 5. Write the method signature for the Act method in the space below: public void act() 6. In the Act method, invoke methods to make the instances of your class move and turn. In the comments section, write comments that describe what the Act method does. Write the full act method and comments in your journal. 7. In the Act method for an Actor class, write an if-statement that makes an object turn 10 degrees if a specific condition is true. In your journal, document the if-statement and explain the condition you used and why. 8. Position 10 instances in the world, and inspect the orientation of each. In your journal, create a table that lists the x and y coordinates of each instance.

SECTION 3 LESSON 4 Developing and Testing an Application Slide 1: Developing and Testing an Application What to Watch For Students will be introduced to the application development cycle, and what they should consider as they develop and test their game. Slide 2: What Will I Learn? Objectives There are no instructor notes for this slide. Slide 3: Why Learn It? There are no instructor notes for this slide. Slide 4: Program Testing Strategies There are no instructor notes for this slide. Slide 5: Compilation and Debugging Remind students that beyond Greenfoot, there will be fewer error messages that tell you what is wrong. Greenfoot provides a lot of them to teach you correct programming techniques. Slide 6: Steps to Debug Your Program Show students where the Compile button is in the environment and in the code editor. Slide 7: Keys to Recognizing Java Syntax Errors There are no instructor notes for this slide. Slide 8: Phases to Develop an Application There are no instructor notes for this slide. Slide 9: Analysis Phase There are no instructor notes for this slide. Slide 10: Analysis Tasks There are no instructor notes for this slide. Slide 11: Analysis Example

In Greenfoot, students will develop a game. An example problem for a game could be a predator-prey scenario, where a predator instance eats or eliminates multiple prey instances. The solution is a game where the player can eat instances. Slide 12: Analysis Pre- and Post- Conditions There are no instructor notes for this slide. Slide 13: Design Phase There are no instructor notes for this slide. Slide 14: Textual Storyboard Example Explain to students that a textual storyboard lists the algorithms, or programming statements, that will be required for the scenario. This is a useful tool to use to plan out how a scenario will work. Slide 15: Development Phase Throughout the development phase, students should test their code as they develop it. Slide 16: Testing Phase Students should work with other students during this phase, and give each other feedback on their games. Reiterate that test plans should test numerical representations and limits. Describe how a banking solution could produce incorrect results if the rounding of a number is not set to two digits after a decimal point. Talk about how the addition of a 1/2 of a cent multiplied by a million customers could produce an expensive programming error. Another example to consider when testing numeric values and conditional constructs is the result of an IF construct. If an IF construct is expecting a positive value of only 5 through 9, to then add that value to another variable, and the program incorrectly feeds the variable a value of 2, the IF construct will fail and the variable expecting a conditional change will not get the expected amount so the operation of the data structure will be different. This is an example of where the program will execute the the result of the conditional construct is incorrect. Be sure to test all program calculations thoroughly. Slide 17: Terminology There are no instructor notes for this slide. Slide 18: Summary There are no instructor notes for this slide.

Slide 19: Practice Vocabulary 1. Bugs 2. Documentation Try It/Solve It 1. View the documentation for the World class. In your journal, describe 5 methods inherited by this class. 2. Circle the character or characters that mark the end of the method call below: move(25); The semicolon should be circled. 3. In your journal, list the steps to developing a software application. Describe what happens in each step. 4. In your journal, design a plan for a game that you want to develop. Include a textual storyboard that describes what actions take place, and draw images of the game's background and the objects that will act in the game. Errors in the syntax of a computer program. Describes the class's properties.

SECTION 3 LESSON 5 Using Randomization and Understanding Dot Notation and Constructors Slide 1: Using Randomization and Understanding Dot Notation and Constructors What to Watch For This is a lesson to teach students how to make their games more interesting. Students will build on concepts from the previous lesson and learn how to add random behaviors to their classes. Connections Encourage a discussion about random behavior in professional computer and console games. Why is random behavior important in a game? Slide 2: What Will I Learn? Objectives There are no instructor notes for this slide. Slide 3: Why Learn It? There are no instructor notes for this slide. Slide 4: getRandomNumber Method Explain to students that Greenfoot has a class, called Greenfoot, with a set of methods that you can use for your Actor and World classes and subclasses. The getRandomNumber method will be used to ask Greenfoot to return a random number. Students will incorporate this method into an if-statement later in the lesson. Slide 5: Dot Notation There are no instructor notes for this slide. Slide 6: Dot Notation Format There are no instructor notes for this slide. Slide 7: Dot Notation Example There are no instructor notes for this slide. Slide 8: Greenfoot API Students can document in their journal various methods from the Greenfoot class that they want to use in their programming. They can refer to the API as needed.

Slide 9: Greenfoot API Interface Navigate to the Greenfoot Class Documentation on your computer to show students how to navigate through this and search for methods. Slide 10: Comparison Operators In math classes, students should have already learned basic comparison operators to compare two values. You can demonstrate a simple example on a whiteboard to refresh students on how they work show that 2 < 5, 10,000 > 100, 1 = 1, etc. Slide 11: Comparison Operator Symbols Provide students with an example of how each would be used in a simple equation comparing two numbers. For example, 10 < 100, 50 > 3, i = = 10. Explain to students that the equal sign in programming looks different than the equal sign they are used to in mathematics. It requires two equal symbols instead of one. Slide 12: Problem Solved with Random Behavior Ask students to think of other examples where percentages are used to predict behavior. These are often used in sports, statistics, world records, etc. Slide 13: Random Behavior Format Try the following activity with your students: 1. Watch video JF_V01_S03_L05_V01_random to review how to program instances to perform random behaviors. 2. In the course scenarios, review scenario JF_V01_S03_L05_S01_random. 3. Add an Animal subclass to your scenario. 4. In the act method, program class's instances to turn randomly up to 17 degrees, 15% of the time. 5. Compile your code. 6. Test the game to see how it works. 7. In your journal, document the code. Slide 14: Conditional Behavior There are no instructor notes for this slide. Slide 15: If-else Statement Execution Describe how an if-else statement works. If the condition is true, the if-statement is executed. If the condtition is false, the else-statement is executed.

Slide 16: If-else Statement Format There are no instructor notes for this slide. Slide 17: If-else Statement Example Try the following activity with your students: 1. Watch video JF_V01_S03_L05_V02_ifelse to review how to program an if-else statement. 2. Review course scenario JF_V01_S03_L05_S02_ifelse. 3. Create a copy of your scenario. Include if else in the file name. 4. Create a different if-else statement for each of three actor classes. 5. Compile and test the code. 6. Document the code in your journal and describe what it does in plain words. The if-else statement that students create should utilize movements and the getRandomNumber method. Slide 18: Automate Creation of Instances There are no instructor notes for this slide. Slide 19: Source Code for World Class Ask students to open a scenario, then open the source code for the world. They should identify the World constructor and its components. Slide 20: World Constructor Explain to students that constructors are used to construct things in your game. They can create the world, which is the background for your game, but they can also create the instances that act in your game. Review its components. Slide 21: World Constructor Example There are no instructor notes for this slide. Slide 22: Automatically Create Actor Instances Review the components of the example. Slide 23: addObject Method There are no instructor notes for this slide.

Slide 24: new Keyword There are no instructor notes for this slide. Slide 25: Greenfoot World Coordinate System The coordinate system for the world in Greenfoot starts in the top left corner of the environment. This is different from other systems that start at the center of a world. Slide 26: Add Objects Using World Constructor Example Try the following activity with your students: 1. Watch the video JF_V01_S03_L05_V03_auto_instances to review how to automate creation of actor instances. 2. Review course scenario JF_V01_S03_L05_S03_auto_instances and observe how instances are automatically created using the world constructor. 3. Open the scenario JF_scenarioA and open the Table class code editor. mainDeck = new Deck(Card.Colour.BLUE, 1, 1, 1, 1); addObject(mainDeck, 600, 500); 4. The code above automatically creates an instance of the Deck class and places it in the World. Amend the addObject statement to change the position of where the Deck object is placed. Slide 27: Terminology There are no instructor notes for this slide. Slide 28: Summary There are no instructor notes for this slide. Slide 29: Practice Vocabulary 1. Dot Notation A technique that allows a class to use a method from another class or object. The dot between the class/object name and the method name indicates that the method comes from a different class or object. A special kind of method that is automatically executed whenever a new instance of the class is created. A keyword that indicates that a new object is being created. Symbols that compare two random values in a method.

2. Constructor 3. new Keyword 4. Comparison

Operators Try It/Solve It 1. Write the method signature of the method that allows a class to return a random number. Write your response below: public static int getRandomNumber (int limit) 2. In your journal, write three reasons why random behavior will be an important component of the game you are creating. 3. In the getRandomNumber method, what does the parameter expect? Write your response below: The limit of the number that will be returned. 4. How can you verify if a method is a static method? Write your response below: The word static is included in the method signature. 5. Describe what the following method does. Write your response below. Greenfoot.getRandomNumber(15) This method returns a random number between 0 and below its parameter limit of 15. 6. Review the Greenfoot API. In your journal, document five methods from the Greenfoot class and their definitions. 7. In your journal, create a table that lists the comparison operators, and what each one does. 8. Express the following statement in source code: We want to program a flower to turn a random number of degrees, up to 15 degrees, 28% of the time. if (Greenfoot.getRandomNumber(100) < 28) { turn(Greenfoot.getRandomNumber(15) ); } 9. Express the following statement in source code: We want a bumblebee to turn 35 degrees if a random number less than 5 is returned, and if a number greater than 5 is returned, we want the bumblebee to turn 2 degrees. if (Greenfoot.getRandomNumber(100) < 5) { turn(35); } else { turn(2);

} 10. In the following constructor, what size is the world? public BeeWorld() { super(550, 300, 1); } x = 550, y = 300 11. In your scenario's world constructor, write code that automatically creates two new instances of an Actor class when the world is initialized. Document the code in your journal. 12. In your journal, document the defined methods you have created for your game. Include the full source code, names of the methods, and what the methods command the instances to do.

SECTION 3 LESSON 6 Defining Methods Slide 1: Defining Methods What to Watch For This is a lesson to teach students how to make their games more effective by defining methods. Students will build on concepts from the previous lesson and learn how to define their own methods to enhance a program. Slide 2: What Will I Learn? Objectives There are no instructor notes for this slide. Slide 3: Why Learn It? There are no instructor notes for this slide. Slide 4: Efficient Placement of Methods There are no instructor notes for this slide. Slide 5: Defined Methods The main difference that students need to understand is that every line of code doesn't have to be written in the act method. We can write code outside of the act method, then call it in the act method to execute it. Slide 6: Define a New Method Students should understand that defined methods are written underneath the act method, one after another. They can be written in a subclass or superclass, and called in the act method to have the instance execute the method. Slide 7: Turn at the Edge of the World There are no instructor notes for this slide. Slide 8: Test an Object's Position in the World There are no instructor notes for this slide. Slide 9: Logic Operators There are no instructor notes for this slide. Slide 10: Define atWorldEdge Method in Superclass

This is a useful method that students can copy into their journal to use in their games. They may not understand all of the characters in the method at this point, but will learn what those characters mean. There may be games where they don't want an instance to turn at the edge of the world. Ask students to think of examples of games where objects move and turn at the edge of the world, and games where they do not. Students should create an Animal class as a subclass of the Actor superclass. This class does not have an image associated with it. It is a class used to hold the defined methods that the Actor subclasses will use. Students can copy the defined method into the Animal superclass, and all of the subclasses of that superclass automatically inherit the method. Students may not understand all of the characters or methods at this point. They can view the API for the Actor superclass to find and read definitions of the methods used. This is a good exercise, to research how different methods are used and what classes they come from. They can also write out the statements in plain English, so they better understand how they work. The methods used in this statement are: getX: An Actor method that returns the x-coordinate of the actor's current location. getY: An Actor method that returns the y-coordinate of the actor's current location. getWorld: An Actor method that returns the world that this actor lives in. getHeight: A GreenfootImage class method that returns the height of the image. GetWidth: A GreenfootImage class method that returns the width of the image. ||: Symbol for a conditional statement that means OR.

Slide 11: Call atWorldEdge Method in Subclass Remind students that the atWorldEdge method must be called in the subclass that will use the method. Even though the method was entered in the Animal superclass and inherited by the subclasses, it will not make an instance turn at the edge of the world unless its subclass calls the atWorldEdge method in the Act method. Slide 12: Class Documentation Try the following activity with your students: 1. Watch the video JF_V01_S03_L06_V01_atWorldEdge to review how to create the atWorldEdge method. 2. Review the course scenario JF_V01_S03_L06_S01_atWorldEdge. 3. Save a copy of the current scenario you are working on with phrase world edge in the file name. 4. Create the atWorldEdge method in the Animal superclass, then call it in the Act method of a subclass. 5. Document this source code in your journal.

Slide13: Defined Method to Eat Objects Many games will utilize a predator/prey relationship between instances. Ask students to name other games that they have played where they are a predator eating or seeking to destroy prey. This defined method that will be created will be used often by students. Slide 14: Define canSee Method Again, students should look up the getOneObjectAtOffset method in the Actor documentation. This method returns one object that is located at the specified cell (relative to this objects location). If there is a prey object in the same coordinates as the predator object, this statement returns true to tell us that the predator can eat the prey. Slide 15: Define eat Method There are no instructor notes for this slide. Slide 16: Define lookForCode Method Show students that even with two methods created, we still need to create another method to pull it all together. In the predator's class source code, we create a method that says that if the predator is in the same coordinate position as the prey, eat the prey and remove it from the world. Otherwise, do not eat the prey. This is an if statement that calls the two methods from the Animal superclass. The parameters require the name of the class to find and eat, which is the Code class. Slide 17: Call lookForCode in Act Method There is one last step. In order to execute the method, we have to call it from the act method. Otherwise, it is stored in the class and is not executed. We simply write the name of the defined method with empty parameters to execute it. Try the following activity with your students: 1. Watch video JF_V01_S03_L06_V02_eatObjects to review how to create the code to find and eat objects in a game. 2. Review the course scenario JF_V01_S03_L06_S02_eatObjects. 3. Create the the code to find and eat objects in your scenario. 4. Insert one predator instance in your game, and ten prey instances. 5. Run the scenario to see how the code works. 6. Document this source code in your journal. Slide 18: Terminology There are no instructor notes for this slide.

Slide 19: Summary There are no instructor notes for this slide. Slide 20: Practice Vocabulary 1. Defined Methods A new method that a class didn't already possess; these methods are written in the class's source code below the act method.

Try It/Solve It 1. Program the atWorldEdge method into your game. Play the game, and compare how the instances from the different classes move when they reach the edge of the world. 2. Program the eatObject defined method into your game. Play the game, and document the source code in your journal. 3. In your journal, document the defined methods you have created for your game. Include the full source code, names of the methods, and what the methods command the instances to do. 4. Program your Actor superclass to include one of the defined methods used by an Actor subclass, so that all subclasses of the Actor superclass inherit that method.

SECTION 3 LESSON 7 Using Sound and Keyboard Control Slide 1: Using Sound and Keyboard Control What to Watch For This is a lesson to teach students how to make their games more interesting. Students will build on concepts from the previous lesson and learn how to add sounds and keyboard movements to their program. Slide 2: What Will I Learn? Objectives There are no instructor notes for this slide. Slide 3: Why Learn It? There are no instructor notes for this slide. Slide 4: Keyboard Controls There are no instructor notes for this slide. Slide 5: The isKeyDown Method Signature There are no instructor notes for this slide. Slide 6: String Parameter in isKeyDown Method A string allows us to tell our program the name of the key on the keyboard that we want to press down. Slide 7: Example isKeyDown Method Remind students that because this is a static method, we can use it in other classes if called using dot notation. Show students that to move an object to the left, we have to enter a negative number in the parameter. Try the following activity with your students: 1. Watch the video JF_V01_S03_L07_V01_keyboard_keys to review how to control an instance's movement with keyboard keys. 2. Review the course scenario JF_V01_S03_L07_S01_keyboard_keys. 3. Save a copy of a previously-created scenario. Replace the random movement with keyboard movement, so the object can move in two directions, controlled by the cursor keys on the keyboard. 4. Document the code in your journal.

Slide 8: Include Sound There are no instructor notes for this slide. Slide 9: Sound Example There are no instructor notes for this slide. Slide 10: Create Original Sounds in Greenfoot Remember that the computer must has a built-in microphone, or students must have access to microphone hardware, in order to use the sound recorder tool in Greenfoot. Slide 11: Greenfoot Sound Recorder Students could use their predator and prey scenario, and add sound to that scenario, so that the prey makes a sound when it gets eaten. Try the following activity with your students: 1. Review the course scenario JF_V01_S03_L07_S02_sound. 2. Record unique sounds using the sound recorder, and save them in your scenario. 3. Add these sounds to the source code for one or more objects in your scenario. Tie the sounds to keyboard commands. 4. Play your scenario, and note how the sounds are executed in the source code. Slide 12: Summary There are no instructor notes for this slide. Slide 13: Practice Try It/Solve It 1. Program an object to move left 5 steps and turn 2 degrees when the a keyboard key is pressed, and move right 2 steps and turn 5 degrees when the b keyboard key is pressed. Document your programming statements in your journal. if (Greenfoot.isKeyDown(a)) { move(-5); turn(2); } if (Greenfoot.isKeyDown(b)) {

move(2); turn(5); } 2. Program an object to make one sound when the x keyboard key is pressed, then another when the y keyboard key is pressed. Record the sounds in Greenfoot and save them to the scenario before programming the sound files into the class. if (Greenfoot.isKeyDown(x)) { Greenfoot.playSound(sound-file.wav); } if (Greenfoot.isKeyDown(y)) { Greenfoot.playSound(sound-file.wav); } 3. Program the prey instances in your game to make a sound when the predator eats them. Document this code in your journal.

SECTION 3 LESSON 8 Creating a World, Animating Actors, and Ending a Game Slide 1: Creating a World, Animating Actors, and Ending a Game What to Watch For This is a lesson to teach students some necessary programming shortcuts and new concepts that will improve their code writing. Students will also learn a basic animation technique having an instance display two different images, in addition to moving, to make an object's movements seem even more realistic. Further, students will learn how to create an end to their game. They should end this lesson with the ability to create a complete game. Connections Encourage a discussion about the scenarios they have created thus far, and what could make the creation process easier for them. Slide 2: What Will I Learn? Objectives There are no instructor notes for this slide. Slide 3: Why Learn It? Purpose There are no instructor notes for this slide. Slide 4: Constructors Have students save a copy of an existing scenario they have created. Then, have them open the copy. What appears in the environment when the scenario is opened? The world subclass automatically displays one instance of the world in the environment. Explain that we can also make the Actor subclasses do the same thing. Slide 5: Constructor Parameters There are no instructor notes for this slide. Slide 6: Constructor Example There are no instructor notes for this slide. Slide 7: Parameters Example Try the following activity with your students: 1. In your scenario, create a World subclass and then compile. 2. Open the code editor for the subclass. 3. Try a variety of different resolutions and sizes for your World subclass. 4. Document the source code for the World constructor in their journal.

Slide 8: Automatically Create Actor Instances Explain to students why this is important. Each time they initialize their game, the instances will appear in the world. When other people play their game, they won't have to add the instances to the game before they play it. This is how professional games work: the player doesn't have to add the objects, they appear automatically when the game starts. Slide 9: Code to Automatically Create Instances Students should have a scenario and their World constructor source code editor open during this explanation. Explain that the addObject method does what it says: it adds an object to a world when the world is initialized. The new keyword tells Greenfoot to create a new instance of the class. These two components together tell Greenfoot to add a new instance of the class to the world when it's initialized. Explain to students that the command to add a new instance goes directly beneath the command to create the world instance. It should be written exactly as follows, or you will receive an error message when you try to compile. Have students document this code in their journal, and denote that this is used to create new instances when the world is re-initialized. The world is initialized when the scenario is opened, or after source code is changed and compiled. Try the following activity with your students: 1. In the course scenarios, review scenario JF_V01_S03_L08_S01_constructor. Observe the code in the World constructor that automatically adds Duke and Code instances to the scenario when its initialized. 2. Write programming statements in the World constructor that add new instances of an Actor class each time a new world is created. 3. Students should do this exercise, and then modify the size and resolution in the code to see how the instances change when they are added to the world. Slide 10: Greenfoot Actor Instances Explain that in animation, single images are displayed in sequence, one after another, with tiny incremental changes that give digital or paper images the appearance of movement. We can use this same technique in Greenfoot to program an instance to flip between multiple images, so it appears to move or change in some way. Slide 11: GreenfootImage Class Remind students that they need to add the image to the class before they program this code to make an image appear. The GreenfootImage class already gives our instances the ability to hold one image when they are added to the world. But instances have the ability to hold more than one image.

Slide 12: Constructor to Obtain New Image Object Show students in a scenario how a class has an image assigned to it when the class is created. Demonstrate this in a scenario. Students have learned this earlier, but may have not made the connection yet. Have students document this constructor in their journal. Explain to students that constructors can also be created within the Actor classes; they don't have to just be in the World class. Slide 13: Assigning a New Image to a Class There are no instructor notes for this slide. Slide 14: Assigning an Image Example There are no instructor notes for this slide. Slide 15: Reasons Why Instances Hold Multiple Images There are no instructor notes for this slide. Slide 16: Accessing Multiple Images There are no instructor notes for this slide. Slide 17: Variables Explain to students that another aspect of programming is not just making objects perform actions, but storing information that they can remember to use later. Slide 18: Variable Format Have students document the variable format in their journal. Slide 19: Declaring Variables Image1 and Image2 are not the names of the actual image files, they are just placeholders to hold the image files, so the image files have a place to go in the variable. The GreenfootImage class is used to store and pass images to the instances. Students can look up this class in the Greenfoot class documentation to read its description. Slide 20: Assignment Statements Explain to students that the assignment allows us to put the actual image file into the Image1 or Image2 placeholder.

Slide 21: Assignment Statement Components Explain that this example tells Greenfoot to create a new image from the image file, and assign it to the variable. Slide 22: Initializing Images or Values There are no instructor notes for this slide. Slide 23: Actor Constructors Example When an instance is added to a world, it starts with an initial image. The initial image is set in the constructor, after the the variables are assigned. Try the following activity with your students: 1. In the course scenarios, review scenario JF_V01_S03_L08_S02_constructor2. Observe how the Duke class constructor assigns to two variables to its instances. 2. Create a constructor in the Actor class that assigns two images to its instances. Slide 24: Test Values of Variables There are no instructor notes for this slide. Slide 25: Write Actions in Pseudocode Explain that pseudocode is used by professionals when planning the logic of what will happen and when. It's important to carefully plan the order, so the instance behaves in the way you intended. Slide 26: == Operator Explain that a single equal sign (=) isn't sufficient; two equals signs together (= =) must be used to test if two values are equal. Slide 27: Components of If-else Statement There are no instructor notes for this slide. Slide 28: If-else Statement Example Try the following activity with your students: 1. Watch the video: JF_V01_S03_L08_V01_switch_images 2. In the course scenarios, review JF_V01_S03_L08_S03_ifelse. Observe how the if-else statement causes Duke to switch images as he moves. 3. Create an if-else statement in the act method of an Actor class that makes the two

images alternate as the instance moves forward. Slide 29: End the Game Discuss the end points to professional games. Students should share some games they have played, and how they end. They should then share their own games they want to develop, and how they want the games to end. Slide 30: Example Duke Game There are no instructor notes for this slide. Slide 31: Find Stop Method in Greenfoot API Remind students that these steps are not just how to figure out how to end the game. Students can view the Greenfoot class documentation at any point in the programming process to see various methods they could use in their Actor and World classes using dot notation. If possible, display this on a projector and have students browse the documentation. Slide 32: Write Stop Method in Source Code There are no instructor notes for this slide. Slide 33: Assign Variables to Instances Example There are no instructor notes for this slide. Slide 34: lookForCode Defined Method Example There are no instructor notes for this slide. Slide 35: Keyboard Controls in Act Method Example Try the following activity with your students: 1. Watch the video: JF_V01_S03_L08_V02_end_game 2. In the course scenarios, review the JF_V01_S03_L08_S04_end_game. Observe how the game is programmed to end. 3. Decide at what point you want your game to end. 4. Write the stop method into your code to end execution of your game. 5. Students should use a scenario that is well-developed for this activity. Slide 36: Terminology There are no instructor notes for this slide.

Slide 37: Summary There are no instructor notes for this slide. Slide 38: Practice Vocabulary 1. Pseudocode These statements describe the tasks or operations for the instances to perform in a mix of Java language and plain English words. This helps us better understand what behaviors we want the instances to perform before we write the real code. Declared in a class, this is used to store information for later use, or to pass information. It can store objects or values. A special method that is executed automatically whenever a new instance of the class is created.

2. Variable 3. Constructor

Try It/Solve It 1. In a new scenario, add a new world subclass, and new actor subclass. Using the world constructor, create the code that constructs one new instance of the actor subclass each time the world is re-initialized. Compile and test the code. Then, in your journal, document the code in the world constructor that you created for this action. 2. What is the size of the world based on the constructor below? public DukeWorld() { super(400, 400, 1); makeDukes(); } x = 400, y =400 3. True or false: To create a new actor instance, the programming statement must include the addObject method and the new keyword. True 4. What does the following variable tell us? Image10 = new GreenfootImage(frog.png); A new image file from the Greenfoot classfrog.pngshould be assigned to the variable image10. 5. In your scenario, create a complete instruction to declare two variables and assign them to newly-created instances of an Actor subclass.

6. Write the pseudocode for an if/else statement that makes an instance appear to change colors as it moves. Then, in your scenario, write this code. Hint: You need to obtain or create the images and save them to the class in the scenario before you write the code. 7. Write an if/else statement in your code that makes an instance appear to move, based on alternating between two image files. Document this code in your journal. 8. Dot notation is required to call the stop method to your Actor subclass. Which class does the stop method come from? Greenfoot class 9. In your scenario, program your instances to move and perform tasks. Decide the point at which you want the game to end, and insert the stop method into your source code. Test the code, and then allow a peer to test your game. Document the source code in your journal. 10. In your journal, document 3 reasons why the world constructor is useful to programming your game. 11. In your journal, document how you used variables in creating your game. Give at least three examples of how variables were used, and write the source code to support the examples. 12. In your journal, document the terminology and concepts you learned in this lesson, and how you will use each in programming your game. 13. Create a flash card game in Greenfoot that helps your peers study the Java Fundamentals vocabulary terms. Follow the steps below. First, create a program that initially displays two cards that will flip over to display a question on one card and an answer on another card after a specific keystroke is pressed. Modify the program created above to ask a user if the question and answer cards match. If the user answers correctly, play a sound. Modify the program created above to display the text "Keep Studying" if the answer is incorrect. Modify the program created above to turn the program into a game. The rules for the game are: The player should flip two cards. If the question card matches the answer card, then both cards are automatically removed from the game. If the question card does not match the answer card, then text or sound should appear that says keep studying. Only create three question cards and three corresponding answer cards. The player wins after all of the cards are removed from the game. Review the matching card game example in the course in Oracle iLearning which is a good example of how the solution should look.

SECTION 3 LESSON 9 Understanding Abstraction Slide 1: Understanding Abstraction What to Watch For In this lesson, students will learn about abstraction. This technique will teach students how to program a set of newly-created instances to perform different tasks, instead of all instances being programmed to perform the same task (such as playing the same sound). When students move on to more complicated programming, this technique will save them valuable time and make it easier to create robust programs. Connections Encourage a discussion about the games they have created earlier in their learning, and how they would like to improve upon these games. What skills are required? Slide 2: What Will I Learn? Objectives There are no instructor notes for this slide. Slide 3: Why Learn It? Purpose Ask students to talk about their frustrations or limitations with programming games in Greenfoot, mainly the amount of code required to make instances perform simple actions. Tell them that they will learn strategies for making this easier. Slide 4: Abstraction On a whiteboard or smartboard, draw a Duke object in the middle of a web. Have students call out sounds they would like the object to make. Put legs on the web, and write down those actions. Then, write the name of a keyboard key next to each action, and explain that you can use abstraction to easily program objects to make these sounds when keyboard keys are pressed, instead of programming the object to just make one sound when one keyboard key is pressed. Slide 5: Abstraction with Variables and Parameters There are no instructor notes for this slide. Slide 6: Create Constructor to Store Variables Try the following activity with students: 1. Have students open a previously-created scenario that they are building on, then save a copy for this exercise, with a name that reflects the name of this lesson. 2. In the course scenarios, review JF_V01_S03_L09_S01_keysound_variables. Open the Duke class and review the constructor that stores the key and sound variables. 3. Students should create a constructor in the Actor's subclass's source code to store the sound and keyboard key variable names. The code should be written at the top of the

source code underneath the class definition. A separate constructor is created to define the two variables and parameters. Slide 7: Create and Place Instances Break down the components of the statement. Explain what each piece of the statement tells Greenfoot to do, so that students can begin to understand how to build these statements in their own code. This adds just one new instance to the scenario each time the world is reinitialized. The addObject statement needs to be repeated for each instance you want added to the world when its re-initialized. Slide 8: Constructor Example Use this slide to review how students will do this in their own code. Revert back to this slide after you explain the Try It activity instructions, so students can refer to it as necessary. Before working on this scenario, students should save a copy of a scenario they created previously, then open that copy and work from that scenario. The name of the scenario should reflect the name of this lesson. Then, before writing the programming statements to automate the creation of five new instances when the world is initialized, students should use the sound recording tools in Greenfoot to create and save 5 different sounds to this scenario. Try the following activity with students: 1. In the Greenfoot scenarios, review the scenario little-crab-5. Observe how the addObject method is used to automatically create instances of the crab, lobster, and worm in the world constructor. 2. In the course scenarios, review the scenario JF_V01_S03_L09_S01_keysound_variables. Observe how code is created in the world constructor. 3. Create a scenario with actor objects and a world. Edit the World constructor to create 5 new instances of an Actor object each time the world is re-initialized. Each instance should have a different keyboard key and sound file passed to them. Slide 9: Terminology There are no instructor notes for this slide. Slide 10: Summary There are no instructor notes for this slide. Slide 11: Practice Vocabulary 1. Abstraction A technique used to command newly-created instances to perform

different actions. Try It/Solve It 1. True or false: One abstraction technique is to use variables and parameters to pass different sound files and keyboard commands to newly-created instances. True 2. In your journal, create a plan for implementing an abstraction technique in your scenario. The plan should include the following: Types of variables to use (string or integer) Variable names Types of information they will pass to the instances

3. Create a subclass of the Animal class. Create a constructor to store the variables that will hold the information you will pass to instances of the class. Compile your source code.

SECTION 3 LESSON 10 Using Loops, Variables and Strings Slide 1: Using Loops, Variables and Strings What to Watch For In this lesson, students will learn how to use loops, variables and strings. These programming concepts will help students easily create games of a larger scale that have multiple objects and keyboard commands to control them. These are extremely important concepts that students need to pay close attention to and master, as they will use them now and in future study of Java programming. Connections Encourage a discussion about the games they have created earlier in their learning, and how they would like to improve upon these games. What skills are required? Slide 2: What Will I Learn? Objectives There are no instructor notes for this slide. Slide 3: Why Learn It? Purpose Ask students to talk about their frustrations or limitations with programming games in Greenfoot, mainly the amount of code required to make multiple instances perform simple actions. Tell them that they will learn strategies for making this easier. Slide 4: Using Loops Have students reflect on the previous activity, and how much time and lines of code it took to write the code to create five new instances when the world is initialized. What if students were asked to create 100 instances, each with a different keyboard key and sound file attached to them? How much time would this take? Loops can automate creation of many instances. In this lesson, we will use a while loop to automate creation of multiple instances. Slide 5: While Loop There are no instructor notes for this slide. Slide 6: While Loop Components While loops can be used for more than just instance creation. We can also use them in the act method to make something happen repeatedly while a condition is true. Ask students to think of examples of something that could happen in a game while a certain condition is true? Slide 7: Control Execution of While Loop Think of a loop variable as a timer that stops after a certain number of seconds and minutes have passed. Except a loop variable counts the number of times that the statement has been executed. For example, if we want to create 500 Dukes, the loop variable will count from 0-

499 (zero is inclusive). Once the statement has looped 500 times, it will stop. Slide 8: Local Variables There are no instructor notes for this slide. Slide 9: Declare Local Variable A local variable will look very similar to a field that you will see at the beginning of a class. You can declare the variable immediately by entering the variable type, naming the variable (usually i) and then initializing it to a number where the counter will start. This will usually be zero. Slide 10: Create the Condition Discuss how once you initialize the variable, you need to decide how many times you want the loop to be executed. Decide this, and then create the while statement with the condition in parentheses. Explain that in the condition, a control operator is used, and a limit for how many times the body of the method will loop needs to be specified. Slide 11: Insert the Statements to Execute Discuss the difference between this while loop statement and the exercise earlier where 5 statements were created to create 5 Duke instances. Explain how this technique is more efficient, because only one statement is needed in the body of the method, and the conditions and other values can be easily changed at any time. This will create a new instance with a specific sound file, keyboard key, and at a specific position at the x and y coordinates in the world. Each instance will be created the same. Slide 12: Increment the Loop Variable Explain why the statement to increment the loop counter is key in programming. Without it, the loop will continue indefinitely and will not stop, creating an infinite number of instances, which would make a mess in your game! Slide 13: While Loop Example Remind students that even though the while loop creates Actor instances, it should be inserted into the world constructor. Slide 14: Object Placement and While Loops There are no instructor notes for this slide. Slide 15: Calculate the Placement of Instances

Have students try the following activity: 1. Watch the video JF_V01_S03_L10_V01_while_loop. 2. In the course scenarios, review the scenario JF_V01_S03_L10_S01_while_loop. Observe how the while loop was used in the world constructor to create rows of code instances. 3. Then have students create a copy of the scenario, and work from this new copy to create a while loop. Slide 16: Infinite Loops If you have a scenario open, show them what happens when you don't have a limit to the number of loops in the source code. Slide 17: Animating Objects with a Keyboard Key Explain to students that there are ways to create the illusion of animation, instead of having to just program the objects to move. You can use multiple 2D images of an object in different states of movement, then program the objects to display like a flipbook to give the illusion that the object is moving. Slide 18: Keyboard Key Example Explain to students that programming animation is complicated because logic is required. It's helpful to write out in plain words what you want the code to do, and what should happen in different scenarios. This can help you form the statements needed to program the code. Ask students: In the statements displayed on this slide, how many boolean expressions do you see? If more than one, why are so many required to achieve these actions? Slide 19: Specify Image to Display In the Greenfoot class documentation, show where the isKeyDown method is located, and review its description. Remind students that they can review this documentation to find methods to call from the Greenfoot class. Explain that the setImage method is used to display the image. An if/else statement is necessary because if the first image is displayed and the keyboard key is pressed, we want something else to happen (a different image displayed). If we just used an if statement, then we couldn't program something to happen if the condition wasn't met. Slide 20: Declare isDown Variable Boolean expressions are necessary because we need to know if the key is pressed down or not. Otherwise, the images would keep flipping back and forth quickly without memory of whether the key is still pressed down or not. Slide 21: isDown Variable Example

There are no instructor notes for this slide. Slide 22: Logic Operators Explain to students that logic operators help connect the boolean expressions together so that the logic of your code flows correctly. In the example, ask students if they see new code that they don't recognize. This should be the exclamation point (!) and ampersands (&&). Slide 23: Types of Logic Operators There are no instructor notes for this slide. Slide 24: Logic Operators Example Students should make note of this code in their journal, as they will use it in the Try It activity a little later. 1. In the Greenfoot scenarios, have students review the scenario little-crab-5. Observe in the code how the crab switches images as he moves, which makes it look like his legs are moving. 2. In the course scenarios, have students review the scenario JF_V01_S03_L10_S02_switch_images. Observe in the code how Duke's arm waves as he moves. 3. Create a new scenario with Actor objects. Create code that makes an object change its image when a keyboard key is pressed. Slide 25: Play Sound Explain to students that playing sound is just one example of a set of actions that Duke can perform when a keyboard key is pressed. Students could program Duke to perform a variety of other actions when a keyboard key is pressed, such as turning, jumping, moving a certain direction, eating something, etc. For the purpose of this lesson, we will work on playing sounds. Slide 26: Define Play Method in Class Students should document this code as you explain how it works. Remind students that the sound file must exist before you program it into the defined method. Slide 27: Enter Play Method in Act Method Have students try the following activity: 1. In the course scenarios, review scenario JF_V01_S03_L10_S03_add_sound. Observe how sound was added to Duke. 2. Create pseudocode that explains the action you want an Actor instance to perform when a key on the keyboard is pressed.

3. Create code that includes a logic operator to make an Actor class switch the image it displays when a key on your computer's keyboard is pressed, as well as play a sound. 4. Allow a peer to test your animation. Note: Students should create a copy of the scenario they are currently working with, and use this copy for this activity. This ensures that students have copies of their code at various stages of development. Slide 28: Arrays Describe to students how a piano or guitar works. These instruments don't just play one sound, they play a variety of sounds when different keys or strings are played. We want our instances to be like an instrument. Each instance should play a different sound, or perform a different action, when keyboard keys are clicked. Slide 29: How Variables Hold Values Explain to students that as they saw in our earlier exercises, a single variable is a container that holds a single value. We want to have a container that holds many values. Slide 30: How Arrays Hold Variables Explain to students that this is what an array object does. It gives us a big enough container to hold all of the elements we need. From this container, we can call certain elements in our source code. Slide 31: Variable Declaration for an Array There are no instructor notes for this slide. Slide 32: Array Example Explain to students that the array object is the container that holds all of the elements, which are the names of keyboard keys. The variable String [ ] keynames holds the array object and its elements in the square brackets. Slide 33: Accessing Elements in an Array Explain to students that the program needs to know which keyboard key to use. The only way it knows is by assigning a position to each keyboard key, which is a number. Then, you call that number, which is an index, to use it. Slide 34: Access Elements in an Array There are no instructor notes for this slide.

Slide 35: Play Different Sounds When Keys Pressed Explain that an array is needed for each set of elements. If you are defining a set of keyboard keys, sound files, image files, numbers, etc., you need a separate array for each. Slide 36: Create the Arrays Students may want to write down this example in their journals for when they write their own arrays. Slide 37: Create makeDukes Method There are no instructor notes for this slide. Slide 38: Call the makeDukes Method Note: Students should save a copy of the scenario they have previously worked on, and then use that new copy for this activity. Have students try the following activity: 1. Use an array to program multiple keyboard keys and sounds into the instances in your game. 2. Allow a peer to try out your game to see if it works. 3. Document the programming statements you created in your journal. Have students try the following activities: 1. Open the scenario JF_scenarioA. 2. We will add an Array to hold five instances of card which will be the maximum number of cards a player can play. Enter the following code above the public Deck mainDeck; statement. public Card[] cardGrid = new Card[5]; 3. Compile your code and fix any errors, ensure the code above is placed in the correct position. 4. We will now add the code to automatically create the objects to store in Array and place them on the World. Type the following code after the addObject(mainDeck, 600, 500); statement. // Set up the spaces for the players hand of cards int i = 0; while( i < 5 ) { cardGrid[i] = new Card(true); addObject(cardGrid[i], 100 + 90*i+1, 150); i = i +1; } 5. Compile your program and fix any errors, ensure the code above is placed in the

correct position. Your scenario should look similar to the following with the Deck object and five Card objects automatically placed. The Card objects are stored in an Array called cardGrid for future use.

Note: Students open the scenario and add the code. Code placement in this example is important, stress this to the students. Check for usual spelling and syntax errors in coded. Students may ask what the 100+90*i+1 does. If they calculate it on their calculators incrementing i by one for 5 calculations then they will see it moves the card placement along the row otherwise they will be placed on top of each other. Slide 39: String Concatenation There are no instructor notes for this slide. Slide 40: String Concatenation Example Students should document this example in their journal, and then edit their while loop and array object with the sound files to utilize string concatenation. Have students try the following activity: 1. In the Greenfoot scenarios, review the scenario piano-complete. Observe in the code how arrays and string concatenation were used to create the piano and its keys. 2. In the course scenarios, review the scenario match game. Observe in the code how arrays were used to assign the answers to the matching cards. Slide 41: Terminology There are no instructor notes for this slide. Slide 42: Summary There are no instructor notes for this slide.

Slide 43: Practice Vocabulary 1. Elements 2. Loop 3. Logic Operators 4. Index 5. Array 6. Local Variables 7. Infinite Loop A type of item stored in an array, such as a string or integer, accessed using an index. A statement that can execute a section of code multiple times. There are several types of loops in Java programming. Symbols that can be used to combine multiple boolean expressions into one boolean expression. A position number in the array object that specifies which array element to access. An object that holds multiple variables. An index can be used to access the variables. A variable declared inside the body of the method to temporarily store values, such as references to objects or integers. A loop that causes the code to keep executing. The code does not stop because the end to the code isn't established.

Try It/Solve It 1. True or false: A loop is a statement that can execute a section of code once. It is an efficient way to pass information to a single instance. False 2. Which of the following is not a required component of a while loop? Java keyword while Condition One or more statements Instance

Instance 3. In the following example while loop, describe what the loop body executes: int i = 0; while (i < 10,000) { addObject (new Duke (t, test.wav), 110, 130); i = i + 1; }

This is a while loop. The loop body creates a new instance of a Duke class, passes two parametersthe t keyboard key and a test.wav sound file, and positions the instance at x = 110 and y = 130 in the world. This loop is executed 10,000 times. 4. In a scenario, create a while loop that creates 10 new instances each time the world is re-initialized. The instances should react to the x keyboard key, and play a sound file. The instances should be placed at coordinates x = 95 and y = 100 in the world. 5. In the following example loop, describe why it is an infinite loop: int i = 0; while (i < 10,000) { addObject (new Duke (g, bark.wav), 180, 120); } This is an infinite loop because there is no statement to increment the loop counter. 6. How do you resolve an infinite loop? Increment the loop variable each time the loop is executed, so that it eventually reaches the limit in the condition. 7. True or false: Logic operators are used to connect one or more boolean expressions. True 8. In the following example code, identify the logic operators by circling them, and define how they are used: public void act() { if (!isDown && Greenfoot.isKeyDown (x)) { setImage (dog.png); isDown = true; } if (isDown && !Greenfoot.isKeyDown(y)){ setImage (dog2.png); isDown = false; } The logic operators are the exclamation marks (!) and ampersands (&&) in the programming statement. 9. In your scenario, create a logic operator that switches between displaying two different images, depending on whether the a or b keyboard keys are pressed. 10. In your journal, plan two array objects. One will use 5 keyboard keys, and one will use 5 sound files. 11. In your scenario, write code that creates a variable declaration and expression to create two arrays. Each array should have 5 elements. 12. Write the statement that accesses the a key in the following array: private String[] keyboardNames =

{a, b, c, d, e, f, g, h}; keyboardNames[0] 13. What is the local variable below initialized to? int i = 5; 5 14. Create a local variable initialized to zero (0), and a condition that specifies that the body of a loop should be executed 150 times. int i = 0; while (i < 150) 15. For an Actor subclass in your scenario, create a string variable that holds an array object. The array object should have up to 5 sound file names. Create a diagram that illustrates the string variable and a table with the array object and positions. String[] soundFiles = new String[5]; String [ ] 0 File.wav 1 File2.wav 2 File3.wav 3 File4.wav 4 File5.wav 5 File6.wav

16. Which of the following characters in the string variable below indicates that the type of variable is an array? Circle the characters: String [ ] keyNames The characters are the square brackets [ ]. 17. Create a flash card game in Greenfoot that helps your peers study the Java Fundamentals vocabulary terms. The rules for the game are: The player should flip two cards. If the question card matches the answer card, then both cards are automatically removed from the game. If the question card does not match the answer card, then text or sound should appear that says keep studying. Create 10-15 question cards and corresponding answer cards. The player wins after all of the cards are removed from the game.

Review the matching card game example in the course in Oracle iLearning which is a good example of how the solution should look.

SECTION 3 LESSON 11 Putting it All Together With Greenfoot Slide 1: Putting it All Together With Greenfoot What to Watch For In this lesson, students will demonstrate what they have learned by creating a Java game in Greenfoot. Connections Encourage a discussion about the skills and knowledge that students have learned from the Greenfoot curriculum. How will this support their further study in the Java programming language? Slide 2: What Will I Learn? Objectives There are no instructor notes for this slide. Slide 3: Putting it All Together Students should open the scenario JF_scenarioB and save a copy to their own space. Students should be familiar with the base scenario as they will have encountered it previously. Remind the students to save regularly as they progress through programming the scenario. Slide 4: Components of BlackJack Scenario There are no instructor notes for this slide. Slide 5: Create Variables in Card Class Stress to the students the importance of taking their time to read the code before entering it and to enter the code at the specified spot. If they have any concerns about code placement check it is the correct position as this can lead to many errors otherwise. Students can review the solution JF_scenarioBworking if they have concerns about where they are placing the code. Stress the importance of documenting errors in their journal. As they compile and debug their game, students will want to document errors they found in their journal and how the errors were corrected. This will help improve their programming skills. Slide 6: Create the Card Variables There are no instructor notes for this slide. Slide 7: Enter Remaining Card Variables There are no instructor notes for this slide. Slide 8: Enum Variables

This slide explains what enum variables are as this is the first time students will have encountered these variables in the Greenfoot section of the course. Slide 9: Card Constructors There are no instructor notes for this slide. Slide 10: Create Card Constructors There are no instructor notes for this slide. Slide 11: Create the draw Method There are no instructor notes for this slide. Slide 12: Create Methods to Return Card Information There are no instructor notes for this slide. Slide 13: Create Remaining Card Class Methods There are no instructor notes for this slide. Slide 14: Create Variables for Deck of Cards There are no instructor notes for this slide. Slide 15: Deck ArrayList and Variables There are no instructor notes for this slide. Slide 16: Deck Constructor There are no instructor notes for this slide. Slide 17: Deck Behaviors There are no instructor notes for this slide. Slide 18: Create fill and shuffle Methods There are no instructor notes for this slide. Slide 19: Create setColour Method

There are no instructor notes for this slide. Slide 20: Create drawCard and getSize Methods There are no instructor notes for this slide. Slide 21: Create drawFlippedCard Method There are no instructor notes for this slide. Slide 22: Creating the Gameplay There are no instructor notes for this slide. Slide 23: Table Variables There are no instructor notes for this slide. Slide 24: Create Table Variables There are no instructor notes for this slide. Slide 25: Setting Up the BlackJack Table There are no instructor notes for this slide. Slide 26: Edit Table Class There are no instructor notes for this slide. Slide 27: Table Constructor There are no instructor notes for this slide. Slide 28: Coding Dealer Gameplay There are no instructor notes for this slide. Slide 29: Create dealerHand Method There are no instructor notes for this slide. Slide 30: Create dealerHand Method There are no instructor notes for this slide.

Slide 31: Scenario Example There are no instructor notes for this slide. Slide 32: Coding End of Gameplay There are no instructor notes for this slide. Slide 33: Create endGame Method There are no instructor notes for this slide. Slide 34: Coding the Game's Action There are no instructor notes for this slide. Slide 35: Code Table Actions in Act Method There are no instructor notes for this slide. Slide 36: Remaining Table Actions in Act Method There are no instructor notes for this slide. Slide 37: Instructions to Play the Game The scenario should be complete and the students should be able to play the game. Illustrate the importance of the programming constructs used and encourage the students to review the code as they play to identify what happens when they perform actions such as running the scenario, clicking cards, clicking buttons etc. Slide 38: Additional Features Some suggestions for expansion would be Instructions on screen, a start button, a restart button and a quit button. Others may include a running scorecard for the players score and display the dealers score and the endgame. Allow students to explore and plan their own version of the game using the methods they have coded. Slide 39: Summary There are no instructor notes for this slide.

SECTION 3 LESSON 12 Creating an Inventory of Java Fundamentals Slide 1: Creating an Inventory of Java Fundamentals What to Watch For This is a lesson to have students review all of the Java programming terminology that theyve been exposed to thus far. Impress upon students that this should be a lesson that allows them to reaffirm the knowledge that theyve gained thus far as well as a lesson that allows them to gain clarity on topics that they might still have questions on. The concepts covered in this lesson are solid building blocks upon which future lessons are going to build. Students have been exposed to several tools up to this point. Reiterate the point that lateral learning should allow them to take the knowledge built in one tool and apply that knowledge using another tool. Describe how computer science professionals use a variety of tools to get their work done and that having this opportunity to work with this many tools allows them to experience that diversity. Connections Encourage a discussion about computer science programming and the various types of jobs that are associated with this type of work programmers, managers, documentation specialists, project managers, etc. Slide 2: What Will I Learn? Objectives There are no instructor notes for this slide. Slide 3: Why Learn It? Purpose Ask students to give examples of all of the different video games or social media devices they are using. Encourage a discussion around how they apply their knowledge from one device to another. Slide 4: Programming Concepts and Terms For each concept reviewed ask students to contribute a reason as to why this concept is important to know as a computer scientist. Slide 5: Alice 3 Concepts and Terms Encourage a discussion on how Alice 3 helps students to learn Java programming. Slide 6: Alice 3 Concepts and Terms Discuss how beginner programmers will create long myFirstMethod acts in Alice 3 and that once they gain experience with creating methods their programs will appear more organized. Slide 7: Greenfoot Concepts and Terms

Encourage a discussion on the differences between Alice 3 and Greenfoot and how Greenfoot, while lots of fun, allows students to begin learning the Java language by paying more attention to syntax. Slide 8: Greenfoot Concepts and Terms Discuss the Greenfoot website and encourage students to upload the games theyve created for other peers to provide comment. Discuss the benefits of gathering feedback from many other students worldwide. Slide 9: Java Programming Terms Encourage students to create a matching game using the programming terms on this slide. The game could be used as a study tool for all upcoming exams. The matching game could randomly display pairs of words and definitions and the object of the game is to beat the timer in matching the term to the definition. Slide 10: Recognize Java Program Constructs Use this slide to review the three constructs highlighted: Function Variable declaration Conditional If statement

Slide 11: Recognize Java Program Constructs Use this slide to review the three constructs highlighted: eatLeaf method comment Case statement

Slide 12: Recognize Java Program Constructs Use this slide to review the three constructs highlighted: variable definition main method class definition

Slide 13: Recognizing Java Syntax Errors There are no instructor notes for this slide.

Slide 14: Tasks for Designing a Game Use this slide to introduce how to break down the steps required to create a program. Explain that project organization will lead to effective project management and help to keep a project on task and on time. Slide 15: Define the Problem Use this example problem definition to reiterate that by clearly defining a problem, a team can create an effective road map or project plan because many of the details are initially defined. Slide 16: Add Interesting Features Take time here to have students brainstorm all of the ways they can make a game challenging. Have groups of students present their thoughts. Take time to point out how most groups thought of similar changes, while other groups thought of one or two differences. Reiterate the value of teamwork and how a team of people can more fully develop an idea than just one person thinking independently on a programming project. Slide 17: Design and Develop This slide is leading you into the discussion about project management. By identifying all of the things that need to be designed and developed you can better develop a project plan to capture all of the details and complete the project on time. Slide 18: Use a Project Plan to Track Progress This slide overviews the components that need to be included in a programming project plan. Discuss how very large programming projects may have 6-10 different project plans that rollup into one very large project plan. Discuss the importance of completing tasks on time and how delays can cause a trickle effect in the overall project. Also discuss how one persons delay in a project could impact 3 or 4 peoples work and schedule. Also discuss how with our global society, we are now creating project plans based on a 24-hour day as opposed to an 8hour day because we can have employees all over the world working on a project. When one programmers day ends another programmers day begins. Slide 19: Project Plan Components Discuss how spreadsheets, or project software is being used to track projects and tasks. This is a simple example of the type of information contained in a project plan. Ask students what other things might be kept in a project plan. Things like resource lists, vacation dates, holidays, dependencies, hard-stop dates, etc. Slide 20: Quality Assurance (Q/A) Stages Describe the benefits of understanding the different quality assurance stages. Having a good understanding of the requirements analysis will help a quality assurance engineer design an

overall plan to ensure the program is working as designed. Test planning is an actual stage where all of the various types of tests are defined. This includes hardware tests, software tests, and usability tests. Test case development is a stage where quality assurance engineers think of scenarios to use to complete the testing. Having a set of scenarios helps multiple quality assurance engineers complete all of the same tasks when testing. The stage for setting up the environment is very important. The overall test plan may define many different environments in which quality assurance engineers do their testing. Test execution can include both manual testing and automated testing. Automated testing takes longer to set up but it is often used for programs that need 100% reliability. Think for example, what it would be like to find a software bug in the software that manages the scores for the Olympics. And finally, test cycle closure defines the end of the test cycle. There may be many test cycle closures. In fact, a test cycle closure allows programmers time to fix the bugs that were documented during the test cycle. Slide 21: Quality Assurance Tasks There are no instructor notes for this slide. Slide 22: Quality Assurance Tasks There are no instructor notes for this slide. Slide 23: Examples of Software Testing Variations This is not an exhaustive list of the test variations that can occur. Ask students to contribute more thoughts around test variations based on given systems they have worked with at home or in other classes. Slide 24: Terminology There are no instructor notes for this slide. Slide 25: Summary There are no instructor notes for this slide. Slide 26: Practice Vocabulary 1. Quality Assurance Testing 2. Requirements Analysis 3. Test Case The systematic process of checking to see whether a product being developed is meeting specified requirements. A systematic process for determining user expectations. A set of conditions or variables with which a test engineer will

determine if a software program is working correctly. 4. Test Execution 5. Test Cycle Try It/Solve It 1. After reviewing the game description below, list at least 5 programming tasks necessary to design and implement the game. The goal is to create a game that teaches basic addition. The game will present from left to right a large square, a large plus sign, another large square, an equals sign, and another large square. There will be a Play button under the above squares and symbols. When the Play button is pressed two numbers will display in the squares to the left and right of the plus sign. The right square will change to a yellow square. After the game player enters a number in the yellow square and presses enter the game will validate whether the correct number has been entered. If it has the square will turn green. If it has not then the square will be cleared and a yellow square will appear again. Programming tasks to design and implement the game: Note that answers can vary example answers include the following: Define the problem Design the scenario Develop a solution Write documentation Test the solution 2. For each of the programming tasks defined above list two sub-tasks. Note that answers can vary example answers include the following: Task Define the problem Design the scenario Develop a solution Write documentation Test the solution Subtask 1 Define purpose Define scene Develop code Write screen instructions Test all actions Subtask 2 Define actions Define scoreing Develop sample data Write credits Test all scoring Applying the same test case to many parts of a software program. A defined start and end point in a quality assurance program.

3. Using all of the tasks and sub-tasks identified above create a project plan for designing the game. The project plan should minimally include the following information: Problem Definition Scenario Definition Development Tasks Quality Assurance Tasks

Note that answers will vary. Look for a solution that is in table format that includes at a minimum the task name, the start date, the end date, and the person responsible. 4. Using the internet, research sample quality assurance test plans. Find a test plan outline on the internet that could work for testing the game described in question 1. A. List the URL of the site that contained the example test plan outline. http://en.wikipedia.org/wiki/Software_testing B. List the test plan, or modified version of the test plan, you think could work for testing the game. Requirements Analysis Test Planning Test Development Text Execution Text Reporting Test Results Analysis Defect Retesting Regression Testing Test Closure 5. Identify the Java programming constructs in the image below:

1. Comments 2. Defined method 3. If statement 6. Identify the Java programming constructs in the image below:

1. Constructor 2. Method call 7. Identify the Java programming constructs in the image below:

1. Parameters 2. Variables 8. Identify the Java programming constructs in the image below:

1. Initializing the iterator 2. While loop 9. In Alice3, when you want the program to go calculate a value of something you typically call a __function. 10. Describe what is meant by orienting objects in Alice3. Objects move together and synchronize their center points. Center points can vary. The intersection of the axes is where the center of an object is located. 11. In Alice3 when you want actions to appear as though they are all occurring at the same time what programming tile do you use? Do Together 12. Consider the phrases to make a decision and to loop, and complete the statements below: Conditional control structures are used __to make a decision___. Repetition control structures are used __to loop______________. 13. In Greenfoot, when a method is executed, what is used to tell the method what to return to the calling method?

Return type 14. In Greenfoot, signatures are a specification of what? A method 15. In Greenfoot what is dot notation used for? To call a method in another class. 16. In Greenfoot what is the double equal symbol == used for? To test equality 17. What is wrong with the following syntax:

The word class is missing after public. 18. What is wrong with the following syntax:

Colon after setup instead of semicolon.

19. What is wrong with the following syntax:

Square brackets in the array instead of curly brackets. 20. Refer to the game example described in question 1. Consider the following addition to the game: A counter will be added to the game. The goal will now be to answer 5 or more problems in a row without getting an incorrect answer. The counter will be used to display how many correct answers, in a row, have been provided. The counter will reset to 0 when an incorrect answer is input. Describe five additional quality assurance test steps that would need to be taken to ensure that the game is functioning correctly. 1) Counter resets to 0 when incorrect answer is entered 2) Counter is incemented 3) Screen displays winning text when counter reaches 5 4) Counter keeps incrementing after winning number of 5 is reached 5) Counter can display more than two digits

Section 4 Instructor Resource Guide


INSTRUCTOR NOTES FOR SLIDES SECTION 4 LESSON 1 Compiling with Eclipse Slide 1: Compiling with Eclipse What to Watch For This is a lesson to introduce students to the Eclipse IDE. Students are exposed to Eclipse and installation allows students to work with the IDE on their home computers. For those students who cannot install the software on their own you may wish to ask your IT department for a computer on which they can practice the software installation. When working with a project in Eclipse point out how similar it is to the BlueJ tool. Allow students to recognize that the skills theyve learned already can once again be applied successfully. Slide 2: What Will I Learn? Objectives There are no instructor notes for this slide. Slide 3: Why Learn It? Purpose There are no instructor notes for this slide. Slide 4: Eclipse Community & Requirements Encourage students to explore the Eclipse website. Slide 5: Java JRE and Java JDK Help students understand the difference between the Java JRE and JDK, especially where students will be installing the Eclipse software on their home computers. Slide 6: Download and Install Eclipse The next several slides walks a student through the Eclipse installation. Encourage students to practice installing the software on another computer to gain experience should the classroom systems already have the software installed. Slide 7: Download and Install Eclipse (cont.)

If students aren't sure about which version (32 bit or 64 bit) to use they can use the command: Windows: (in the terminal) wmic OS get OSArchitecture Mac OS: click Apple menu, and About this Mac, More Info --> Software Linux: type uname -a in the terminal ( if it says x86_64 or ia64 then the OS is 64-bit. If it says i386 or i486 or i586 or i686 then the OS is 32-bit.)

Slide 8: Download and Install Eclipse (cont.) You may need to set the classpath for Java. Slide 9: Download and Install Eclipse (cont.) There are no instructor notes for this slide. Slide 10: Use a Mirror Website to Download & Install Eclipse There are no instructor notes for this slide. Slide 11: Use a Mirror Website to Download & Install Eclipse (cont.) There are no instructor notes for this slide. Slide 12: Use a Mirror Website to Download & Install Eclipse (cont.) There are no instructor notes for this slide. Slide 13: Use a Mirror Website to Download & Install Eclipse (cont.) There are no instructor notes for this slide. Slide 14: Download and Install Eclipse (cont.) There are no instructor notes for this slide. Slide 15: Launching Eclipse There are no instructor notes for this slide. Slide 16: Launching Eclipse (cont.) Note that you can also have students click on the little arrow circle on the far right to take you to the workspace.

Slide 17: Eclipse Edit Area and Views Explain that views can vary and are typically created to support a programmer during their programming phases. For example, the debug view would always display when a programmer was testing his/her code. Slide 18: Eclipse Edit Area and Views (cont.) There are no instructor notes for this slide. Slide 19: Eclipse Edit Area and Views (cont.) There are no instructor notes for this slide. Slide 20: Eclipse Edit Area and Views (cont.) There are no instructor notes for this slide. Slide 21: Steps to Creating a Program There are no instructor notes for this slide. Slide 22: Step 1 - Creating a Program There are no instructor notes for this slide. Slide 23: Step 1 - Creating a Program (cont.) There are no instructor notes for this slide. Slide 24: Step 2 - Creating a Package There are no instructor notes for this slide. Slide 25: Step 2 - Creating a Package (cont.) Review how camel case is used to begin a package name with a lower case letter, to eliminate spaces, and to start each new word in the name with a capital letter. Slide 26: Step 3 - Creating a Class There are no instructor notes for this slide. Slide 27: Step 3 - Creating a Class (cont.) There are no instructor notes for this slide.

Slide 28: Step 4 - Creating and Running Java Code Ensure that students pay attention to syntax in this example. Things to point out include curley braces instead of brackets and double quotes instead of single quotes. Slide 29: Step 4 - Creating and Running Java Code (cont.) There are no instructor notes for this slide. Slide 30: Step 4 - Creating and Running Java Code (cont.) There are no instructor notes for this slide. Slide 31: Program to Convert Gallons to Liters There are no instructor notes for this slide. Slide 32: Java Syntax There are no instructor notes for this slide. Slide 33: Terminology There are no instructor notes for this slide. Slide 34: Summary There are no instructor notes for this slide. Slide 35: Practice There are no instructor notes for this slide. Slide 36: Appendix A: Installation Support Review the resources on Eclipse.org to become familiar with support resources available. Slide 37: Appendix A: Installation Support (cont.) There are no instructor notes for this slide. Vocabulary 1. Switch Workspace To change the different physical location onto which you will store

and save your files. 2. Java Class A construct that is used as a blueprint to create objects. Also a construct in which objects are created.

3. Eclipse Edit and View Areas within the Eclipse IDE that provide a way to navigate a Areas hierarchy of information and allow modifications to elements. 4. Open Perspective 5. Java Main Method 6. Java Package 7. camelCase An option to choose a combination of views and editors. The method inside a class that runs when the class is compiled and ran. Stored inside a project, a mechanism for organizing Java classes into namespaces, or containers. A naming convention to eliminate spaces in a name, but to ease readability with capitalization.

Try It/Solve It 1. Install Eclipse on a computer. Describe your experience. Descriptions will vary based on computer selected. 2. Create a presentation to highlight 5 or more Views that may be of interest to a programmer using Eclipse. Use the help system to learn about the Views available in Eclipse. Work in teams of 2 to create and deliver the presentation. The presentation should include the following: A presentation introduction defining the presentation purpose and the team members. A list of 5 or more Views in Eclipse that will be highlighted. The reason your team selected the 5 Views to demonstrate The process your team went through to choose the 5 Views The actual demonstration and description of the components The presentation summary

Presentations will vary based on Views selected. 3. The pseudo code for converting gallons to liters was described in the lesson. Write the code for the program. The program will convert a specific number of gallons to liters and then display the output. List final code here sample solution is shown below:
importjava.util.Scanner; publicclassConverter{ publicstaticvoidmain(String[]args) Scannersc=newScanner(System.in); doublegallons=sc.nextDouble(); doubleliters=gallons*3.785;

System.out.println(gallons+"gallonsisequivalentto"+liters+"liters"); } }

4. Modify the code written in step 2 to prompt a user for the number of gallons to compute. List final code here sample solution is shown below:
importjava.util.Scanner; publicclassConverter{ publicstaticvoidmain(String[]args){ Scannersc=newScanner(System.in); System.out.println("Howmanygallonsdoyouwishtoconvert?"); doublegallons=sc.nextDouble(); doubleliters=gallons*3.785; System.out.println(gallons+"gallonsisequivalentto"+liters+"liters"); } }

5. Describe 3 ways you can test the program that converts gallons to liters. Answers will vary. Some answers will include the following: Use negative numbers Use numbers with decimals Enter a character instead of a number Enter an extremely large number

SECTION 4 LESSON 2 Control Flow Statements and Blocks of Code Slide 1: Control Flow Statements and Blocks of Code What to Watch For This is a lesson to have students understand the general form of a Java program and to help them recognize when that have all of the necessary components. The lesson breaks down the program components and provides guidelines to follow for each section. Connections When discussing data types and literals encourage students to offer examples of when the type or literal could be used in a program. Discuss why programming rules have incorporated all of the different types and literals. Slide 2: What Will I Learn? Objectives There are no instructor notes for this slide. Slide 3: Why Learn It? There are no instructor notes for this slide. Slide 4-6: General Java Program Form The package keyword defines where this class lives relative to other classes, and provides a level of access control. You use access modifiers (such as public and private) to control access. The import keyword defines other classes or groups of classes that you are using in your class. The import statement provides the compiler information that identifes outside classes used within the current class. The class keyword precedes the name of the class. The name of the class and the file name must match when the class is declared public (which is a good practice). However, the keyword public in front of the class keyword is a modifier and is not required. Variables, or the data associated with programs (such as integers, strings, arrays, and references to other objects), are called instance fields (often shortened to fields). Constructors are functions called during the creation (instantiation) of an object (a representation in memory of a Java class.) Methods are the functions that can be performed on an object. They are also referred to as instance methods. Slide 7-8: Guidelines for Java Program Form There are no instructor notes for this slide. Slide 9: Java Program Form Example

Class names should be nouns in mixed case, with the first letter uppercase and the first letter of each internal word capitalized. This is termed Upper camel case. Methods should be verbs in mixed case, with the first letter lowercase and the first letter of each internal word capitalized. This is termed lower camel case. Variable names should be short but meaningful. The choice of a variable name should be mnemonic: designed to indicate to the casual observer the intent of its use. One-character variable names should be avoided except as temporary throwaway variables. Constants should be declared using all uppercase letters. For the complete code Conventions for the Java Programming Language document go to http://www.oracle.com/technetwork/java/codeconv-1384113.html Slide 10: Package Statement In Java, a package is a group of (class) types. There can be only one package declaration for a class. Packages are more than just a convenience. Packages create a namespace, a logical collection of things, like a directory hierarchy. It is a good practice to always use a package declaration. The package declaration is always at the top of the class. Slide 11: Import Statements You could refer to a class using its fully qualified namespace in your applications, as in the following example: java.util.Date date = new java.util.Date(); But that would quickly lead to a lot of typing! Instead Java provides the import statement to allow you to declare that you want to reference a class in another page. Note: It is a good practice to use the specific, fully qualified package and class name to avoid confusion when there are two classes with the same name, as in the following example. java.sql.Date and java.util.Date The first is a Date class used to store a Date type in a database, and java.util.Date is a general purpose Date class. As it turns out, java.sql.Date is a subclass of java.util.Date. Slide 12: A Simple Programmer-Created Java Class: Student There are no instructor notes for this slide. Slide 13: Constructor Method The example illustrates a simple no-argument constructor. The value returned from the constructor is a reference to a Java object of the type created. Constructors can take parameters. A constructor is a pseudo-method that creates an object. In the Java programming language, constructors are methods with the same name as their class used to create an instance of an object. Constructors are invoked using the new keyword. The line of code to create an object from the Student constructor would appear something like:

Student stu = new Student(); Slide 14: Class Methods A common practice is to create a set of methods that manipulate field data: methods that set the value of each field, and methods that get the value of each field. These methods are called accessors (getters) and mutators (setters). The convention is to use set and get plus the name of the field with the first letter of the field name capitalized (lower camel case). Most modern integrated development environments provide an easy way to automatically generate the accessor (getter) and mutator (setter) methods. In this example, without the keyword this, the compiler would complain: Assignment to self. Slide 15: A Simple Class There are no instructor notes for this slide. Slide 16: A Class with a Main Method There are no instructor notes for this slide. Slide 17-18: Code Blocks There are no instructor notes for this slide. Slide 19: If Else Construct False is displayed as a result of the provided example. Slide 20: For Loop The variable declared inside a for loop does not HAVE to be i, this is merely what is used in the example. The loop will run as long as the condition statement is true. Once it becomes false, you will break out of the loop. Note that the initialized counter does not HAVE to include the incrementing component inside the loop definition. You may increment based on certain conditions defined inside the loop, in such case, the counter would not be automatically incremented each iteration. For example, you may initialize a for loop such that for (int i=0;i<9;) { if(i%2==0) i+=3; else if(i%3==0) i++;

else break; //in such case that this code is reached, you will not be incrementing the counter. } Please explain this to your students. Slide 21: Terminology There are no instructor notes for this slide. Slide 22: Summary There are no instructor notes for this slide. Slide 23: Practice Vocabulary 1. Lower Camel Case 2. For loop 3. Initialized Counter 4. Driver Class 5. Import 6. Code Blocks 7. If/Else Construct 8. Java Keyword First letter lowercase and the first letter of each internal word capitalized. A loop that typically contains an initialized counter and continues to run until a specified condition is no longer true. A variable used for a loop that is initialized to some value. A class that contains a main method. A keyword that is used to identify classes that you want to reference in your class. Segments of code identified by beginning with { and ending with }. Allows access of one code block when a specified condition is true, and a different code block when the condition is false. A word that has a special function in the Java language, and cannot be used as names for classes, methods, or variables.

9. Programmer-created A class that defines instances of objects to be used in another Class class. 10. Upper Camel Case First letter uppercase and the first letter of each internal word capitalized.

Try It/Solve It 1. Name the components that comprise a .java file. List the components in the order that you would expect to see them in a Java program. package

import class variables (or fields) constructors methods 2. Describe the difference between upper camel case and lower camel case and provide an example of when you would them. Upper camel case would be used for a class name. Upper camel case begins with an uppercase letter. Lower camel case would be used for a variable name. Lower camel case begins with a lowercase letter. 3. What syntax is used to import the entire Java utilities package? And if you import an entire package do you also need to import additional classes in the same package separately? import java.util.*; No you do not need to import additional classes of the same package 4. Write the syntax for a simple Java class named StudentOutput with a main method that prints the student information from a student record in the following format: Student Name: Caron Newman Student ID: 223494423 Student Status: Active The student information will be stored in the following variables: fName, lName, stuId, stuStatus. import java.lang; public class StudentOutput { public String fName = Caron; public String lName = Newman; public int stuId = 223494423; public String stuStatus = Active; public static void main(string args[] { System.out.println(Student Name: +fName+ +lName); System.out.println(Student ID: +stuId); System.out.println(Student Status: +stuStatus); } } 5. Write the pseudo code for an if statement that is going to ask a student if they are employed and if they enter yes then the employment status variable will be set to true. The pseudocode may vary for this assignment. Some code here that asks for a student employment status as a yes/no answer if employment status is equal to yes then set status variable to true else if employment status is equal to no then set status variable to false

6. Write the syntax for the if-else pseudocode written in step 5. if (stuEmpStatus = yes) {stuWorkStatus = true; } else {stuWorkStatus = false; } 7. From this lesson, list 10 Java keywords. Answers will vary but should contain some of these: package, import, public, class, int, void, main, return, static, if, else, for 8. Read the scenario and indicate if you would use an if-else construct or a for loop to implement the scenario. a. Need to change all of the 80020 zip codes in the database to 80023. for-loop; this will allow looping through all of the zip codes to make modifications b. Need to add a field to the database to indicate a persons sex. Look for all person_type records that contain female and update the status of person_sex to 1 for female and 2 for male. if-else construct 9. Complete the programmer-created class below. Read the comments for instructions. You may desire to have students complete the class in eclipse. The answer is displayed in the image below. Comments have been removed.

10. Complete the following driver class. Read the comments for instructions. If you have students write the programmer-created class and driver class in eclipse, ask them to compile and run the driver class and see what prints to the console screen. You may wish to have them make modifications to the code such as changing a persons age or adding more people to the comparison. Make sure, when compiling, that both classes are saved in the same package. The answer to the incomplete driver class is displayed below. Comments have been removed.

SECTION 4 LESSON 3 Programming with Data Types and Operators Slide 1: Programming with Data Types and Operators What to Watch For This is a lesson to have students understand how to create, initialize, and convert between data types. Students will also learn how to use arithmetic, logic, and relational operators. Connections When discussing programming with data types and operators, encourage students to offer examples of how these could be useful in a program. Discuss why these concepts are important. Slide 2: What Will I Learn? Objectives There are no instructor notes for this slide. Slide 3: What Will I Learn? Objectives (cont.) There are no instructor notes for this slide. Slide 4: Why Learn It? There are no instructor notes for this slide. Slide 5: Why Learn It? (cont.) There are no instructor notes for this slide. Slide 6: Java Programming Types A visual display of data types helps solidify a students knowledge on the subject. Money is often a good analogy for talking about data types and expected values because each bill or coin has a represented value. You can explain this analogy by giving examples of how a specific coin has a specific value. This example may be tailored to your country's currency. Slide 7: Primitive Data Types The list of primitive data types is contained on multiple slides. Slide 8: Primitive Data Types (cont.) Remembering the exact sizes of these data types is not necessary to be a successful programmer. Here it is important to have an understanding how the data types compare to each other. Being able to put the data types in order by size is really the goal. For the most part, students will stick to commons types like int, double, boolean, and char to write their programs.

Slide 9: Declaring Variables and Using Literals There are no instructor notes for this slide. Slide 10: Declaring Variables and Using Literals (cont.) There are no instructor notes for this slide. Slide 11: Numeric Literal Examples There are no instructor notes for this slide. Slide 12: Java SE 7 Binary Literals There are no instructor notes for this slide. Slide 13: Java SE 7 Binary Literals (cont.) There are no instructor notes for this slide. Slide 14: Java SE 7 Binary Literals (cont.) There are no instructor notes for this slide. Slide 15: Rules for Variable Names There are no instructor notes for this slide. Slide 16-17: Conventions for Variable Names A nice group activity to reinforce these rules and conventions is to have the students try to create different variable declarations on construction paper with markers. Each student should submit one declaration that follows the rules and conventions and then one declaration that breaks a rule and/or convention. Collect the student creations and review them with the whole class and see if the others can identify whether the declarations are legal or illegal or just breaking a convention. Slide 18: Scope of a Variable Scope is a very critical topic for students. It basically means How long is a variable in existence? And when does the variable take precedence over other variables that can exist with the same name? They need to understand when a variable is created in memory and when it is no longer available in memory. Slide 19: Scope of a Variable (cont.)

There are no instructor notes for this slide. Slide 20: Scope of a Variable (cont.) There are no instructor notes for this slide. Slide 21-22: Scope of a Variable (cont.) The answer to the slides question is: 5 100 5 The program starts main() and prints the global class variable counter. Then the method count() is called and a new local variable counter is created for that method call. It is increased to 100 and then prints. When the brace at the end of count() is reached, the local variable goes out of scope (ceases to exist). The program returns to the main() method and prints the global variable counter which has not changed it's value.

Slide 23: Code Highlighting Scope of a Variable There are no instructor notes for this slide. Slide 24: Code Highlighting Scope of a Variable (cont.) There are no instructor notes for this slide. Slide 25: Arithmetic Operators There are no instructor notes for this slide. Slide 26: Arithmetic Operators Precedence Review order of operations if necessary. Slide 27: Increments and Decrements There are no instructor notes for this slide. Slide 28: Increment and Decrement Precedence

There are no instructor notes for this slide. Slide 29: Assignment Operator There are no instructor notes for this slide. Slide 30: Assignment Operator (cont.) The answer is that x will be assigned the value of the expression. This means that the value of the expression will be store in the memory address associated with the variable x. Ask a student to walk through the explanation. Be sure the explanation references the order of operations. Slide 31: Truncation There are no instructor notes for this slide. Slide 32: Truncation (cont.) There are no instructor notes for this slide. Slide 33: Truncation (cont.) Explain that there are a few options and that youll cover all three of them. Slide 34: Understanding Types and Conversions There are no instructor notes for this slide. Slide 35: Implicit Type Conversions There are no instructor notes for this slide. Slide 36: Using Type Casting There are no instructor notes for this slide. Slide 37: Type Casting Operator There are no instructor notes for this slide. Slide 38-39: Converting Data Types There are no instructor notes for this slide.

Slide 40: Using Type Conversions There are no instructor notes for this slide. Slide 41: Understanding Types and Conversions The statement below will not be allowed to compile via Java: int x=12.95; The programmer will need explicitly convert the 12.95 to an int using type casting as follows: int x=(int)12.95; This operation assigns x the value 12 because of truncation. Slide 42-44: Searching Through the Java API Have students open the API site on their computer. Slide 45: Math Class and the Java API Have students navigate the site and locate several classes such as Rectangle and Math. Slide 46: Math Class and the Java API (cont.) There are no instructor notes for this slide. Slide 47: Math Class and the Java API (cont.) There are no instructor notes for this slide. Slide 48: Math Class and the Java API (cont.) The answer to the question at the bottom of this slide is implicit conversion. The int 625 is implicitly converted to a double and thus no error occurs. Slide 49: Strings There are no instructor notes for this slide. Slide 50: String Operations There are no instructor notes for this slide. Slide 51: Relational Operators There are no instructor notes for this slide.

Slide 52: Relational Operators (cont.) There are no instructor notes for this slide. Slide 53: Logic Operators There are no instructor notes for this slide. Slide 54: Logic Operators (cont.) There are no instructor notes for this slide. Slide 55: Logic Operators (cont.) The phrase You qualify for free tutoring help. prints to the screen. However the phrase You may try out for the sports team. does not print as the student's grade is not above 70. Slide 56: Terminology There are no instructor notes for this slide. Slide 57-58: Summary There are no instructor notes for this slide. Slide 59: Practice Vocabulary 1. Initialization 2. Type Conversion 3. Type Casting 4. Scope 5. Arithmetic Operators 6. Boolean 7. long 8. Logic Operators When a variable is assigned a value for the first time. The process of modifying one data type to become a different data type, this may be implicit or explicit. The process of explicitly modifying one data type to become a different data type. Used to describe the block of code where a variable exists in a program. These symbols are used to do addition, subtraction, multiplication, division, and modular arithmetic in math expressions and formulas. This data type can only hold the value true or false. This data type is the largest integer type. These symbols are commonly used to join boolean expressions:

&& || !. 9. double 10. char 11. Order of Operation 12. Conventions 13. Assignment Operator 14. Unary Operators 15. int 16. Truncation 17. Variables 18. literal 19. Primitive Data Types 20. float 21. short 22. Declaration This data type is the largest primitive that can hold a decimal value. This primitive data type is designed to hold single character values. This word describes the precedence that a variable has in a program. A word used to describe standards that most programmers follow. This word is used to describe a Java statement that initializes a variable in a program. Operators that return the result of an operation on only one operand. This data type is the smallest primitive that is designed to hold integer values. A concept where a number is always rounded down to the nearest integer. Objects defined in a program who's assigned value may or may not change. Can be any number, text, or other information that represents a value; used to initialize a primitive type. A special group of data types that do not use the keyword new when initialized. The data type that can be initialized with a number preceding letter f. A primitive type that holds integer numbers within a shorter range than an int. When a variable is defined but not necessarily assigned a value.

Try It/Solve It 1. Write a program that will take in the base and height of a triangle and calculate and display the area of the triangle using the formula below.
1 A= b h 2

import java.util.Scanner;

public class TriangleArea{ public static void main(String[] args) { double base, height,area; Scanner reader= new Scanner(System.in); System.out.println("Enter the base of the triangle"); base=reader.nextDouble(); System.out.println("Enter the height of the triangle"); height=reader.nextDouble(); area=(double)1/2*base*height; System.out.println("The area is " + area + "."); }//end of main }//end of class 2. Write the following math formulas in Java. You will need to use methods from the Math class as well as nesting of methods and parentheses to force the order of operations to correctly calculate the answer. Assume that all the variables in the formulas have already been declared and initialized. a. a =

x 5 6
4
z s i n x 2 5

a=Math.sqrt((Math.pow(x,5)-6)/4); b=Math.pow(x,y)-Math.pow(6,x); c=4*Math.cos(z/5)-Math.sin(Math.pow(x,2)); d=Math.pow(x,4)-Math.sqrt(6*x-Math.pow(y,3)); e=1/(y-(1/(x-Math.pow(2,y)))); f=7*Math.cos(Math.sqrt(5-Math.sin(3*x-4)));

b. b = x y 6 x c.
c= 4 c o s

d. d = x 4 6 x y 3 e. f.
e= y 1 1 x 2y

f =7 co s 5 sin 3 x 4

3. Write a Java program to do the following that determines your weight on another planet. The program should ask for the user's weight on Earth, then present a menu of the other planets in our solar system. The user should choose one of the planets from the menu. The program should display the phrase like the following: Your weight on Mars is 55 lbs. Use the following conversion factors: Planet Conversion factor

(multiply your Earth weight by this number to determine your weight on this planet) Mercury Venus Mars. Jupiter Saturn Uranus Neptune import java.util.Scanner; public class PlanetWeight{ public static void main(String[] args) { double weight,newWeight,conversion; int choice; String planet; Scanner reader= new Scanner(System.in); System.out.println("Enter your weight on Earth:"); weight=reader.nextDouble(); System.out.println("Choose a Planet:"); System.out.println("1. Mercury"); System.out.println("2. Venus"); System.out.println("3. Mars"); System.out.println("4. Jupiter"); System.out.println("5. Saturn"); System.out.println("6. Uranus"); System.out.println("7. Neptune"); choice=reader.nextInt(); if(choice==1) { planet="Mercury"; conversion=.38; }else if(choice==2) { planet="Venus"; conversion=.91; }else if(choice==3) 0.38 0.91 0.38 2.36 0.92 0.89 1.13

{ planet="Mars"; conversion=.38; } else if(choice==4) { planet="Jupiter"; conversion=2.36; }else if(choice==5) { planet="Saturn"; conversion=.92; }else if(choice==6) { planet="Uranus"; conversion=.89; }else if(choice==7) { planet="Neptune"; conversion=1.125; } else { planet="Not a choice"; conversion=0; } newWeight=weight*conversion; System.out.println("Your weight on " + planet + " is " + newWeight + "."); }//end of main }//end of class 4. A bus holds 45 people. The school will only use a bus if they can fill it completely. The rest of the people will ride in vans. Write a program that will take in the number of people that are signed up to go on a field trip. Have the program print the number of busses necessary and then total number of people that will need to ride in vans. import java.util.Scanner; public class FieldTrip{ public static void main(String[] args) { int numberPeople,numberBuses,peopleInVans;

String planet; Scanner reader= new Scanner(System.in); System.out.println("Enter the number of people that are signed up for the field trip"); numberPeople=reader.nextInt(); numberBuses=numberPeople/45; peopleInVans=numberPeople%45; System.out.println("You will need " + numberBuses + " buses. The number of people that will need to ride in vans is " + peopleInVans + "."); }//end of main }//end of class 5. Write true or false on the blanks in the program below to show the value of the boolean variable true_false as the program executes. int i=5; int j=6; boolean true_false; true_false=(j<5); true_false=(j>3); true_false=(j<i); true_false=(i<5); true_false=(j<=5); true_false=(6<6); true_false=(i!=j); true_false=(i==j || i<50); true_false=(i==j && i<50); true_false=(i>j || true_false && j>=4); true_false=(!(i<2 && j==5)); true_false=!true_false; ________ (false) ________ (true) ________ (false) ________ (false) ________ (false) ________ (false) ________ (true) ________ (true) ________ (false) ________ (false) ________ (true) ________ (false)

6. A program that will decide if a student gets into Mountville University. Students must have one of the following criteria: been a valedictorian or salutatorian of a school of 1400 or more had a gpa of 4.0 or better and a SAT score of 1100 or more

had a gpa of 3.5 or better and an SAT score of 1300 or more had a gpa of 3.0 or better and an SAT score of 1500 or more

import java.util.Scanner; public class CollegeEntranceTest{ public static void main(String[] args) { String valdictorian; double gpa; int totalStudents,satScore; boolean qualify=false; Scanner reader= new Scanner(System.in); System.out.println("This program will determine if you can get into Mountville Univeristy."); System.out.println("Please answer the following questions."); System.out.println("How many students attended your school?"); totalStudents=reader.nextInt(); if(totalStudents>=1400) { System.out.println("Were you valedictorian or salutatorian of your school? Answer Y/N"); valdictorian=reader.next(); if(valdictorian.equals("Y")) qualify=true; } if(!qualify) { System.out.println("What was your grade point average on a 4.0 scale?"); gpa=reader.nextDouble(); System.out.println("What was your SAT score?"); satScore=reader.nextInt(); if(gpa>=4.0 && satScore>=1100 ||gpa>=3.5 && satScore>=1300 ||gpa>=3.0 && satScore>=1500) qualify=true; } if(qualify) System.out.println("Congratulations! You qualify for Mountville University."); else System.out.println("Sorry you do not qualify for Mountville University.");

}//end of main }//end of class 7. A professor in college will allow a student to be excused from the final exam if either of the following is true: They have a 90% average or higher in the class and have missed 3 or less class lectures. They have a 80% average or higher in the class and have not missed any class lectures.

The program below will determine whether a student can get out of the exam or not. Rewrite the program so only one if statement is used. import java.util.Scanner; public class FinalExam{ public static void main(String[] args) { double average; int daysAbsent; boolean exempt=false; Scanner reader= new Scanner(System.in); System.out.println("This program will determine if you can get out of the final exam."); System.out.println("Please answer the following questions."); System.out.println("What is your average in the class?"); average=reader.nextDouble(); System.out.println("How class lectures have you missed?"); daysAbsent=reader.nextInt(); if(average>=90) { if(daysAbsent<=3) exempt=true; } else if(average>=80) { if(daysAbsent<=0) exempt=true; } if(exempt)

System.out.println("Congratulations! You are exempt from the final exam."); else System.out.println("You are not exempt from the final exam."); }//end of main }//end of class import java.util.Scanner; public class FinalExam{ public static void main(String[] args) { double average; int daysAbsent; Scanner reader= new Scanner(System.in); System.out.println("This program will determine if you can get out of the final exam."); System.out.println("Please answer the following questions."); System.out.println("What is your average in the class?"); average=reader.nextDouble(); System.out.println("How class lectures have you missed?"); daysAbsent=reader.nextInt(); if(average>=90 && daysAbsent<=3 || average>=80 && daysAbsent<=0) System.out.println("Congratulations! You are exempt from the final exam."); else System.out.println("You are not exempt from the final exam."); }//end of main }//end of class 8. Write a program that calculates the number of buckets of paint to use for a room and the optimal number of cans to purchase. You need to ask the height of the room and the length and width of the room. The room is rectangular. You must paint the walls and the ceiling but not the floor. There are no windows or skylights. You can purchase the following size buckets of paint. 5-liters bucket costs $15 each and covers 1500 square feet 1-liter bucket costs $4 and covers 300 square feet

import java.util.Scanner; public class PaintEstimator{ public static void main(String[] args) { double length,width,height,area,extraArea; int fiveLiter=0,oneLiter=0; Scanner reader= new Scanner(System.in); System.out.println("This program will determine the optimal amount of paint that should be purchased to paint your room."); System.out.println("What is the height of the room?"); height=reader.nextDouble(); System.out.println("What is the width of the room?"); width=reader.nextDouble(); System.out.println("What is the length of the room?"); length=reader.nextDouble(); //Determine the Area to be painted area=2*height*length + 2*height*width + length*width; //Determine the number of 5 liter buckets needed fiveLiter=(int)(area/1500); //Determine the remaining area to be painted extraArea=area-fiveLiter*1500; //Determine the number of 1 liter buckets needed oneLiter=(int)(extraArea/300); //See if there is any more area let and then add one to the number of one Liter buckets if(extraArea-oneLiter*300>0) oneLiter++; //if there are 4 or more one Liter buckets, it is more economical to purchase an extra 5 Lliter bucker. if(oneLiter>=4) { fiveLiter++; oneLiter=0; } System.out.println("You should buy " + fiveLiter + " five Liter

buckets at $15 each."); System.out.println("You should buy " + oneLiter + " one Liter buckets at $4 each.");

}//end of main }//end of class 9. Explain why each of the declarations in the second list are wrong. boolean gameOver = false; int students=50,classes=3; double sales_tax; short number1; int 2beOrNot2be; float price index; double lastYear'sPrice; long class;

The int begins with a 2, variable names cannot begin with a number; the float name contains a space, variable names cannot contain spaces; the double contains an apostrophe ('), variable names cannot contain any symbols other than the underscore (_) or the $ symbol; the long name is a keyword (class), variable names cannot be keywords. 10. Explain why each of the declarations in the second list do not follow conventions for variable names. int cadence=3, speed=55, gear=4; final double SALES_TAX=.06; double gearRatio=.5; int currentGear=5; int c=3,s=55,g=4; final double salesTax=.06; double gearratio=.05,Gear=4; int current_gear;

The first ints are cryptic one-letter names, these should be avoided; salesTax should all be capitalized, final denotes that the variable is a constant; gearratio and Gear are not in lowerCamelCase, they should read gearRatio and gear; current_gear is acceptable, but it is preferable to use lowerCamelCase in modern conventions.

Section 5 Instructor Resource Guide


INSTRUCTOR NOTES FOR SLIDES SECTION 5 LESSON 1 Using Program Control Statements Slide 1: Using Program Control Statements What to watch for Loops are very important to programming. Explain to the students that loops allow for simpler code and help prevent duplicate code being written. It's important to stress that some (in fact most) problems can be solved without loops, but they are a useful and powerful tool that simplifies the program. Connections Help the students understand the concept of a loop by discussing examples where you perform the same action over and over again on different items. Think of washing the dishes: you wash multiple dishes in a row, but you use the same basic motions to clean each dish. The idea is that you have multiple inputs and a singular set of logic to perform an action for each task. Slide 2: What Will I Learn? There are no instructor notes for this slide. Slide 3: Why Learn It? There are no instructor notes for this slide. Slide 4: What is A Loop? There are no instructor notes for this slide. Slide 5: What is A Loop Cont. There are no instructor notes for this slide. Slide 6: Why are Loops Useful? There are no instructor notes for this slide.

Slide 7: Why are Loops Useful Cont. There are no instructor notes for this slide. Slide 8: Loop Control: Stopping the Loop There are no instructor notes for this slide. Slide 9: Loop Control: Updating Input There are no instructor notes for this slide. Slide 10: Types of Loops There are no instructor notes for this slide. Slide 11: The WHILE Loop There are no instructor notes for this slide. Slide 12: Java Syntax for WHILE Loops There are no instructor notes for this slide. Slide 13: Java Syntax for WHILE Loops Cont. There are no instructor notes for this slide. Slide 14: The DO-WHILE Loop There are no instructor notes for this slide. Slide 15: Java Syntax for DO-WHILE Loops There are no instructor notes for this slide. Slide 16: Java Syntax for DO-WHILE Loops Cont. There are no instructor notes for this slide. Slide 17: The For Loop There are no instructor notes for this slide.

Slide 18-20: Java Syntax for FOR Loops There are no instructor notes for this slide. Slide 21: Which Loop Do I Use? The difficulty with learning loops is learning when to use each type appropriately. WHILE loops are best used when you want to continue the loop while some condition is true, but you aren't using an iterator (usually i) to step through elements. FOR loops are best used when you know how many times you wish to execute the loop and you want to iterator through the loop that many times (think of i < totalTimesToRun). Students may wish to make a journal entry for this content. Slide 22-23: Using Break and Continue There are no instructor notes for this slide. Slide 24-27: The Switch Statement There are no instructor notes for this slide. Slide 28: Important Notes about Switch There are no instructor notes for this slide. Slide 29: Writing a Loop There are no instructor notes for this slide. Slide 30: Prompting The User For Input Scanner Students may wish to include an entry in their journal about scanners. Slide 31: Why Scanner? There are no instructor notes for this slide. Slide 32-33: More Useful Scanner Methods There are no instructor notes for this slide. Slide 34-37: Writing a Loop Cont. There are no instructor notes for this slide. Slide 38: Terminology

There are no instructor notes for this slide. Slide 39: Summary There are no instructor notes for this slide. Slide 40: Practice Vocabulary 1. WHILE Loop 2. Switch Statements 3. Loops 4. DO-WHILE Loop 5. Break 6. Scanner 7. Continue A type of loop that executes an unknown number of times until a condition is met. A type of loop control that allows different segments of code to execute when the input value matches a given condition. A set of logic that is repeatedly executed until a certain condition Is met. A loop that executes an unknown number of times until a condition is met, but always executes the first time through the loop. A keyword used to terminate a loop from executing before the loop condition is met. A tool used for reading in input from a user during program execution. A keyword used to skip over the remaining code in a loop and return program control to the beginning of the loop to execute again. A type of loop that uses an iterator to keep track of how many times a loop will execute.

8. FOR Loop

Try It/Solve It 1. Write a program that prompts the user to enter two floating point (double) numbers and an operator ( *, +, /, %, -). Print the results of the given operation and ask the user if they would like to perform an operation again. For reading the command line, use the Scanner class, with the input file being standard in (System.in):
Scanner scan = new Scanner(System.in);

Hint: Prompt the user to quit after you have outputted the result. Ask the user if they would like to quit and if they type yes, quit the loop. Otherwise loop through the program again until the user decides to quit.
import java.util.Scanner; public class calculate { public static void main(String args[]) {

Scanner scan = new Scanner(System.in); boolean quit = false; String line; double num1, num2; char operator; do { /* Prompt the user for the first Double */ System.out.print("Enter a double: "); /* user Scanner to wait for the next line */ line = scan.nextLine(); /* read the string from Scanner as a Double */ num1 = Double.parseDouble(line); /* Prompt the user for the second Double */ System.out.print("Enter another double: "); /* user Scanner to wait for the next line */ line = scan.nextLine(); /* read the string from Scanner as a Double */ num2 = Double.parseDouble(line); /* Prompt user for operator */ System.out.print("Enter an operator: "); line = scan.nextLine(); /* since we can only switch on primitive types, we need * to store the operator as a char, not as a String. Since * we know that the operator is the first character the user * types, we can take the first character of the String (at * index 0) and store it into a char. */ operator = line.charAt(0); System.out.println("Answer: " + calculateDouble(num1, num2, operator)); /* Prompt the user to quit */ System.out.println("Would you like to quit? (yes or no) "); line = scan.nextLine(); if(line.equals("yes")) { quit = true; } } while(!quit); return; } public static double calculateDouble(double num1, double num2, char operator) { double answer = 0; /* Switch on the char operator and perform needed action */ switch (operator) { case '*':

answer = num1 * num2; break; case '/' : answer = num1 / num2; break; case '-' : answer = num1 - num2; break; case '+' : answer = num1 + num2; break; case '%' : answer = num1 % num2; break; default: //If there's an error, quit. System.out.println("Invalid operator"); System.exit(1); } return answer; } }

2. Imagine you are writing a program that prints out the day of the week (Sunday, Monday, Tuesday, etc.) for each day of the year. Before the program executes, can you tell how many times the loop will execute? Assume the year is not a Leap year. Given your answer, which type of loop would you need to implement? Explain your reasoning. Yes, you can tell how many times the loop will execute because you know that there are 365 days in a year. Since the number of times the loop will execute is known, a FOR loop is the best option. 3. True of False: IF/ELSE statements can always be replaced with SWITCH statements. False. IF/ELSE statements can only be replaced with SWITCH statements when the same condition (e.g. the value of a variable) is being repeatedly compared. If the IF statements are comparing different values, or are comparing multiple values in the same IF statement, they are not easily translated into SWITCH statements. A SWITCH statement only works on primitive data types such as int, double, char, byte, etc. 4. Suppose you are implementing a search routine that searches through a String, character by character, until it finds a space character. As soon as you find the first space character, you decide that you do not want to continue searching the string. If you are using a WHILE loop and your loop will continue to execute until you have gone through the entire string, should you use the keyword break or continue when you find the first space character? Why? Why would you not use the other keyword? Break is the best option for this particular case since we want to exit the loop (i.e. stop executing) when a space character is found. Continue would skip over the rest of the logic in the loop and begin executing again until the end of the String. Break exits the loop immediately, and no other code is executed. 5. Consider you are asked to decode a secret message. The coded message is in numbers and each number stands for a specific letter. You discover enough of the secret code to decode the current message. So far, you know:

1 represents D 2 represents W 3 represents E 4 represents L 5 represents H 6 represents O 7 represents R Write a program that prompts the user for 10 numbers, one at a time, and prints out the decoded message. If the user enters a number that is not one of those already deciphered, prompt him/her for a new number. Test your code with the following input: 5344626741 HELLOWORLD will be printed with the test data. A sample answer is included below:
publicstaticvoidmain(String[]args){ Scannerin=newScanner(System.in);//Usescannertoreadintheuser's input System.out.println("Pleaseenterasecretmessageonenumberatatime."); intinput=0;//initializetheintegerusedtostoretheinput StringdecodedMessage="";//initializeastringforthefinaldecoded message for(inti=0;i<=9;i++){//useaforlooptodecodeeachof10integers input=in.nextInt();//readthenumber switch(input){ case1: decodedMessage+="D"; break; case2: decodedMessage+="W"; break; case3: decodedMessage+="E"; break; case4: decodedMessage+="L"; break; case5: decodedMessage+="H"; break; case6: decodedMessage+="O"; break; case7: decodedMessage+="R"; break; default: System.out.println("Pleaseenteranumber17forthe decodetowork."); }

} in.close();//closetheScanner System.out.println("Yourdecodedmessageis:"+decodedMessage); }

SECTION 5 LESSON 2 Using Classes, Objects, and Methods Slide 1: Using Classes, Objects, and Methods What to Watch For Classes and objects are usually very hard for students to understand at first. It's important to get them to realize that a class is essentially a complex data type that they can declare and define. It is also important for students to understand that a class consists of variables and methods, and how being declared in a class vs. a main program is different. Slide 2-3: What Will I Learn? There are no instructor notes for this slide. Slide 4: Why Learn It? There are no instructor notes for this slide. Slide 5: Creating a Class Template There are no instructor notes for this slide. Slide 6: Creating a Class Template: Example There are no instructor notes for this slide. Slide 7: Creating a Class Template: Example (continued) There are no instructor notes for this slide. Slide 8: Creating a Class Instance Make sure students understand the new operator, what it does, and how it works. Also make sure they understand the relationship between the new operator and instantiating an object. Slide 9: Constructors It is important for students to understand the relationship between Constructors and creating an object of a specific class. Make sure to watch for confusion between the default constructor and constructors with parameters. Slide 10: Default Constructor There are no instructor notes for this slide. Slide 11: Constructor with Parameters

There are no instructor notes for this slide. Slide 12: Class Methods There are no instructor notes for this slide. Slide 13: Accessor Methods It may be a good idea to re-iterate the fact that most variables in a class are private, and therefore can only be accessed by accessor methods. Slide 14: Mutator Methods There are no instructor notes for this slide. Slide 15: Using Constructors and Methods: Example There are no instructor notes for this slide. Slide 16: Using the this reference There are no instructor notes for this slide. Slide 17: Using the this reference: Example There are no instructor notes for this slide. Slide 18: Creating a Card Class: Example There are no instructor notes for this slide. Slide 19: Reference Object Representation There are no instructor notes for this slide. Slide 20: Understanding Garbage Collection Garbage collection is something that many programmer's take for granted if they learn Java before any other language. It may be important to mention that Java is one of the few languages with garbage collection, and that it is important as a programmer to be able to keep track of the memory you allocate for objects in your program. Slide 21: Understanding Garbage Collection: Example There are no instructor notes for this slide.

Slide 22: Understanding Garbage Collection: Example There are no instructor notes for this slide. Slide 23: Finalizers There are no instructor notes for this slide. Slide 24: Terminology There are no instructor notes for this slide. Slide 25: Summary There are no instructor notes for this slide. Slide 26: Practice There are no instructor notes for this slide. Vocabulary 1. Class 2. Object 3. New 4. Null 5. Reference 6. Constructor 7. Instantiate 8. Method Try It/Solve It 1. Create a simple class Shape that will represent a 2-dimensional shape with line segments for edges. It should have the following instance: numSides (int), regular (boolean). Create at least two constructors and getter and setter methods. public class Shape { int numSides; boolean regular; Shape(){ A template used for making Java objects. An instance of a class. The operator used to create an instance of a class. If a reference is declared without being instantiated, it refers to this value. To access the members and methods of a class a programmer must use this. A special method used to create an instance of a class. A verb used to describe the act of creating a class object. A procedure that is encapsulated as part of a class.

numSides = 3; regular=true; } Shape(int n, boolean regular){ numSides = n; this.regular = regular; } public boolean isRegular(){ return regular; } public int getSides(){ return numSides; } public void setSides(int s){ numSides = s; } public void setRegular(boolean regular){ this.regular = regular; } } 2. Identify the key parts of the Java Class below. Put asterisks next to all the instance variables. Place a box around each constructor. Circle the signature of methods other than the constructor method. Place triangles around the parameters. Underline the return types of methods. public class Animal { int weight, height; double speed; Animal() { weight = 50; height = 4; speed = 2; //miles per hour } Animal(int w, int h, int s ) { weight = w; h = height; speed = s } public double getTime(double miles) { //gets the number of hours to go these miles return miles/speed; }

public int getWeight() { return weight; } public int getHeight() { return height; } public double getSpeed() { return speed; } } public class Animal { int weight*, height*; double speed*; Animal() { weight = 50; height = 4; speed = 2; //miles per hour } Animal(int w, int h, int s){ weight=w; h=height; speed=s } public double getTime(double miles){ //gets the number of hours to go these miles return miles/speed; } public int getWeight(){ return weight; } public int getHeight(){ return height; } public double getSpeed(){ return speed;

} }

3. Write code to create two instances of the Animal class template listed in problem #2. Be sure to use each of the two constructors provided. Then add Java code that will print the following: Animal #1 has a speed of ___. Animal #2 has a speed of ___.

Be sure that the blanks is automatically filled in with the actual speeds. Use the methods provided to access the speeds. Animal a1 = new Animal(); Animal a2 = new Animal(50,21,4); System.out.println(Animal #1 has a speed of + a1.getSpeed() + Animal #2 has a speed of + a2.getSpeed()); 4. Write a class Student. It should have the following instance variables for the name, credits, grade point average (GPA), and quality Points. Create a constructor method. Create two other methods as follows: A method that will return the current grade point average which will be the quality points divided by the credits. A method that will take in the credits for a class or semester along with the quality points. It should update the credits, the quality points, and the GPA.

public class Student { String name; int credits,qualityPoints; double gpa; Student(String name,int credits, int qualityPoints) { this.name = name; this.credits = credits; this.qualityPoints = qualityPoints; gpa = (double)qualityPoints/(double)credits; } public double getGPA(){ return gpa;

} public addCredits(int credits, int qualityPoints){ this.credits += credits; this.qualityPoints += qualityPoints; gpa = (double)qualityPoints/(double)credits; } } 5. Using the class you created in #4, create three instances of the Student Class from the table below: Name Mary Jones John Stiner Ari Samala Credits 14 60 31 Quality Points 46 173 69

Student mary = new Student(Mary Jones,14,46); Student john = new Student(John Stiner,60,173); Student ari = new Student(Ari Samala,31,69); 6. Using the instance variables created in #6, add 13 credits and 52 quality points to the student Ari Samala. ari.addCredits(13,52); 7. Using the Card class from the slides and test the program to make sure it works. Add a second random Card. Code is included below: public class Card{ String suit,name; int points; Card(int n1, int n2){ suit = getSuit(n1); name = getName(n2); points = getPoints(name); } public String toString(){ return "The " + name + " of " + suit; } public String getName(int i){ if(i == 1) return "Ace";

if(i == 2) return "Two"; if(i == 3) return "Three"; if(i == 4) return "Four"; if(i == 5) return "Five"; if(i == 6) return "Six"; if(i == 7) return "Seven"; if(i == 8) return "Eight"; if(i == 9) return "Nine"; if(i == 10) return "Ten"; if(i == 11) return "Jack"; if(i == 12) return "Queen"; if(i == 13) return "King"; return "error"; } public int getPoints(String n){ if(n == "Jack" ||n == "Queen" ||n == "King"||n == "Ten") return 10; if(n == "Two") return 2; if(n == "Three") return 3; if(n == "Four") return 4; if(n == "Five") return 5; if(n == "Six") return 6; if(n == "Seven") return 7; if(n == "Eight") return 8; if(n == "Nine") return 9; if(n == "Ace") return 1; return -1; } public String getSuit(int i){ if(i == 1) return "Diamonds"; if(i == 2) return "Clubs"; if(i == 3) return "Spades"; if(i == 4) return "Hearts"; return "error"; } } public class Main { public static void main(String args[]){

int suitNumber = (int)(Math.random()*4.0+1); int faceNumber = (int)(Math.random()*13.0+1); Card newCard = new Card(suitNumber,faceNumber); System.out.println(newCard); } } public class Main { public static void main(String args[]){ int suitNumber = (int)(Math.random()*4.0+1); int faceNumber = (int)(Math.random()*13.0+1); Card newCard = new Card(suitNumber,faceNumber); System.out.println(newCard); suitNumber = (int)(Math.random()*4.0+1); faceNumber = (int)(Math.random()*13.0+1); Card newCard2 = new Card(suitNumber,faceNumber); System.out.println(newCard2); } } 8. Add code to the Main class in exercise 7 to the following: Display the total point value for the two random cards. Ask the user if they would like another card. If they say yes display the new card and the points for all 3 cards in their Hand. Loop to allow the user to continue to add cards to the hand until the number of points goes over 21 or the user decides not to add any more cards or the total number of cards is 5.

import java.util.Scanner; public class Main { public static void main(String args[]){ int suitNumber = (int)(Math.random()*4.0+1; int faceNumber = (int)(Math.random()*13.0+1); Card newCard = new Card(suitNumber,faceNumber); System.out.println(newCard); suitNumber = (int)(Math.random()*4.0+1); faceNumber = (int)(Math.random()*13.0+1);

Card newCard2 = new Card(suitNumber,faceNumber); System.out.println(newCard2); int points = newCard.points+newCard2.points; System.out.println("The total points = " + points); int numCards = 2; Scanner reader = new Scanner(System.in); int choice = 1; while(choice == 1 && points < 21 && numCards < 5){ System.out.println("Do you want another card?"); System.out.println("1. Yes"); System.out.println("2. No"); choice=reader.nextInt(); if(choice == 1){ numCards++; suitNumber = (int)(Math.random()*4.0+1); faceNumber = (int)(Math.random()*13.0+1); newCard2 = new Card(suitNumber,faceNumber); System.out.println(newCard2); points+ = newCard2.points; System.out.println("The total point = " + points); } } } }

Java Fundamentals - Section 6 Instructor Resource Guide


INSTRUCTOR NOTES FOR SLIDES

SECTION 6 LESSON 1 Using Arrays Slide 1: Using Arrays No instructor notes Slide 2: What Will I learn? No instructor notes Slide 3: What Will I learn? (cont.) No instructor notes Slide 4: Why Learn it? Here we want to express how important arrays are to computer science. Begin to explain what a data structure is, and that arrays are one of the most basic for students to learn. Go into what arrays can be used for specifically representing mathematical structures such as vectors and matrices. Slide 5: What is an Array? No instructor notes Slide 6: Declaring an Array No instructor notes Slide 7: Declaring an Array Example No instructor notes

Oracle Academy

Instructor Resource Guide: Section 6

Copyright 2012, Oracle. All rights reserved.

Slide 8: Try It! Students should be able to identify the data type, variable name, and array size for each of the samples. Slide 9: Alternative array declaration syntax No instructor notes Slide 10: Initializing an Array No instructor notes Slide 11-12: Initializing an Array Example No instructor notes Slide 13: Try It! String[] myBouquet = {Rose, Sunflower, Eucalyptus, Dandelion, Violet, Lily}; Slide 14: Initializing an Array (cont.) No instructor notes Slide 15-16: Array Representation No instructor notes Slide 17: Arrays Object Types No instructor notes Slide 18: Accessing Array Length Remind students that most classes have a length() method. Arrays do not use length() but just length, which is an instance variable created by Java for arrays. Adding the () will cause a syntax error. Slide 19: Iterate Through an Array Encourage students to use .length when iterating rather than the integer value they entered when declaring the array. This will assure that they do not receive the index out of bounds Oracle Academy 2 Instructor Resource Guide: Section 6

Copyright 2012, Oracle. All rights reserved.

error. Slide 20: Iterate Through an Array Explained No instructor notes Slide 21: Iterate Through an Array (cont.) No instructor notes Slide 22: Iterate Through an Array (cont.) Using knowledge of FOR loop from previous slides the For Each loop is introduced Slide 23: Iterate Through an Array (cont.) No instructor notes Slide 24: Try It Code to implement both the FOR loop and the For Each loop Slide 25: What is a 2-Dimensional Array No instructor notes Slide 26-28: Declaring a 2-Dimensional Array No instructor notes Slide 29-31: Initializing a 2-Dimensional Array No instructor notes Slide 32-32: 2-Dimensional Array Representation No instructor notes Slide 34: 2-Dimensional Array Accessing Data No instructor notes

Oracle Academy

Instructor Resource Guide: Section 6

Copyright 2012, Oracle. All rights reserved.

Slide 35: Try It! Peach Rose White Lilly The above is what is displayed after the code is executed. Slide 36: Accessing the Length of 2-Dimensional Arrays It is important for students to understand the difference between using the brackets [] and not using the brackets when calling on the length. They may wish to include an entry in their journal for 2-Dimensional arrays and accessing the length. When using the brackets, an index or key must be provided even if all the internal arrays are the same length. Slide 37: Try It! two.length == 3 is FALSE four[ 0].length is not valid syntax Slide 38-39: 2-Dimensional Arrays Object Types No instructor notes Slide 40-41: Nested For Loops 2-Dimensional Iteration No instructor notes Slide 42: Sorting Arrays Students may wish to include the following sorting examples in their journals. Slide 43-44: Selection Sort No instructor notes Slide 45: Selection Sort Coded Step through the code with the example on slide 41, updating the array with each swap. Slide 47-49: Bubble Sort No instructor notes

Oracle Academy

Instructor Resource Guide: Section 6

Copyright 2012, Oracle. All rights reserved.

Slide 50: Bubble Sort Coded No instructor notes Slide 51-52: Merge Sort No instructor notes Slide 53: Merge Sort Coded You may wish to revisit coding merge sort after recursion is introduced. The complexity of merge sort is simplified with recursion. Slide 54: Searching Through Arrays No instructor notes Slide 55: Searching Through Arrays Sequentially No instructor notes Slide 56-59: Using Binary Search With Sorted Arrays No instructor notes Slide 60-61: Binary Search Example No instructor notes Slide 62: Try It! You may wish to have the students line up in alphabetical order, then do search for a specific student. Go through the binary search process and have those who have been excluded from the search sit back in their seats. This is an active way to get students to understand the searching algorithm. You may even want to perform this on a small portion of the students for time and space contraints. Slide 63: Using Existing Code to Sort and Search You may wish to have students navigate the Array API to see how the provided search and sort algorithms work.

Oracle Academy

Instructor Resource Guide: Section 6

Copyright 2012, Oracle. All rights reserved.

Slide 64-67: Command Line Arguments No instructor notes Slide 68: Terminology No instructor notes Slide 69-71: Summary No instructor notes Slide 72: Practice No instructor notes

Terminology Directions: Identify the vocabulary word for each definition below:

1. Iterate or Traverse 2. Array 3. 2-Dimensional Arrays 4. Index 5. Declare an Array 6. Command-Line Arguments 7. Algorithm 8. Merge Sort

The act of progressing through an array A structure that stores multiple values of the same data type An array of arrays An integer that identifies the location of a value in an array Creating space of a given size for an array The ability to pass data into the main function and access it as an element of an array. A logical computational procedure that if correctly applied ensures the solution of a problem A sorting algorithm that divides elements into individual sublists and merges the list together in sorted order until they are a single array again. A sorting algorithm that involves finding the smallest value in an array and swapping it with the first value and repeating this with the second and third and so on until the array is sorted. 6 Instructor Resource Guide: Section 6

9. Selection Sort

Oracle Academy

Copyright 2012, Oracle. All rights reserved.

10. Nested For Loop 11. Binary Search

A for loop inside of a for loop A search method that can only be performed on sorted lists and involved removing half of the array with each comparison to the value in question. A sorting algorithm that goes through the array comparing adjacent values, swapping those that are in the wrong order, and continuing this until the array is sorted. A search method that involves iterating through the array until the value is found an order based on the ASCII value of characters

12. Bubble Sort

13. Sequential Search 14. Lexicographical Order

Try It/Solve It 1. Declare a one dimensional array name score of type int that can hold 9 values. int[] score = new int[9]; 2. Declare a 2-dimensional array named price of type float that has 10 rows and 3 columns. float[][] price = new float[10][3];

3. Declare and initialize a 2-dimensional array named matrix of type long that has 4 rows and 3 columns to have all its values set to 5. long[][] matrix = {{5,5,5}, {5,5,5}, {5,5,5}, {5,5,5}};

Oracle Academy

Instructor Resource Guide: Section 6

Copyright 2012, Oracle. All rights reserved.

4. Declare and initialize a one dimensional byte array named values of size 10 so that all entries contain 1. byte[] values = {1,1,1,1,1,1,1,1,1,1};

5. Without typing in the code determine the output of the following program. int num[] = {7,7,6,6,5,5,4,4}; for(int i = 0; i < 8; i = i + 2) System.out.print(num[i]); 7654 6. Without typing in the code determine the output of the following program. int[][] num = {{3,3,3},{2,2,2}}; int[] array = {4,3,2}; for(int i = 0; i < 3; i++){ num[1][i] = num[0][i]+array[i]; } for(int i = 0; i < 2; i++){ for(int j = 0; j < 3; j++){ System.out.print(num[i][j]); } System.out.println(); } 333 765

8. In a certain class, there are 5 tests worth 100 points each. Write a program that will take in the 5 tests scores for the user, store the tests scores in an array, and then calculate the students average. In Algebra class we learn about matrices. We learn to add, subtract, and multiply 2x2 matrices and 3x3 matrices. Below are some examples from Algebra class with the answers:

Oracle Academy

Instructor Resource Guide: Section 6

Copyright 2012, Oracle. All rights reserved.


3 4 5 6 3 4 5 6

+ -

1 0 2 3

4 4 3 9

1 0 2 3

2 4 7 3


3 4 5 6 * 1 0 2 3

= 5 12 7 18

It is almost apparent how to add. We add the first position in the first matrix with the first position in the second matrix. We continue with the corresponding positions to get the answer. Subtraction follows this same positional methods. Multiplication of matrices appears to be confusing since it does not follow the positional method used in addition and subtraction. The answer is achieved by taking the row from the first matrix and the column from the second matrix and multiplying the respective values and then taking the sum of the products. The answer above was achieve as follows: 3(1)+4(-2)=-5 5(1)+6(-2)=-7 3(0)+4(3)=12 5(0)+6(3)=18

Write a program that take in two matrices and then allow the user to choose to add, subtract, or multiply them and display the answer. The program will display the following menu: A. Enter Matrix A B. Enter Matrix B C. Display A + B D. Display A - B E. Display A * B F. Exit The program should loop and allow the user to continue to choose different options until they choose quit. The well written program will modularize the process into different methods. import java.util.Scanner; public class MatrixProgram { public static void main(String[] args) { int[][] A = new int[2][2]; Oracle Academy 9 Instructor Resource Guide: Section 6

Copyright 2012, Oracle. All rights reserved.

int[][] B = new int[2][2]; int choice; Scanner reader = new Scanner(System.in); do{ menu(); choice = reader.nextInt(); switch(choice){ case 1: enterMatrix(A); break; case 2: enterMatrix(B); break; case 3: add(A,B); break; case 4: subtract(A,B); break; case 5: multiply(A,B); break; case 6: break; } }while(choice != 6); } public static void menu(){ System.out.println("1. System.out.println("2. System.out.println("3. System.out.println("4. System.out.println("5. System.out.println("6. } public static void enterMatrix(int[][] a){ Scanner reader = new Scanner(System.in); System.out.print("Enter the element in first row and first column: "); a[0][0] = reader.nextInt(); System.out.print("Enter the element in first row and second column: "); Oracle Academy 10 Instructor Resource Guide: Section 6

Enter Matrix A"); Enter Matrix B"); Display A + B"); Display A - B"); Display A * B"); Exit");

Copyright 2012, Oracle. All rights reserved.

a[0][1] = reader.nextInt(); System.out.print("Enter the element in second row and first column: "); a[1][0] = reader.nextInt(); System.out.print("Enter the element in second row and second column: "); a[1][1] = reader.nextInt(); } public static void add(int[][] a,int[][] b){ System.out.println("A + B is"); System.out.println((a[0][0]+b[0][0]) + "\t" + [1])); System.out.println((a[1][0]+b[1][0]) + "\t" + [1])); } public static void subtract(int[][] a,int[][] b){ System.out.println("A - B is"); System.out.println((a[0][0]-b[0][0]) + "\t" + [1])); System.out.println((a[1][0]-b[1][0]) + "\t" + [1]));

(a[0][1]+b[0] (a[1][1]+b[1]

(a[0][1]-b[0] (a[1][1]-b[1]

} public static void multiply(int[][] a,int[][] b){ System.out.println("A * B is"); System.out.println((a[0][0]*b[0][0] + a[0][1]*b[1][0]) + "\t" + (a[0][0]*b[0][1] + a[0][1]*b[1][1])); System.out.println((a[1][0]*b[0][0] + a[1][1]*b[1][0]) + "\t" + (a[1][0]*b[0][1] + a[1][1]*b[1][1])); } } 9. MazeMan Program: Get the files Maze.java, MazeMan.java, and MazeManApplet.java from your instructor. Add the files to a java project and run. You should find a small yellow fellow trapped in a maze. Clicking on the applet and using the arrow keys will allow him to move around and eat the dots.

Oracle Academy

11

Instructor Resource Guide: Section 6

Copyright 2012, Oracle. All rights reserved.

The walls of the Maze are set by the two-dimensional matrix listed in the MazeManApplet.java code and copied here: /* 0 = wall 2 = small dot 3 = power dot -1 = ghost box 1 = empty or starting position */ int matrix[][] = {{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,3,2,2,2,0,2,2,2,2,2,2,2,2,2,2,2,2,3,0}, {0,2,0,0,2,0,0,0,0,2,0,0,0,0,0,2,0,0,2,0}, {0,2,0,0,2,0,2,2,2,2,2,2,2,2,2,2,2,2,2,0}, {0,2,2,3,2,0,2,0,0,0,2,0,0,0,2,0,0,0,0,0}, {0,2,0,0,2,0,2,0,2,2,2,2,2,0,2,2,2,2,2,0}, {0,2,2,2,2,0,2,2,2,-1,-1,-1,2,0,2,0,0,0,2,0}, {0,2,0,0,2,0,2,0,2,-1,-1,-1,2,2,2,0,2,2,2,0}, {0,2,2,2,2,0,2,0,2,2,2,2,2,0,2,2,2,0,2,0}, {0,2,0,0,2,2,2,0,0,0,2,0,0,0,2,0,2,0,2,0}, {0,2,2,2,2,2,1,2,2,2,2,2,2,2,2,2,2,0,2,0}, {0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0}, {0,2,2,2,0,2,2,2,2,2,2,2,2,2,2,2,3,0,2,0}, {0,2,0,2,0,2,0,0,0,0,0,0,0,0,0,0,2,0,2,0}, {2,2,0,3,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}}; Using the 16 x 20 grid below design your own maze walls using a highlighter. Draw zeros on all the high lighted areas and place 2's and 3's where you wish to see dots. Place -1's where you wish to see the ghost box. Change the values in the program to match your drawing. Oracle Academy 12 Instructor Resource Guide: Section 6

Copyright 2012, Oracle. All rights reserved.

Turn in your drawing and a screen shot of your running program for a grade.

Answers will vary. Students should hand in their maze design above marked with highlighter. Their screen shot should match the design. The Maze should look different than the one given and should include multiple passage ways to make for fun game play.

10. Using the Card constructor from Section 5 Lesson 2, implement a Deck Object as described in the slides. Test that the program works as described. When finished, add the following features: A. Add a method shuffle to the Deck Class. Call the method from the Main class to verify that the deck is indeed shuffled. B. Add a Hand Class that contains an array of 5 Card references. Have the program Deal the Hand two cards and display them for the user. Tell the user how many points they have and ask them if they would like another card or not. Continue to allow the player to add cards until they reach 5 cards or the total is greater than 21. C. Adjust the Card class to allow Aces to count as 11 to start. If the Hand Class has a

Oracle Academy

13

Instructor Resource Guide: Section 6

Copyright 2012, Oracle. All rights reserved.

value greater than 21, have the Hand Class check for Aces and reduce their point value to 1. D. Have the program create a dealer Hand that the user can play against. The user should try to get as close to 21 without going over in an effort to beat the Dealer. If the Dealer has 16 or more the Dealer should stop taking cards. Here is the code to get you started: public class Main { public static void main(String args[]){ Deck d = new Deck(); d.print(); } } public class Deck { Card[] cardArray = new Card[52]; Deck(){ //constructor int suits = 4; int cardType = 13; int cardCount = 0; for(int i = 1; i <= suits; i++) for(int j = 1; j <= cardType; j++){ cardArray[cardCount] = new Card(i,j); cardCount++; } } public void print(){ for(int i = 0; i < cardArray.length; i++) System.out.println(cardArray[i]); } } public class Card{ String suit,name; int points; Card(int n1, int n2){ suit = getSuit(n1); name = getName(n2); points = getPoints(name); } public String toString(){ return "The " + name + " of " + suit; } public String getName(int i){ Oracle Academy 14 Instructor Resource Guide: Section 6

Copyright 2012, Oracle. All rights reserved.

if(i == 1) return "Ace"; if(i == 2) return "Two"; if(i == 3) return "Three"; if(i == 4) return "Four"; if(i == 5) return "Five"; if(i == 6) return "Six"; if(i == 7) return "Seven"; if(i == 8) return "Eight"; if(i == 9) return "Nine"; if(i == 10) return "Ten"; if(i == 11) return "Jack"; if(i == 12) return "Queen"; if(i == 13) return "King"; return "error"; } public int getPoints(String n){ if(n == "Jack" ||n == "Queen" ||n == "King"||n == "Ten") return 10; if(n == "Two") return 2; if(n == "Three") return 3; if(n == "Four") return 4; if(n == "Five") return 5; if(n == "Six") return 6; if(n == "Seven") return 7; if(n == "Eight") return 8; if(n == "Nine") return 9; if(n == "Ace") return 1; return -1; } public String getSuit(int i){ if(i == 1) return "Diamonds"; if(i == 2) return "Clubs"; if(i == 3) return "Spades"; if(i == 4) return "Hearts"; return "error"; } } Oracle Academy 15 Instructor Resource Guide: Section 6

Copyright 2012, Oracle. All rights reserved.

Possible Solution: import java.util.Scanner;

public class Main { public static void main(String args[]){ Scanner reader = new Scanner(System.in); Deck deck = new Deck(); deck.shuffle(); Hand dealer = new Hand(deck.deal(),deck.deal()); Hand player = new Hand(deck.deal(),deck.deal()); int playerPoints=0,dealerPoints=0; System.out.println("Here is your hand."); player.display(); playerPoints=player.getPoints(); System.out.println("You have " + playerPoints + " points."); int choice = 1; while(choice == 1 && playerPoints < 21 && player.numCards < 5){ System.out.println("Would you like another card?"); System.out.println("1. Yes"); System.out.println("2. No"); choice = reader.nextInt(); if(choice == 1){ player.hit(deck.deal()); System.out.println("Here is your hand."); player.display(); playerPoints = player.getPoints(); System.out.println("You have " + playerPoints + " points."); } } dealerPoints = dealer.getPoints(); while(dealerPoints < 16 && dealer.numCards < 5){ dealer.hit(deck.deal()); dealerPoints=dealer.getPoints(); } System.out.println("Dealer has:"); dealer.display(); System.out.println("Dealer has " + dealerPoints + " points."); Oracle Academy 16 Instructor Resource Guide: Section 6

Copyright 2012, Oracle. All rights reserved.

if(playerPoints > 21) System.out.println("Player busted. Dealer wins."); else if(dealerPoints > 21) System.out.println("Dealer busted. Player wins."); else if(dealerPoints>playerPoints) System.out.println("Dealer wins."); else if(dealerPoints<playerPoints) System.out.println("Player wins."); else if(dealerPoints==playerPoints) System.out.println("Dealer & Player tied."); } }

public class Card{ String suit,name; int points; Card(int n1, int n2){ suit = getSuit(n1); name = getName(n2); points = getPoints(name); } public String toString(){ return "The " + name + " of " + suit; } public String getName(int i){ if(i == 1) return "Ace"; if(i == 2) return "Two"; if(i == 3) return "Three"; if(i == 4) return "Four"; if(i == 5) return "Five"; if(i == 6) return "Six"; if(i == 7) return "Seven"; if(i == 8) return "Eight"; if(i == 9) return "Nine"; if(i == 10) return "Ten"; if(i == 11) return "Jack"; if(i == 12) return "Queen"; if(i == 13) return "King"; return "error"; } public int getPoints(String n){ Oracle Academy 17 Instructor Resource Guide: Section 6

Copyright 2012, Oracle. All rights reserved.

if(n == "Jack" || n == "Queen" || n == "King"|| n == "Ten") return 10; if(n == "Two") return 2; if(n == "Three") return 3; if(n == "Four") return 4; if(n == "Five") return 5; if(n == "Six") return 6; if(n == "Seven") return 7; if(n == "Eight") return 8; if(n == "Nine") return 9; if(n == "Ace") return 11; return -1; } public String getSuit(int i){ if(i == 1) return "Diamonds"; if(i == 2) return "Clubs"; if(i == 3) return "Spades"; if(i == 4) return "Hearts"; return "error"; } }

public class Hand { Card[] cardArray = new Card[5]; int numCards = 0; Hand(Card c1,Card c2){ cardArray[0] = c1; cardArray[1] = c2; numCards=2; } public int getPoints(){ int points = 0; for(int i = 0; i < numCards; i++) points += cardArray[i].points; Oracle Academy 18 Instructor Resource Guide: Section 6

Copyright 2012, Oracle. All rights reserved.

if(points > 21)//check for Aces { points = 0; boolean aceFound = false; for(int i = 0; i < numCards; i++){ if(!aceFound){ String a = "Ace"; if(a.equals(cardArray[i].name) && cardArray[i].points == 11){ cardArray[i].points=1; aceFound=true; } } points += cardArray[i].points; } } return points; } public void display(){ for(int i = 0; i < numCards; i++) System.out.println(cardArray[i]); } public void hit(Card c){ if(numCards >= 5){ System.out.println("Maximum number of cards is 5."); return; } cardArray[numCards] = c; numCards++; } }

public class Deck { Card[] cardArray = new Card[52]; int nextToDeal = 0; Deck(){ //constructor int suits = 4; int cardType = 13; int cardCount = 0; for(int i = 1;i <= suits; i++) for(int j = 1; j <= cardType; j++){ cardArray[cardCount] = new Card(i,j); cardCount++; } } Oracle Academy 19 Instructor Resource Guide: Section 6

Copyright 2012, Oracle. All rights reserved.

public void print(){ for(int i = 0; i < cardArray.length; i++) System.out.println(cardArray[i]); } public void shuffle(){ int c1,c2; Card temp; for(int i = 0; i < cardArray.length; i++){ c1 = (int)(Math.random()*cardArray.length); c2 = (int)(Math.random()*cardArray.length); temp = cardArray[c1]; cardArray[c1] = cardArray[c2]; cardArray[c2] = temp; } } public Card deal(){ nextToDeal++; return cardArray[nextToDeal - 1]; } }

Oracle Academy

20

Instructor Resource Guide: Section 6

Copyright 2012, Oracle. All rights reserved.

SECTION 6 LESSON 2 Using String Objects Slide 1: Using String Objects No instructor notes Slide 2: What Will I Learn? No instructor notes Slide 3: What Will I Learn (cont.) No instructor notes Slide 4: Why Learn It? Explain why Strings are important to learn. How it is easier to store data in a String data type that is easy for humans to understand. Slide 5: What is a String? Explain how Strings are not like normal data types. Explain what immutable means and why it is important to instantiating, modifying, and comparing Strings. Slide 6: Instantiate a String Explain the different ways Strings can be instantiated and how each way is different. Slide 7-10 String References Take your time on this concept and make sure the students understand what a reference object is and what it means. This is a concept that is usually very hard for new students to grasp, and it will be even harder for them to understand later on. One explanation is that the String is actually referencing a location in memory where the object is stored. Slide 11: String Concatenation + and += are String manipulators, but as mentioned before Strings can not get manipulated, they created new Strings. So, each time a manipulation operator is used, a new string is created in a new memory location and the reference is moved to the new location. In the reference object slide, it is mentioned that some Strings will point to the same reference object in memory. Making a modification to one string that is pointing to the shared reference will not make a modification to the others because the one that you modify now points to the Oracle Academy 21 Instructor Resource Guide: Section 6

Copyright 2012, Oracle. All rights reserved.

new memory address that holds the new/modified string and the others still point to the original one. Slide 12-13: Escape Sequences No instructor notes Slide 14: String vs. Characters Note that in the example, even when the letter c is a single character, since it is being instantiated as a String, it must be in the same double quotes not the standard single quotes for a character. Slide 15: Comparing Strings Explain what is compared in Strings, how everything counts including case, special characters, etc. You can go in depth and explain the unicode representation for a character. Slide 16: Comparing Strings (Cont.) In the first segment of code, an int less than 0 is returned, and in the second segment of code, false is returned. Slide 17-18: Comparing Strings with == Using == will only return the correct answer when both Strings being compared are pointing to the same reference object. The biggest thing for students to realize is that they should not use == when trying to compare the values of two Strings. Slide 19-21: Useful String Methods No instructor notes for this slide. Slide 22: String Example: Sorting Strings This is an example that takes an array of 5 String objects and sorts them in alphabetical order using the bubblesort technique described in the previous Arrays lecture. Slide 23: String Example: Sorting Strings (cont.) No instructor notes

Oracle Academy

22

Instructor Resource Guide: Section 6

Copyright 2012, Oracle. All rights reserved.

Slide 24: Example Using String Methods No instructor notes Slide 25: Another Example Using String Methods No instructor notes Slide 26-27: Ternary Operator Students may prefer this short hand notation for their individual programming, but when working in groups encourage use of the traditional if/else statements. The traditional statements make code easier to follow through for those reading and modifying the code. Slide 28: Terminology No instructor notes Slide 29: Summary No instructor notes Slide 30: Summary (cont.) No instructor notes Slide# 31: Practice No instructor notes Vocabulary Directions: Identify the vocabulary word for each definition below:

1. Instantiate 2. Ternary Operator 3. String Object 4. Escape Sequences

Assigning a value to the String's reference. The shorthand form of an if/else statement An Object type that stores sentences, words, or multiple characters. Certain parts of a String that, when evaluated, turn into tabs, spaces, newlines, and other special characters.

Oracle Academy

23

Instructor Resource Guide: Section 6

Copyright 2012, Oracle. All rights reserved.

5. Reference Object 6. Concatenating Try It/Solve It 1.

A data type that may point to a spot in memory where a value or values are stored rather than a single, specific value. Adding multiple String objects together

Write three different ways to declare and instantiate a String object called myString and containing abc. Any of the following can be accepted: String myString = abc; String myString = ab + c; String myString = new String(abc); char[ ] aString = { 'a', 'b', 'c'}; String myString = new String(data);

2.

Given the three String objects below, what will each of the following return? String s1 =ABC; String s2 = new String(DEF); String s3 = AB + C; s1.compareTo(s2); False. s2.equals(s3); False. s3 == s1; True. s2.compareTo(s3); False. s3.equals(s1); True. 3. Using a ternary operator, write an if/else statement that will return true or false if the variable x is less than or equal to 7. boolean isLessThanSeven; (x <= 7) ? isLessThanSeven = true: isLessThanSeven = false; 4. Declare and instantiate two separate String objects, and then concatenate them together and assign them to a third arbitrary String object. String s1 = abcd;

Oracle Academy

24

Instructor Resource Guide: Section 6

Copyright 2012, Oracle. All rights reserved.

String s2 = efgh; String s3 = s1 + s2; 5. An anagram is a word or a phrase made by transposing the letters of another word or phrase; for example, "parliament" is an anagram of "partial men," and "software" is an anagram of "swear oft." Write a program that figures out whether one string is an anagram of another string. The program should ignore white space and punctuation.

import java.util.Scanner;

public class Anagrams { public static void main(String[] args) { Scanner reader = new Scanner(System.in); String word; String word2; char c; System.out.println("Enter a word or phrase:"); word = reader.nextLine(); System.out.println("Enter another word or phrase:"); word2 = reader.nextLine(); boolean anagram = true; for(int i = 0; i < word.length(); i++) { c = word.charAt(i); if(word2.indexOf(c) == -1){ anagram = false; break; } } if(anagram) System.out.println("The phrases/words are anagrams."); else System.out.println("The phrases/words are not anagrams."); } }

Oracle Academy

25

Instructor Resource Guide: Section 6

Copyright 2012, Oracle. All rights reserved.

SECTION 6 LESSON 3 Handling Errors Slide 1: Handling Errors What to Watch For This is a lesson to introduce students to errors and exceptions in Java and how some common exceptions can be corrected without throwing them. Students learn how to write code to handle exceptions thrown by the method of a foundation class. Students also learn what to look for when they encounter an unexpected exception. Relate the idea of how humans make mistakes explain how they cannot give up on their programming if they make mistakes in their code. To become a stronger person, people learn how to handle a situation after the mistake has been made. To become stronger programmers, students must learn how to handle their code if a mistake may occur. All in all, it is important to know how to detect and handle exceptions in programming. Connections Ask students to think about a mistake they have made in a previous code they have written. Did it keep them from proceeding with the project? Did it delay their progress? Now explain to them that these delays or road blocks can be prevented by knowing how to handle the mistakes. This is what they are going to learn in this lesson. Optional Project Opportunity: After this lesson concludes, students may present a mistake they have had in a past program and how they would handle it with their new knowledge of exception handling. Slide 2: What Will I Learn? Objectives No instructor notes for this slide Slide 3: Why Learn It? Purpose No instructor notes for this slide Slide 4: Types of Errors There are no instructor notes for this slide. Slide 5: Types of Errors: Syntax Errors Make sure that students understand the difference between an Error and an Exception. An Error is more severe than an Exception and may be not fixable. Slide 6: Types of Errors: Syntax Errors (continued) No instructor notes for this slide.

Oracle Academy

26

Instructor Resource Guide: Section 6

Copyright 2012, Oracle. All rights reserved.

Slide 7: Types of Errors: Syntax Errors (continued) Explain to students that misspelling variables is a common mistake and that they need to remember this exception message to know when they have a variable misspelled in their code. Slide 8: Types of Errors: Logic Errors Explain that forgetting semicolons is a common mistake. Also, explain that an interpreter reads the code like we read a book: from top to bottom and left to right. If the interpreter reads a semicolon directly after a loop initiation it reads this semicolon as the block of code in the loop. Everything that follows the loop will be read as if it were not inside of the loop even if that is different than the intentions of the programmer. Slide 9:Types of Errors: Logic Errors (continued) There are no instructor notes for this slide. Slide 10: Types of Errors: Exceptions There are no instructor notes for this slide. Slide 11: Types of Errors: Exceptions (continued) There are no instructor notes for this slide. Slide 12: Unchecked Exceptions There are no instructor notes for this slide. Slide 13: Index Out Of Bounds Exception There are no instructor notes for this slide. Slide 14: Index Out of Bounds Exception (continued) There are no instructor notes for this slide. Slide 15: Null Pointer Exception There are no instructor notes for this slide.

Oracle Academy

27

Instructor Resource Guide: Section 6

Copyright 2012, Oracle. All rights reserved.

Slide 16: Null Pointer Exception There are no instructor notes for this slide. Slide 17: File Not Found Exception There are no instructor notes for this slide. Slide 18: I/O Exception There are no instructor notes for this slide. Slide 19: File Not Found Exception There are no instructor notes for this slide. Slide 20: Throwing Exceptions There are no instructor notes for this slide. Slide 21: Catching Exceptions There are no instructor notes for this slide. Slide 22: Try Catch Example There are no instructor notes for this slide. Slide 23: Imagine It! Ask students to imagine writing a program that moves a turtle to a part of the ocean that the user specifies. Now ask students how they think their program would run if the user enters coordinates that are not on the map of the ocean where the turtle can move. Ask them to think about applying throwing and catching an exception to handle these cases. For example they could throw an index out of bounds exception and catch it. Inside the catch block of code they could have the turtle move to the edge closest to where the user initiated. Slide 24: Terminology There are no instructor notes for this slide. Slide 25: Summary There are no instructor notes for this slide. Oracle Academy 28 Instructor Resource Guide: Section 6

Copyright 2012, Oracle. All rights reserved.

Slide 26: Practice Vocabulary Directions: Identify the vocabulary word for each definition below.

1. Syntax Error 2. Exceptions 3. Throw 4. Catch 5. Try/Catch Block 6. Logic Error 7. Unchecked Exceptions 8. Error 9. Run-Time Error

An error that indicates an issue with coding format. Errors that occur during run-time and can be corrected or handled by your code. This stops the interpreter from running the rest of the code until it finds a catch. A keyword in Java that signals the following block of code handles a specified exception. A block of code that handles exceptions by dealing with the exception if it is thrown. An error that occurs as a result of incorrect programmer logic. An exception that is optional to be handled. Indicates that there is a problem with interpreting your program. An error that occurs while the program is running, also known as an exception.

10. Checked Exception An exception that MUST be handled. Try It/Solve It 1.Describe the difference between a syntax error, a logic error, and an exception. Syntax Errors exist in the code and result in compile-time errors. Syntax errors occur due to spelling errors, misplaced or missing semicolons, etc. When logic errors exist, the program may compile and run without producing compile-time errors. However, logic errors cause the program to produce inaccurate results or execute in a way that is undesired. Exceptions are thrown during run-time, and will stop the execution of the program unless the program handles the exception with a try/catch block. 2.What is wrong with the following code String str = Hello World; for(int i = 0; i < 4; i++);

Oracle Academy

29

Instructor Resource Guide: Section 6

Copyright 2012, Oracle. All rights reserved.

{ System.out.println(str); str+= ! } There is a semicolon after the FOR statement. As a result, the for loop will only execute once. 3.Describe an exception that you have gotten before. Explain how it could be handled with a try/catch block of code. Answers will vary. 4.Write a segment of code that has: a syntax error if(x = y){ x = 3; } a logic error int x = 3; while(x == 3){ x = 3; } an exception int array[] = new int[3]; int[3] = 2; 5.What is the difference between a checked exception and an unchecked exception? A checked exception must be handled, either by placing the logic that might throw the exception or by adding the keyword throws to the method or class. Unchecked exceptions are not required to be handled, but will stop the execution of the program if an exception occurs.

Oracle Academy

30

Instructor Resource Guide: Section 6

Copyright 2012, Oracle. All rights reserved.

Java Fundamentals - Section 7 Instructor Resource Guide


INSTRUCTOR NOTES FOR SLIDES

SECTION 7 LESSON 1 Passing Objects and Overloading Methods Slide 1: Passing Objects & Overloading Methods No instructor notes for this slide Slide 2: What Will I Learn? Objectives No instructor notes for this slide Slide 3: Why Learn It? Purpose No instructor notes for this slide Slide 4: Access Specifiers Tell the students that the access specifier is a keyword in java that indicates the accessibility of the code, which can be viewed as an identifier of the security level. Explain the four different access specifiers and their definitions. Slide 5: Public Access Specifier Explain what a public access specifier is, and tell them they should use this when it doesn't matter who can get access to your code or when they need to have access from anywhere. Slide 6: Public Access Specifier (continued) No instructor notes for this slide. Slide 7: Protected & Default Access Specifiers No instructor notes for this slide. Slide 8: Private Access Specifier Ask students to give some reasons they may need to declare their code private. If they don't have reasons, you can explain that they will need this private specifier any time they don't want others to be able to access their code. One scenario to share is: Imagine you are working for the government on some top secret coding project. If you do not declare this code as private you may have jeopardized the project entirely.

Slide 9: Public, Private: When to use which Point out that public and private are considered opposite specifiers because public allows access from anywhere and public from practically nowhere (only from inside the same class). Slide 10: Try It Ask students to read the scenarios and determine if the situations describe code that should be declared public or private? Slide 11: Try It (continued) This merely reveals the answers from the previous slide. Students should understand why these are the correct answers. Make clarifications if necessary. Slide 12: Objects as Parameters No instructor notes for this slide. Slide 13: Objects as Parameters (continued) Ask the students to record the sample code that shows how to create a method with objects as parameters in their journals. Slide 14: Objects as Parameters (continued) No instructor notes for this slide. Slide 15: Returning Objects No instructor notes for this slide. Slide 16: Returning Objects (continued) Ask students to record the sample code of how to initialize a method that returns an object. Slide 17: Variable Argument Methods Explain that variable arguments only work if you call the method with the same type of argument as the method requires. For example a method initialized with a variable argument of integers cannot be called with any number of strings, but can only be called with any number of integers for the argument. If another method is declared with a variable argument of strings, they must call that method with string(s) to meet the arguments. Slide 18: Variable Argument Methods (continued) Discuss the similar syntax between an array argument and a variable argument.

Slide 19: Variable Argument Methods (continued) There are no instructor notes for this slide. Slide 20: Variable Argument Methods (continued) No instructor notes for this slide. Slide 21: Variable Argument Methods (continued) No instructor notes for this slide. Slide 22: Variable Argument Methods (continued) No instructor notes for this slide. Slide 23: Overloading Constructors There are no instructor notes for this slide. Slide 24: Overloading Constructors (continued) There are no instructor notes for this slide. Slide 25: Overloading Constructors Sample Code Have the students create a journal entry for overloading constructors and suggest they include the syntax example provided. Slide 26: Overloading Constructors Sample Code (continued) There are no instructor notes for this slide. Slide 27: Try It! There should be no problem with overloading either public or private constructors in a class because everything is contained within the same class. Slide 28: Terminology There are no instructor notes for this slide. Slide 29: Summary There are no instructor notes for this slide. Slide 30: Practice

Vocabulary

1. Constructor 2. Default constructor 3. public 4. private 5. Variable Argument Method 6. Overloading 7. Access specifier

Used to assign initial values to instance variables of a class. A constructor that does not have any parameters. A type of access specifier that permits access from anywhere. A type of access specifier permits access only from inside the same class. A way to call a method with a variable number of arguments.

Having more than one constructor with the same name but different arguments. Specify accessibility for variables, methods, and classes.

Try It/Solve It 1. Create a segment of code that initializes a public class Fish. Let the class contain a string typeOfFish, and an integer friendliness. Do not set values to these variables yet. These are instance variables and will be set inside the class constructors. Answer: public class Fish() { String typeOfFish; int friendliness; } 2. Create a public constructor (a method with the same name as the class) inside the class Fish. This constructor should take in no arguments. Inside the constructor set typeOfFish to Unknown and friendliness to 3, which we are assuming is the generic friendliness of fish. Answer: public class Fish() { String typeOfFish; int friendliness;

public Fish(){ typeOfFish = Unknown; friendliness = 3;} } 3. Create another public constructor inside the class Fish. Have this constructor take in a string t and an integer f. Let typeOfFish equal t, and friendliness equal f. Answer: public class Fish(){ String typeOfFish; int friendliness; public Fish(){ typeOfFish = Unknown; friendliness = 3; } public Fish(String t, int f){ typeOfFish = t; friendliness = f; } } 4. Explain why is is possible to have more than one constructor with the same name and different arguments. Sample Answer: Because java (or java virtual machine) identifies which constructor to use based on name and argument type matches. 5. Create a method inside the class Fish called getFriendliness which takes in no arguments and returns the friendliness level of the fish. Answer: public class Fish(){ String typeOfFish; int friendliness; public Fish(){ typeOfFish = Unknown; friendliness = 3; }

public Fish(String t, int f){ typeOfFish = t; friendliness = f; } int getFriendliness(){ return friendliness; } } 6. Write a segment of code that initializes 2 new fish as defined below: Fish 1: Name Amber, Type AngelFish, Friendliness level 5 (very friendly) Fish 2: Name James, Type Guppy, Friendliness level 3 (neutral) Answer: Fish amber = new Fish(AngelFish, 5); Fish james = new Fish(); 7. Create a method nicestFish that takes in two fish as parameters, compares the friendliness level of two fish, and returns the fish with the higher friendliness. Test this method with the fish defined in problem 6. (Friendliness scale: 1 mean, 2 not friendly, 3 neutral, 4 friendly, 5 very friendly) Hint: fishName.getFriendliness() gives you the integer number of the friendliness of fishName. You have already created getFriendliness in problem 5. Sample Answer: Fish nicestFish(Fish a, Fish b){ if(a.getFriendliness()> b.getFriendliness()) return a; else return b; } 8. Modify the method nicestFish to take be a variable argument method that takes in a variable number of fish and returns the nicest fish out of the fish it is given. Hint: Inside of the method, create a new fish called temp. Set temp equal to the first fish passed into the method. Use a for loop to go through all the fish passed into the method and if you discover a fish that is more friendly than temp, set temp equal to that fish. After the for loop is complete, temp should be the friendliest fish. Return temp. Sample Answer:

Fish nicestFish(Fish ... a){ Fish temp = a[0]; for(int I = 1; I < a.length; i++) if(temp.getFriendliness() < a[i].getFriendliness()) temp = a[i]; return temp; } 9. Test your method nicestFish with the fish described in problem 6. Which fish is returned? Answer: amber

SECTION 7 LESSON 2 Understanding Recursion, the Static Modifier, and Nested Classes

Slide 1: Understanding Recursion, the Static Modifier, and Nested Classes What to Watch For This is a lesson to introduce students to the concepts of linear and non-linear recursion and how to use the static modifier in Java. Static variables, methods, and classes enable Java to provide facilities like standard libraries in other programming languages where objects aren't necessary. Relate the idea of how some problems require procedural or algorithms to solve problems. Provide examples, like parsing a string, concatenating a string, and calculating the present value of future annuity payments. Connections Ask students to find a list of math problems or string handling problems that can be solved without the use of objects. Let them propose solutions and define the modularity of the solutions. Ask them to take one problem and resolve it with a class that only contains a static method that solves the problem and a test case in the static main method of the class. Slide 2: What Will I Learn? Objectives No instructor notes for this slide Slide 3: Why Learn It? Purpose Some problems don't require objects to solve them. These types of problems are best implemented as stand alone method, like calculating the future or present value of an annuity of payments or the interest cost of borrowing money to buy a car. Introducing linear and non-linear recursion requires a brief mention that linear recursion is substantially less memory intensive than non-linear recursion. Suggest care when choosing recursive solutions because of the JVM memory limitation. Slide 4: Static Modifier Mention the access privileges (private, public, protected, and default) provided when constructing instances and calling methods. Explain that a static modifier can be added to any method regardless of the access levels. Slide 5: Static Modifier (cont.) No instructor notes for this slide

Slide 6: Static Variables Good programming practice initializes static variables with values, rather than relying on the default null and 0 values. The values initially assigned can be changed as long as the class is active in the JVMs memory. Garbage collection removes it from memory and the initial values assigned will return the next time you use it. Slide 7: Static Variables(continued) There are no instructor notes for this slide. Slide 8: Static Variables(continued) Review the use of the this keyword. Emphasize that it refers to the instance and class variables, methods, and nested classes. Slide 9: Static Variables - Example There are no instructor notes for this slide. Slide 10: Accessing Static Variables There are no instructor notes for this slide. Slide 11: Static Modifier and Methods Review the differences between calling an instance method versus a class method. Such as, you must first create an instance and then use a dot notation to call an instance variable; whereas, the class name, a dot notation, and static method name calls a static method. Emphasize that the static method provides a wrapper to construct an instance of a class. When the class has a private access constructor, a static method is one of two approaches to creating an instance of the class. This method is demonstrated in the Java API Toolkit class with the getDefaultToolkit. This mechanism is generally hidden because synchronization between the Operating System and JVM are provided by Swing classes, and the Toolkit class is part of the underlying AWT framework. Slide 12-14: Static Methods Example There are no instructor notes for this slide. Slide 15: Static Methods (continued) There are no instructor notes for this slide.

Slide 16: Static Modifier and Classes There are no instructor notes for this slide. Slide 17: Static Nested Classes Explain to the students that the super() method call lets you call the parent class in a class hierarchy. In this case, the static nested class extends the behavior of the containing class. The static nested class also provides the means for instantiating a containing class when it's constructor is configured as private access. This is the second way to instantiate a class that has a restricted or private access qualifier for its class constructors. Slide 18: Understanding Recursion Qualify that the base case means the program doesn't need to recursively call itself any more. It returns the default value at the bottom most activity. The recursive case occurs when the program can't resolve the problem without a recursive call to itself. Convergence means that you recursively call the method until you reach the base case, and then you return values up the chain to the original program unit. Linear recursion is useful and frequently used. Non-linear recursion is less frequently used because of its impact on system, specifically JVM, memory. Slide 19: Understanding Recursion (cont.) Pause and explain the math of incrementing a sequence and decrementing a sequence. This requires explaining the subscripts and how the math works. How t is any number and the subscript 1 is the first copy of that number. Then, how t(n+1) becomes the first number plus the incrementing value (incrementing by 5 in this case), and so forth. Great detail isn't required because the next slide illustrates both processes in small sample code blocks. Slide 20: Forward and Recursive Sequences The variable r in the forward thinking program is the result variable. It's defined initially and incremented with each iteration through the loop. This type of variable is essential when we navigate forward without recursion. There is no variable r in the recursive example because it's not required. The return result from each recursive method call passes back the solution, the version of the method that called it increments and returns the result to the prior level. This continues until you reach the top most method call. In a sense, the return value of the method call in conjunction with the recursive calling statement manages r (the result) value without explicit declaration or management.

Slide 21-23: Tracing Through Linear Recursion Tracing through sample recursive programs will help them understand the thinking backwards concept. Slide 24: Linear Recursion Factorial Problem Review the concept of factorials, by illustrating the sequence: Assuming the subscript (zero-based numbering) is the number of calls to the recursive function, where zero is the first call. Then, you may write the following sequence on the board or demonstrate a copy of the function: Calls to the method: do = 5, d1 = 4, d2 = 3, d3 = 2, d4 = 1 It returns: 5 * (4 * (3 * (2 * (1)))) or 120. Slide 25: Try It! The factorial of 7 is 5040. Slide 26: Non-linear Recursion Fibonacci Problem Review the concept of Fibonacci numbers, by illustrating the sequence. The Fibonacci numbers are: 0 1 1 2 3 5 8 13 21 34 55 89 ... The formula shown on the slide solves all Fibonacci numbers because the base case works for the first two, and the first call to the covergence case returns 1 for 3rd index value, which is the second 1in the sequence. The formula can be re-written as the following example to highlight only the first two index values (0 and 1) resolve in the base case, and the repeating number 1 is returned by the first case for the convergence case. public static double fibonacci(double d) { // The 0 and 1 substitute for n. if (d < 2 ) { if (d < 1) { return 0; } else { return 1; } } else { return fibonacci(d - 1) + fibonacci(d - 2); } } You can prove this by changing the less than operator to a less than or equal to operator or

change the base case comparison to (d < 3) in the base case. Slide 27-32: Tracing Through Non-Linear Recursion There are no instructor notes for these slides. Slide 33: Terminology There are no instructor notes for this slide. Slide 34: Summary There are no instructor notes for this slide. Slide 35: Practice There are no instructor notes for this slide.
Vocabulary Directions: Identify the vocabulary word for each definition below:

1. Convergence

Is the process of recursively calling a copy of the same method until a base case is reached. In some cases, like the Fibonacci problem, two values may trigger alternate base cases return values in non-linear recursion. In non-linear recursion, the base case may need to accommodate multiple return values. Any Java class-level variable that is declared with the static modifier. This means only one instance of the class variable can exist in the JVM regardless of the number of class instances. Any Java method defined with a static modifier. It is accessible outside the class when a public, protected, or default access specifier precedes it. It is private and inaccessible outside of the class when a private specifier precedes it. Class methods are available without first creating an instance of the class. The last case processed by a recursive program, which may also be processed for the last couple values. This is true when resolving a Fibonacci sequence for the first two values of the sequence. They are the last values calculated when recursively resolving the problem.

2. Class/Static Variable

3. Class/Static method

4. Base Case

5. Static/Class Variable

Is a variable that may be available outside of a class without first creating an instance of a class. It is declared by preceding the variable name with the static modifier. Is a keyword that makes a variable, method, or inner class available without first creating an instance of a variable. Is the process of calling one and only one copy of the same method within a method. Is an inner class. Inner classes are defined within a parent or container class and are members of the container class by composition. In fact, inner classes are the only way you can create class instances through composition. Is the alternative to the base case, and run when the base case criteria isn't met. It runs when the program needs to call yet another copy or set of copies of itself to resolve a problem. Is the process of backing into a problem by recursively calling a copy of the method until you arrive at a base case, and then returning the values up the chain to resolve a problem. Is the process of calling two or more copies of the same method within a method. As a rule, the calls are separated by an operator in an algorithm. Is a method that is available for use without first creating an instance of the class. It is declared by preceding its definition with the static modifier. Is an inner class that is available for use without first creating an instance of the container class. It is declared by preceding its definition with the static modifier. Is any class implemented as a nested class within another class. By definition, all inner classes are members of the container class by composition.

6. Static Modifier 7. Linear recursion 8. Nested class

9. Recursive Case

10. Recursion

11. Non-linear recursion

12.Static/Class method

13.Static nested class

14. Inner Class

Try It/Solve It 1. Create a class to test, use, and compare static and instance variables. Name the class Library. Implement the following: A public static String variable named staticName A pubic static int variable named myInt A private String variable named instanceName and implemented as an instance variable.

A default constructor that takes no formal parameters and assigns Constructed to both the static and instance String variables. An overloaded constructor that takes a single String variable named s, and assigned Constructed to the static variable and the value of s to the instance variable. Implement two static mehtods, one getStaticName() that acts like a getter and setStaticName(String s) that acts like a setter. Implement two instance mehtods, one getInstanceName() that acts like a getter and setInstanceName(String s) that acts like a setter.

Create a static main method that tests the following: 1. Print the value of the static variable before constructing an instance. 2. Print the value of the static variable without referring to the instance method, and instance variables by using the instance and instance variable name. 3. Set the static variable without calling the setting method, and print both static and instance variable values by calling the respective getter methods. 4. Set the static variable by calling the static setter method, and print both static and instance variable values without calling their respective getter methods. While formatting may differ, this is the expected output: Static and Instance Names [Compiled] Static and Instance Names [Constructed] [Constructed] Static and Instance Names [Set w/access][Constructed] Static and Instance Names [Set w/method][Constructed] The solution is: /** * Write a description of class Library here. * * @author Oracle Academy * @version 1.0 */ public class Library { // Declare public static or class variable. public static String staticName = "Compiled"; // Declare private instance variable.

private String instanceName; /** * Default constructor. */ public Library() { // Set the class instance name. this.staticName = "Constructed"; this.instanceName = "Constructed"; } /* * Static methods to get and set a static variable. */ public static String getStaticName() { return Library.staticName; } public static void setStaticName(String s) { Library.staticName = s; } /* * Instance method to get and set class and instance variables. */ public void setInstanceName(String s) { this.instanceName = s; } public String getInstanceName() { return this.instanceName; } /* * Test case. */ public static void main(String[] args) { // Construct and instance and apply sort method. System.out.println("Static and Instance Names [" + Library.staticName + "]"); // Construct and instance and apply sort method. Library lib = new Library(); // Construct and instance and apply sort method.

System.out.println("Static and Instance Names [" + Library.staticName + "] [" + lib.instanceName + "]"); // Reset a public accessible class variable. Library.staticName = "Set w/access"; System.out.println("Static and Instance Names [" + lib.getStaticName() + "][" + lib.getInstanceName() + "]"); // Reset a public accessible class variable. Library.setStaticName("Set w/method"); System.out.println("Static and Instance Names [" + Library.staticName + "][" + lib.instanceName + "]"); } } 2. Create the class implementation for a Planet class and a SolarSystem class. Write the Planet class nested in the SolarSystem class. The SolarSystem class includes: public instance variables String name and String location a default constructor that assigns name such that name = Milky Way and location such that location = unknown write another constructor that takes in the strings for name and location and assigns the instance variables to the parameter values a nested class called Planet

The Planet class includes: public instance variables String name and int size a constructor that takes in a string and an int as parameters and assigns these values to the instance variables accessor, or get, methods that return the name and size of the planet

public class SolarSystem{ public String name; public String location; public SolarSystem(){ name= Milky Way; location = Unknown; } public class Planet{

public String name; public int size; public Planet(String n, int s){ name=n; size=s; } public String getName() { return name; } public int getSize() { return size; } } 3. Create a class to define and test linear recursion. Name the class Linear. Implement the following:

A public class named Linear A pubic static method named factorial that takes a double and returns a double. The base case should check whether the input value is less than or equal to 1. The recursive case should return the input value multiplied against the result of a recursive call to the factorial method with the input value minus 1.

Create a static main method that tests the following: 1. A double variable named d. 2. Check if the argument list contains any values, and assign the value of argument zero to the local double variable. If the argument list is empty assign a value of 5. 3. Print the factorial value and the original input value. While formatting may differ, this is the expected output: Factorial [120.0] of [5.0] /** * Write a description of class Factorial here. *

* @author Oracle Academy * @version 1.0 */ public class Linear { /* * Factorial linear recursion. */ public static double factorial(double d) { // Check base case. if (d <= 1) { return 1; } else { return d * factorial(d - 1); } }

/* * Static main method tests the class instance methods. */ public static void main(String[] args) { // Declar local variable. double d; // Check first input argument and assign it. if (args.length > 0) { d = new Integer(args[0]).doubleValue(); } else { d = 5; } // Print the result from the factorial method. System.out.println("Factorial [" + Linear.factorial(d) + "] of [" + d + "]");

} }

4. Create a class to define and test linear recursion. Name the class Linear. Implement the following:

A public class named NonLinear A pubic static method named fibonacci that takes a double and returns a double. The base case should check whether the input value is less than 2. The recursive case should return the following: return fibonacci(d - 1) + fibonacci(d - 2);

Create a static main method that tests the following: 1. A double variable named d. 2. Check if the argument list contains any values, and assign the value of argument zero to the local double variable. If the argument list is empty assign a value of 5. 3. Print the factorial value and the original input value. While formatting may differ, this is the expected output: Fibonacci index [0.0] value [0.0] Fibonacci index [1.0] value [1.0] Fibonacci index [2.0] value [1.0] Fibonacci index [3.0] value [2.0] Fibonacci index [4.0] value [3.0] /** * Write a description of class NonLinear here. * * @author Oracle Academy * @version 1.0 */ public class NonLinear { // Static fibonacci method. public static double fibonacci(double d) {

if (d < 2) { return d; } else { return fibonacci(d - 1) + fibonacci(d - 2); } } /* * Static main method tests the fibonacci method. */ public static void main(String[] args) { // Declar local variable. double d; // Check first input argument and assign it. if (args.length > 0) { d = new Integer(args[0]).doubleValue(); } else { d = 5; } // Print the results from a series of numbers. for (double i = 0; i < d; i++) { System.out.println("Fibonacci index [" + i + "] value [" + NonLinear.fibonacci(i) + "]"); } } }

SECTION 7 LESSON 3 Understanding Inheritance Slide 1: Understanding Inheritance What to watch for Inheritance is a very important concept, but may seem abstract to students. The idea of code reuse and encapsulation are central to inheritance; starting with real-world analogies that rationalize code reuse (such as borrowing items from a friend) or encapsulation (keeping personal items or information safe) can help students transfer the concepts into programming. For more information about inheritance, visit: http://docs.oracle.com/javase/tutorial/java/IandI/subclasses.html Connections Greenfoot makes use of inheritance in creating subclasses of classes like Actor and Animal. Although the concept of inheritance may have not been made explicit, students should be familiar with the general idea of one class being a type of (or extension of) another. Using examples from Greenfoot could help students understand the abstract details of inheritance, such as where the code and data exist and how subclasses can access them. Slide 2: What Will I Learn? No instructor notes for this slide. Slide 3: What Will I Learn? (continued) No instructor notes for this slide. Slide 4: Why Learn It? No instructor notes for this slide. Slide 5: Why Learn It? (continued) No instructor notes for this slide. Slide 6: What is Inheritance? No instructor notes for this slide. Slide 7: How does Inheritance Work In Java? No instructor notes for this slide. Slide 8: Superclass vs. Subclass

No instructor notes for this slide. Slide 9: Superclass vs. Subclass (continued) No instructor notes for this slide. Slide10: Inheritance Example It's important to note that the methods inherited by the subclass will not appear in the code. They are written in the subclass for instructive purposes. Methods and data exist within the superclass and can be accessed via the superclass. You can stress this point using the next slides. The code for the class Crab in Greenfoot does not actually contain the methods for move() but it can use it since it inherits the code from Animal. Slide11: Superclass vs. Subclass Example It may be helpful to open Greenfoot and show this example. Slide12: Superclass vs. Subclass Example (continued) No instructor notes for this slide. Slide13: Superclass vs. Subclass Example (continued) No instructor notes for this slide. Slide14: Inheriting Methods No instructor notes for this slide. Slide15: Extends No instructor notes for this slide. Slide16: The Rule of Single Inheritance No instructor notes for this slide. Slide17: The Rule of Single Inheritance (continued) No instructor notes for this slide. Slide 18: More About Inheritance No instructor notes for this slide.

Slide 19: Object: The Highest Superclass Object is an important class to be familiar with, especially for the following lessons on polymorphism. It could be helpful to tell students that Object contains methods that can be used on every class (such as toString(), or equals()). Pose a situation where you have just created a class and constructed an instance of it. Ask the students if you can call the method toString() on your object. Such as: A_Class class = new A_Class(); class.toString(); Even though you did not write the method toString(), it is still legal for you to call this method because it was inherited by Object. You can also elaborate on this example and ask them if class.toString() is legal if A_Class explicitly extends Another_Class, a superclass. This is also legal since the superclass of A_Class extends Object. Slide 20: Why User Inheritance? No instructor notes for this slide. Slide 21: Inheritance Hierarchies Ask the students if they can think of situations where they may want to construct a hierarchy, either in code or in real life. Some possible answers include: Classifying things, such as types of vehicles or buildings. Classifying different types of roles in a company. Creating different types of Animals in Greenfoot.

Slide22: Inheritance Hierarchies (continued) No instructor notes for this slide. Slide23: Inheritance Hierarchies (continued) No instructor notes for this slide. Slide24: Inheritance Hierarchies (continued) No instructor notes for this slide. Slide25: Inheritance Hierarchies: Is A Help students understand the Is A relationship by asking for examples of Is A relationships in everyday life. Such as, a house Is A type of building, a dog Is A type of animal, a hammer Is A type of tool, etc.

Slide 26: Unified Modeling Language: UML No instructor notes for this slide. Slide 27: Basic Components of UML No instructor notes for this slide. Slide 28: Class Diagram in UML Not every piece of data needs to be included in the detailed class diagram. Access modifiers like public and private can be left out since by convention, private data is not typically listed. Tell students to use their discretion about what to use. UML is a helpful tool for students to plan out how they'll organize multilevel class hierarchies. Encourage students to use UML for coding projects. For a more detailed look at UML, visit: http://www.oracle.com/technetwork/developer-tools/jdev/gettingstartedwithumlclassmodeling130316.pdf Slide 29: Showing Inheritance in UML Depending on which lessons you have covered, it may be helpful to teach students different symbols for UML relationships. Slide 30: Try It You can assign either the first or second activity (Slide 30) or both depending on the time you have available. Object To correctly draw the UML diagram, students should have solid arrows and solid lines. Since Object is the highest superclass, it should be at the top of the hierarchy. You can think of Object as being the most general Shape class, since every class inherits methods from Object. Although it does not directly extend Object, Shape extends Object automatically, since no superclass is declared for Shape. All of the classes below Shape have access to the methods from Object as a Rectangle Triangle result. Shape should be the second level in the hierarchy, with Triangle, Rectangle, and Circle directly below it. Triangle, Rectangle, and Circle all directly inherit from Shape or can be considered a type of Shape. Square

Circle

Square is also a type of Shape, but since it share properties with Rectangle, it occupies the same branch. Square has more specific properties than Rectangle, but it is by definition a

type of Rectangle. As a result, it occupies the branch below Rectangle.

Slide 31: Try It (continued)

Object

To correctly draw the UML diagram, students should have solid arrows and solid lines. Since Object is the highest superclass, it Animal should be at the top of the hierarchy. You can think of Object as being the most general class, since every class inherits methods from Object. The Animal class automatically extends Object, since no other superclass is explicitly declared. Crustacean Crustacean and Mammal are more general terms applied to types of species, while Crab, Dog, and Hermit Crab are all more specific. Crab Crustacean and Mammal should be on the first level below Animal, with Crab directly below Crustacean and Dog right below Mammal. Since Hermit Crab is a more specific type of Crab, it Hermit Crab is correct to place it below the Crab class. Slide 32: Encapsulation No instructor notes for this slide. Slide 33: Encapsulation (continued) No instructor notes for this slide. Slide 34: Access Modifiers No instructor notes for this slide. Slide 35: How to Use Access Modifiers No instructor notes for this slide. Slide 36: Using Access Modifiers No instructor notes for this slide. Slide 37: Using Access Modifiers (continued) No instructor notes for this slide. Slide 38: Member Access and Accessing the Superclass No instructor notes for this slide.

Mammal

Dog

Slide 39: Member Access and Accessing the Superclass (continued) No instructor notes for this slide. Slide 40: Member Access and Inheritance No instructor notes for this slide. Slide 41: Inheriting Constructors No instructor notes for this slide. Slide 42: Using the Super Keyword No instructor notes for this slide. Slide 43: Using the Super Keyword Example No instructor notes for this slide. Slide 44: Using the Super Keyword (continued) No instructor notes for this slide. Slide 45: Using the Super Keyword (continued) No instructor notes for this slide. Slide 46: Constructing a Subclass No instructor notes for this slide. Slide 47-54: Constructing a Subclass (continued) No instructor notes for this slide.

Slide 55: Inheritance and Applets Visiting the Java Documentation for the Applet class could be beneficial for this part of the the lesson. For all documentation, visit:

http://docs.oracle.com/javase/6/docs/api/ For just the class Applet's documentation, visit: http://docs.oracle.com/javase/6/docs/api/java/applet/Applet.html Slide 56: Inheritance and Applets (continued) No instructor notes for this slide. Slide 57: Inheritance and Applets (continued) No instructor notes for this slide. Slide 58: Terminology No instructor notes for this slide. Slide 59: Summary No instructor notes for this slide. Slide 60: Summary (continued) No instructor notes for this slide. Slide 61: Practice No instructor notes for this slide. Vocabulary 1. 2. Super Inheritance A keyword that allows subclasses to access methods, data, and constructors from their parent class. The concept in object-oriented programming that allows classes to gain methods and data by extending another classes fields and methods. Classes that are subsets of other classes and that inherit methods and fields from more general classes.

3. 4. 5.

Child Class / Subclass

Unified Modeling A standardized language for modeling systems and structures in Language (UML) programming. Encapsulation A programming philosophy that promotes protecting data and hiding implementation in order to preserve the integrity of data and methods. A structure that categorizes and organizes relationships among ideas, concepts of things with the most general or all-

6.

Hierarchy

encompassing component at the top and the more specific, or component with the narrowest scope, at the bottom. 7. 8. 9. Is A Relationship Parent Class / Superclass Extends A helpful term used to conceptualize the relationships among nodes or leaves in an inheritance hierarchy. Classes that pass down their methods to more specialized classes . A keyword in Java that allows you to explicitly declare the superclass of the current class.

Try it/Solve it 1. Modify the existing applet to change all the colors to black, white, and gray using the code below:
import java.awt.*; import java.applet.*; public class DrawShapes extends Applet { Font font; Color redColor; Color blueColor; Color backgroundColor; public void init() { //The Font is Arial size, 18 and is italicized font = new Font("Arial",Font.ITALIC,18); //Some colors are predefined in the Color class redColor = Color.red; backgroundColor = Color.orange; //Colors can be created using Red, Green, Blue values blueColor = new Color(0,0,122); //Set the background Color of the applet setBackground(backgroundColor); } public void stop() { } /** * This method paints the shapes to the screen */ public void paint(Graphics graph) { //Set font graph.setFont(font); //Create a title graph.drawString("Draw Shapes",90,20); //Set the color for the first shape graph.setColor(blueColor); // Draw a rectangle using drawRect(int x, int y, int width, int height) graph.drawRect(120,120,120,120);

// This will fill a rectangle graph.fillRect(115,115,90,90); //Set the color for the next shape graph.setColor(redColor); //Draw a circle using drawArc(int x, int y, int width, int height, int startAngle, int arcAngle) graph.fillArc(110,110,50,50,0,360); //Set color for next shape graph.setColor(Color.CYAN); //Draw another rectangle graph.drawRect(50,50,50,50); // This will fill a rectangle graph.fillRect(50,50,60,60); } }

Multiple Answers are acceptable for this task. Here is one possible answer:
import java.awt.*; import java.applet.*; public class DrawShapes extends Applet { Font font; Color redColor; Color blueColor; Color backgroundColor; public void init() { //The Font is Arial size, 18 and is italicized font = new Font("Arial",Font.ITALIC,18); //Some colors are predefined in the Color class redColor = Color.white; backgroundColor = Color.darkGray; //Colors can be created using Red, Green, Blue values blueColor = new Color(0,0,0); //Set the background Color of the applet setBackground(backgroundColor); } public void stop() { } /** * This method paints the shapes to the screen */ public void paint(Graphics graph){ //Set font graph.setFont(font); //Create a title graph.drawString("Draw Shapes",90,20); //Set the color for the first shape graph.setColor(blueColor);

// Draw a rectangle using drawRect(int x, int y, int width, int height) graph.drawRect(120,120,120,120); // This will fill a rectangle graph.fillRect(115,115,90,90); //Set the color for the next shape graph.setColor(redColor); //Draw a circle using drawArc(int x, int y, int width, int height, int startAngle, int arcAngle) graph.fillArc(110,110,50,50,0,360); //Set color for next shape graph.setColor(Color.CYAN); //Draw another rectangle graph.drawRect(50,50,50,50); // This will fill a rectangle graph.fillRect(50,50,60,60); } }

2. Draw simple UML Diagrams with the following classes: Tree, Hardwood, Softwood, Birch, Ash, Cedar, Pine, Red Pine, where Hardwood and Softwood are types of trees, Birch and Ash are types of Hardwoods and Cedar and Pine are types of Softwoods. Red Pine is a type of Pine.

Tree

Hardwood

Softwood

Birch

Ash

Cedar

Pine

Red Pine

A , B, C, D, E, F, where B and C are a type of A, D is a type of B, E is a type of C, and F is a type of E.

3. Create a class hierarchy representing Students in a university. You know that Students are a type of Person, but Students have more specific characteristics like having a grade point average (GPA), student identification number (ID) and a discipline of study, or major (Mathematics, Computer Science, Literature, Psychology, etc.). Create a subclass of Person called Student using the code for Person below and the specifications listed below: Students have personal data that helps identify them to university administrators. Create variables for a Student ID number, a GPA, which gives the average grade points for the student, a major, degree that he or she is earning (Bachelor's, Masters, Ph.D), and his or her expected graduation year. Carefully consider whether these should be public or private data. For methods you declare private, you may want to provide access methods for other classes to retrieve this data. Create a detailed UML diagram listing all of the data and methods of each class (for both Person and Student). Create a method that allows administrators to change a student's major Create a method that calculates a student's GPA by taking in an array of his or her grades. Take the average of all of the student's grades using the following breakdown. Grade A AGrade Point Equivalent 4 3.67

B+ B BC+ C D F Code for Person class:


import java.util.Date; public class Person { private String firstName; private String middleName; private String lastName; private Date dateOfBirth;

3.33 3 2.67 2.33 2 1 0

public Person(String firstName, String middleName, String lastName, Date dateOfBirth){ this.firstName = firstName; this.middleName = middleName; this.lastName = lastName; this.dateOfBirth = dateOfBirth; } /** * Returns a String of the firstName * @return firstName */ public String getFirstName(){ return firstName; } /** * Returns a string of the middleName * @return middleName */ public String getMiddleName(){ return middleName; } /** * Returns a String of the lastName * @return lastName */ public String getLastName(){ return lastName; } /** * Returns a concatenated string of the Person's name * @return the Person's first, middle, and last name. */ public String getName(){ return firstName + " " + middleName + " " + lastName; } /**

* Returns the Person's date of birth as a date type * @return a Date type of the Person's date of birth. */ public Date getDateOfBirth(){ return dateOfBirth; } }

This code creates a Student class which extends Person.


import java.util.Date; public class Student extends Person{ private int studentID; private double GPA; private String major; private String degreeType; private int yearOfGrad; public Student (String firstName, String middleName, String lastName, Date dateOfBirth, int studentID, double GPA, String major, String degreeType, int yearOfGrad){ super(firstName, middleName, lastName, dateOfBirth); this.studentID = studentID; this.GPA = GPA; this.major = major; this.degreeType = degreeType; this.yearOfGrad = yearOfGrad; } public int getStudentID(){ return studentID; } public double getGPA(){ return GPA; } public String getMajor(){ return major; } public String getDegreeType(){ return degreeType; } public int getYearOfGrad(){ return yearOfGrad; } public void changeMajor(String newMajor){ major = newMajor; } public void calculateGPA(String[] grades){ double totalGradePoints = 0; int numGrades = 0; /*grades.length gives the size of the array, * not the number of elements in it*/ for(int i = 0; i < grades.length; i++){ //if there is an element at this index if(grades[i] != null){ //increment the counter

numGrades++; if(grades[i].equals("A")){ totalGradePoints += 4.00; } else if(grades[i].equals("A-")){ totalGradePoints += 3.67;} else if(grades[i].equals("B+")){ totalGradePoints += 3.33; } else if(grades[i].equals("B")){ totalGradePoints += 3.00; } else if(grades[i].equals("B-")){ totalGradePoints += 2.67; } else if(grades[i].equals("C+")){ totalGradePoints += 2.33; } else if(grades[i].equals("C")){ totalGradePoints += 2.00; } else if(grades[i].equals("D")){ totalGradePoints += 1.00; } //no case is needed for F since, no points are added } } GPA = totalGradePoints/numGrades; } }
Person String firstName; String middleName; String lastName; Date dateOfBirth; public String getFirstName() public String getMiddleName() public String getLastName() public String getName() public Date getDateOfBirth()

Student int studentID; double dou String Strin String degreeType; int yearOfGrad; int getStudentID() double getGPA() String getMajor() String getDegreeType() int getYearOfGrad() void changeMajor(String newMajor) void calculateGPA(String[] grades)

4. True/False A subclass is able to access this code in the superclass: Why? a. public String aString;
True. Public variables (which are not in functions) can be accessed by subclasses. the class itself and all of it subclasses.

b. protected boolean aBoolean; True. Protected limits the viability of variables to c. int anInt;
True. If no access modifier is declared, the default settings are used. Default typically allows access to all classes within the same package as the class. False. Private variables are not inherited by subclasses and cannot be accessed using the super keyword. True. Public methods are accessible by all classes, including subclasses. False. Private nested classes exist only within the scope of the class in which they are defined and are not accessible to subclasses or any other classes. True. Public constructors can be accessed by subclasses using the super keyword.

d. private double aDouble;

e. public String aMethod() f. private class aNestedClass

g. public aClassConstructor()

5. Imagine you own a music shop that sells musical instruments. Create classes representing an inheritance hierarchy of musical instruments using the following UML diagram:
InstrumentI boolean onSale; double price; int numInStock; doubl e get Pr i c e( ) doubl e appl y Em pl oy eeDi sc ount ( ) voi d set OnSal e( bool ean onSal e ) bool ean get OnSal e( ) voi d set Pr i c e( doubl e pr i c e ) i nt get Num I nSt ock ( ) voi d set Num I nSt oc k ( i nt num I nSt ock )

Employee discount is 25% off the instrument (Hint: 75% of the initial cost). If an item is onSale, then the price returned for getPrice() should be 15% off.

StringInstrumentS i nt num St r i ngs; int getNumStrings() void setStrings( int numStrings )

Guitar boolean isElectric; bool ean get I s El ec t r i c( )

public class Instrument { private boolean onSale; private double price; private int numInStock; public Instrument(boolean onSale, double price, int numInStock){ this.onSale = onSale; this.price = price; this.numInStock = numInStock; } public double getPrice(){ if(onSale) { return price * 0.85; } return price; } public double applyEmployeeDiscount(){ return price * 0.75; } public void setOnSale(boolean onSale){ this.onSale = onSale; } public boolean getOnSale(){ return onSale; } public void setPrice(double price){ this.price = price; } public int getNumInStock(){ return numInStock; } public void setNumInStock(int numInStock){ this.numInStock = numInStock; } } public class StringInstrument extends Instrument { private int numStrings; public StringInstrument(int numStrings, boolean onSale, double price, int numInStock){ super(onSale, price, numInStock); this.numStrings = numStrings; } public int getNumStrings(){ return numStrings; } public void setStrings(int numStrings){ this.numStrings = numStrings; } } public class Guitar extends StringInstrument{ private boolean isElectric;

public Guitar(boolean isElectric, double price, boolean onSale, int numStrings, int numInStock){ super(numStrings, onSale, price, numInStock); this.isElectric = isElectric; } public boolean getIsElectric(){ return isElectric; } }

6. Using the code and UML diagram below, fill in the blanks with the correct keywords or class names. If a keyword is missing from the code, fill in the keyword that fits. If the class or data is missing from the UML, fill in the correct information.
public class Vehicle { private int wheels; public Vehicle(int wheels){ this.wheels = wheels; } public int getWheels(){ return wheels; } } public class Car extends Vehicle{ private int numDoors; private boolean isElectric; public Car (int numWheels, int numDoors, boolean isElectric){ super(numWheels); this.numDoors = numDoors; this.isElectric = isElectric; } public int getNumDoors() return numDoors; } {

public boolean getIsElectric() return isElectric; } }

public class Bicycle extends Vehicle{ //Mountain bike, road bike, recumbent bike.. etc private String bikeType; public Bicycle(int numWheels, String bikeType) { super(numWheels); this.bikeType = bikeType; } public String getBikeType() return bikeType; } } {

public class Convertible extends Car{ //Soft top or rag top, or hard top private String roofType; public Convertible(int numWheels, int numDoors, boolean isElectric, String roofType) { super(numWheels, numDoors, isElectric); this.roofType = roofType; } public String getRoofType() return roofType; } } {

Vehicle int numWheels; int getWheels()

Car int numDoors; boolean isElectric; int getNumDoors() boolean getIsElectric()

Bicycle Str ing bikeType; Str ing getBikeType()

Convertible Str ing roofType; Str ing getRoofType()

SECTION 7 LESSON 4 Understanding Polymorphism Slide 1: Understanding Polymorphism What to watch for Understanding polymorphism requires a firm understanding of inheritance. Be sure to bridge the students' knowledge about inheritance to the new concepts of polymorphism. Additionally, emphasize the differences among related terms, such as Abstract classes vs. interfaces, overloading vs overriding methods, etc. For an additional overview of polymorphism and inheritance, visit the Oracle tutorial pages: Inheritance: http://docs.oracle.com/javase/tutorial/java/IandI/subclasses.html Polymorphism: http://docs.oracle.com/javase/tutorial/java/IandI/polymorphism.html Connections Build on the students' knowledge of inheritance to set the stage for polymorphism. Make sure students understand the Is A relationship in inheritance and use this to rationalize why polymorphism is useful. Show why polymorphism is a practical tool that allows you to store many different things into one storage container. Slide 2: What will I learn? There are no instructor notes for this slide. Slide 3: Why Learn It? There are no instructor notes for this slide. Slide 4: Why Learn It? (continued) There are no instructor notes for this slide. Slide 5: Review of Inheritance There are no instructor notes for this slide. Slide 6: Inheritance There are no instructor notes for this slide. Slide 7: Polymorphism There are no instructor notes for this slide.

Slide 8: Polymorphism and Nesting Dolls There are no instructor notes for this slide. Slide 9: Polymorphism and Nesting Dolls (continued) There are no instructor notes for this slide. Slide 10: Polymorphism There are no instructor notes for this slide. Slide 11: Polymorphism (continued) There are no instructor notes for this slide. Slide 12: Why Is Polymorphism Useful? There are no instructor notes for this slide. Slide 13: Why Is Polymorphism Useful (continued) There are no instructor notes for this slide. Slide 14: Why Is Polymorphism Useful (continued) There are no instructor notes for this slide. Slide 15: Object There are no instructor notes for this slide. Slide 16: Overriding Methods from Object There are no instructor notes for this slide. Slide 17: Overriding Methods from Object (continued) There are no instructor notes for this slide. Slide 18: Overriding Methods Visit the Java Tutorials for more information on overriding methods: http://docs.oracle.com/javase/tutorial/java/IandI/override.html

Slide 19: Overriding toString() There are no instructor notes for this slide. Slide 20: Understanding The Object Model There are no instructor notes for this slide. Slide 21: Understanding The Object Model (continued) There are no instructor notes for this slide. Slide 22: Polymorphism and Methods There are no instructor notes for this slide. Slide 23: Polymorphism and Methods (continued) There are no instructor notes for this slide. Slide 24: Dynamic Method Dispatch There are no instructor notes for this slide. Slide 25: Abstract Classes There are no instructor notes for this slide. Slide 26: Abstract Classes (continued) There are no instructor notes for this slide. Slide 27: Abstract Classes (continued) There are no instructor notes for this slide. Slide 28: Abstract Methods There are no instructor notes for this slide. Slide 29: Partially Implemented Methods There are no instructor notes for this slide. Slide 30: Partially Implemented Methods (continued)

There are no instructor notes for this slide. Slide 31: Partially Implemented Methods (continued) There are no instructor notes for this slide. Slide 32: Sub-Classing Abstract Classes There are no instructor notes for this slide. Slide 33: Using Final Using Final: http://docs.oracle.com/javase/tutorial/java/IandI/final.html Slide 34: Using Final (continued) There are no instructor notes for this slide. Slide 35-36: Triangle Applet There are no instructor notes for this slide. Slide 37: Terminology There are no instructor notes for this slide. Slide 38: Summary There are no instructor notes for this slide. Slide 39: Practice Vocabulary 1. Polymorphism A concept in object oriented programming that allows classes to have many forms and behave like their superclasses. 2. Immutable 3. Overloading Methods 4. Dynamic Method Dispatch 5. Abstract A property of a class that makes the class unable to be extended or data to be changed. Implementing a method with the same name as another method that has different parameters or a different return type. The process by which Java is able to determine which method to invoke when methods have been overridden. A keyword in Java that allows classes to be extended, but the classes

cannot be instantiated (constructed) and when applied to methods, dictates that the methods should be implemented in all subclasses of the class. 6. Overriding Methods 7. Final Implementing methods in a subclass that have the same prototype (the same parameters, method name, and return type) as another method in the superclass. A keyword in Java used to limit subclasses from extending a class, overriding methods or changing data.

Try It/Solve It Activities 1. What will be the output of the following code? class A { void callthis() { System.out.println(Inside Class A's Method!); } } class B extends A { void callthis() { System.out.println(Inside Class B's Method!); } } class C extends A{ void callthis() { System.out.println(Inside Class C's Method!); } }

class DynamicDispatch { public static void main(String args[]) A a = new A(); B b = new B(); C c = new C(); A ref; {

ref = b; ref.callthis();

ref = c; ref.callthis();

ref = a; ref.callthis(); } }

Inside Class B's Method! Inside Class C's Method! Inside Class A's Method! 2. What is the difference between an abstract class and an interface? When is it appropriate to use an abstract class or an interface? Answers will vary. Sample: Both an abstract class and an interface cannot be instantiated, but abstract classes can contain implemented or partially implemented methods and constructors in addition to data. Interfaces only dictate which methods a class should include. Abstract classes can dictate which methods should be implemented in its subclasses if methods are declared as abstract. Abstract classes are best used when a programmer wants to implement the same methods across several subclasses or when data fields need to be included in several classes, as well as to obligate the subclasses to include certain methods by including abstract methods. Interfaces are best used when no data or methods need to be implemented with the same code across classes, but methods should be included.

3. Given the information for the following, determine whether they will result Always compile, sometimes compile, or does not compile. public interface A public class B implements A public abstract class C public class D extends C public class E extends B Each class have been initialized, but it is not clear what they have been initialized to: A a = new... B b = new... C c = new... D d = new... E e = new...

The following methods are included: interface A specifies method void methodA() class C has the abstract method void methodC()

Code: a = new B(); d = new C(); b.methodA(); e.methodA(); c = new C(); (D)c.methodC();

Always Compile, Sometimes Compile, or Does Not Compile? Always compiles. Does not compile. Always compiles. Always compiles. Does not compile. Sometimes compiles.

4.

Override the toString() method for the class below to output the results, matching the given output. The toString() method should print all the values from 1 to the number specified in num and then print the final value using the provided getFactorial method. Assume the variable int num is a public global value; Factorial: 10! = 1 * 2 * 3 * 4 * 5 * 6 * 7 * 8 * 9 * 10 = 3628800 int getFactorial(){ int factorial; for(i = num; num > 0; i--){ factorial *= num; } return factorial; } public String toString() { String returnString = Factorial: + num + ! = ; for(int i = 1; i<num; i++) { returnString = returnString + i + * ; } returnString = returnString + i + = getFactorial(); return returnString; }

You might also like