Beginning Microsoft® Small Basic
Total Page:16
File Type:pdf, Size:1020Kb
® Beginning Microsoft Small Basic ® ® ® ™ Plus a Porting Guide to Microsoft Visual Basic , C# , and Java © PHILIP CONROD & LOU TYLEE, 2010 Kidware Software PO Box 701 Maple Valley, WA 98038 http://www.computerscienceforkids.com http://www.kidwaresoftware.com Copyright © 2010 by Philip Conrod & Lou Tylee. All rights reserved Kidware Software PO Box 701 Maple Valley, Washington 98038 1.425.413.1185 www.kidwaresoftware.com www.computerscienceforkids.com www.biblebytebooks.com All Rights Reserved. No part of the contents of this book may be reproduced or transmitted in any form or by any means without the written permission of the publisher. Printed in the United States of America ISBN-13: 978-1-937161-19-4 Book Cover Illustration by Kevin Brockschmidt Copy Editor: Stephanie Conrod This copy of the Beginning Microsoft Small Basic book and the associated software is licensed to a single user. Copies of the course are not to be distributed or provided to any other user. Multiple copy licenses are available for educational institutions. Please contact Kidware Software for school site license information. This guide was developed for the course, “Beginning Microsoft Small Basic,” produced by Kidware Software, Maple Valley, Washington. It is not intended to be a complete reference to the Small Basic language. Please consult the Microsoft website for detailed reference information. This guide refers to several software and hardware products by their trade names. These references are for informational purposes only and all trademarks are the property of their respective companies and owners. Microsoft, Visual Studio, Small Basic, Visual Basic, Visual J#, and Visual C#, IntelliSense, Word, Excel, MSDN, and Windows are all trademark products of the Microsoft Corporation. Java is a trademark product of the Sun Corporation. JCreator is a trademark product of XINOX Software The example companies, organizations, products, domain names, e-mail addresses, logos, people, places, and events depicted are fictitious. No association with any real company, organization, product, domain name, e-mail address, logo, person, place, or event is intended or should be inferred. This book expresses the author’s views and opinions. The information in this book is distributed on an "as is" basis, without and expresses, statutory, or implied warranties. Neither the author(s) nor Kidware Software, LLC shall have any liability to any person or entity with respect to any loss nor damage caused or alleged to be caused directly or indirectly by the information contained in this book. ABOUT THE AUTHORS Philip Conrod has been programming computers since 1978. Since then, he has authored, co-authored and edited many beginning computer programming tutorials and books for kids, teens and adults. Philip also holds a BS in Computer Information Systems and a Master's certificate in the Essentials of Business Development from Regis University. Philip has also held various Information Technology leadership roles in companies like Sundstrand Aerospace, Safeco Insurance Companies, FamilyLife, Kenworth Truck Company, and PACCAR. Today, Philip serves as the Chief Information Officer for a large manufacturing company based in Seattle, Washington. In his spare time, Philip serves as the President of Kidware Software, LLC. He makes his home with his lovely wife and three beautiful and “techie” daughters in Maple Valley, Washington. Lou Tylee holds BS and MS degrees in Mechanical Engineering and a PhD in Electrical Engineering. Lou has been programming computers since 1969 when he took his first Fortran course in college. He has written software to control suspensions for high speed ground vehicles, monitor nuclear power plants, lower noise levels in commercial jetliners, compute takeoff speeds for jetliners, locate and identify air and ground traffic and to let kids count bunnies, learn how to spell and do math problems. He has written several on-line texts teaching Visual Basic, Visual C# and Java to thousands of people. He taught a beginning Visual Basic course for over 15 years at a major university. Currently, Lou works as an engineer at a major Seattle aerospace firm. He is the proud father of five children and proud husband of his special wife. Lou and his family live in Seattle, Washington. Acknowledgements I would like to thank my beautiful wife, Tiffany, for sacrificing so many nights and weekends so I could finish and publish this edition of the book. I also want to thank my three wonderful daughters - Stephanie, Jessica and Chloe, who helped with various aspects of the book publishing process including software testing, book editing, creative design and many other more tedious tasks like finding all my errors. I could not have accomplished this without all your hard work, love and support. I also want to thank my very talented illustrator, Kevin Brockschmidt , who designed the book cover and the Computer Science Kids. Kevin was very generous with his time and creative talents. Many thanks to others who worked behind the scenes like Jack Barrow and Harold Coqmard for helping me out at the last minute when I just could not figure out Adobe Acrobat and Adobe Illustrator. I also want to thank Rajesh Tuteja for helping me with language translation and some other important behind the scenes tutorial work. Last but definitely not least, I want to thank my multi-talented co-author, Lou Tylee, for doing all the real hard work necessary to develop, test, debug, and keep current all the ‘kid-friendly’ applications, games and base tutorial text found in this book. Lou has tirelessly poured his heart and soul into so many previous versions of this tutorial and there are so many beginners who have benefited from his work over the years. Lou is by far one of the best application developers and tutorial writers I have ever worked with. Thanks Lou for collaborating with me on this book project. Table of Contents 1. Introducing Small Basic Preview ...................................................................................................... 1-1 Why Learn Small Basic? ............................................................................ 1-2 A Brief History of Small Basic .................................................................... 1-4 Let’s Get Started ...................................................................................... 1-10 Downloading and Installing Small Basic ................................................... 1-12 Starting Small Basic ................................................................................. 1-16 Opening a Small Basic Program .............................................................. 1-19 Running a Small Basic Program .............................................................. 1-21 Stopping Small Basic ............................................................................... 1-23 Summary ................................................................................................. 1-24 2. Small Basic Program Basics Review and Preview .................................................................................. 2-1 The Welcome Program (Revisited) ............................................................ 2-2 Some Rules of Small Basic Programming ................................................. 2-5 Creating Small Basic Programs ................................................................. 2-7 Saving Small Basic Programs .................................................................. 2-12 Small Basic Files ...................................................................................... 2-15 Summary ................................................................................................. 2-16 3. Your First Small Basic Program Review and Preview .................................................................................. 3-1 Creating a Small Basic Program ................................................................ 3-2 Small Basic - The First Lesson .................................................................. 3-6 Variables ............................................................................................ 3-6 Variable Names ................................................................................. 3-7 Variable Types ................................................................................... 3-8 Assignment Statement ..................................................................... 3-10 Arithmetic Operators ........................................................................ 3-11 String Concatenation ....................................................................... 3-15 Comments ....................................................................................... 3-16 Program Output ............................................................................... 3-17 Program - Sub Sandwich Party ................................................................ 3-21 Program Design ............................................................................... 3-21 Program Development ..................................................................... 3-22 Run the Program .............................................................................. 3-25 Other Things to Try .......................................................................... 3-26 Summary ................................................................................................. 3-28 4. Small Basic Program Design, Input Methods Review and Preview