diff --git a/Summer-2024/CS-3424/Midterm-Notes.org b/Summer-2024/CS-3424/Midterm-Notes.org new file mode 100644 index 0000000..232e094 --- /dev/null +++ b/Summer-2024/CS-3424/Midterm-Notes.org @@ -0,0 +1,69 @@ +* Systems Programming Midterm Topics +1. Linux environment / shell commands + - Common commands + - Chmod/permissions + - Wildcards + - Input/output redirection + - Shell parsing steps + - Shell command resolution variables + - Shell vs environment and their inheritance + - Exit statuses + - Subshells / child shells + - Arithmetic (operators: expansion vs evaluation) + - Floating arithmetic in bash: how? +2. Bash Scripting +3. ~find~/~grep~ +4. Regular expressions (BRE vs ERE) +5. ~sed~ + +NOTE: No AWK material will be covered on the exam + +* Example Questions +1. Answer =True= or =False= for the following statements: + - [TRUE] The extended regular expression ~{0,1}~ is equivalent to the ~?~ quantifier? + - [FALSE] An exit status of ~0~ is used to indicate success. + - [FALSE] Given the string "abc123" the regex ~/[a-z]{1,3}/~ will produce a match of "a". + - [FALSE] The following loop will never execute: + #+begin_src bash + while [ 0 ]; do let i++; echo $i; done + #+end_src + - [TRUE] The following loop will never execute: + #+begin_src bash + while (( 0 )); do let i++; echo $i; done + #+end_src + - [TRUE] ~sed~ will emit the contents of the pattern space, including a trailing newline character, by default at the end of each input cycle. + - [FALSE] The following bash filename pattern will match all text files in the user's current directory: + #+begin_src bash + ls -la .*\.txt + #+end_src + - [TRUE] The ~source~ built-in executes the contents of a specified file within the current script (i.e. no subshell is utilized). + - [FALSE] ~grep~ uses extended regular expressions by default +2. Enter the octal number corresponding to the following Linux file permissions: ~rwxr-x---~ + Answer: ~0750~ +3. Write out the erroneous line numbers from the following script (hint there are six): + #+begin_src bash + data="./data" + org_data=/usr/local/courses/ssilvestro/cs3424/Spring21/assign1/ + + if [[ $# -eq 1 ]]; then + data = $1 + else if [[ $# -eq 2 ]]; then + data = $1 + orig_data = $2 + fi + + if [[! -d $data]]; then + echo "ERROR: data directory '$data' does not exist" + exit 1 + fi + if [[ not -d $orig_data ]]; then + echo "ERROR: original data directory '$data' does not exist" + exit 1 + fi + echo "rm -rf \"$data\"..." + rm -rf "$data" + + echo "cp -r \"$org_data\" \"$data\"..." + cp -r "$orig_data" "$data" + #+end_src + Answer: ~4,5,6,7,9,13~ diff --git a/Summer-2024/CS-3424/Quizzes/Quiz-6/Assignment.pdf b/Summer-2024/CS-3424/Quizzes/Quiz-6/Assignment.pdf new file mode 100644 index 0000000..c844971 Binary files /dev/null and b/Summer-2024/CS-3424/Quizzes/Quiz-6/Assignment.pdf differ diff --git a/Summer-2024/CS-3443/Slides/txt/01_Course-Introduction.txt b/Summer-2024/CS-3443/Slides/txt/01_Course-Introduction.txt new file mode 100644 index 0000000..db81ed1 --- /dev/null +++ b/Summer-2024/CS-3443/Slides/txt/01_Course-Introduction.txt @@ -0,0 +1,278 @@ +Application +Programming +Hend Alkittawi + + WELCOME! + + Introduction +Welcome to Application Programming + + WHAT IS APPLICATION PROGRAMMING? +Advanced application development in a current object-oriented language. +Introduction to the software life cycle, best programming practices, and modern +development tools. +This course is: +1. + +An introduction to application development, including best practices +and object-oriented programming. + +2. + +Experience with new IDEs, repository sharing, and app building tools. + +3. + +The foundation you need for your first internship as a software +engineer. + + WHAT IS APPLICATION PROGRAMMING? +Advanced application development in a current object-oriented language. +Introduction to the software life cycle, best programming practices, and modern +development tools. +This course is not the following courses: +1. + +Software Engineering + +2. + +Mobile App Development + +3. + +Enterprise Software Engineering + +4. + +User Interface Design + + WHAT IS APPLICATION PROGRAMMING? + +Documentation +Testing +Coding + +Engineering + +Collaboration + + WHAT IS APPLICATION PROGRAMMING? + +35% + +30% + +20% + +15% + +Labs + +Exams + +Project + +Quizzes + +● + +Refer to the schedule (here) for due dates. + + LABS + +�� +5 Labs + +- + +All labs will be submitted on Canvas. + +- + +Labs + +- + +You may discuss algorithms and + +must be completed individually. + +approaches with others, but you may not +code together, share code, or share a +computer, under any circumstance. + + QUIZZES + +�� +6 Quizzes + +- + +All quizzes are administered on Canvas. + +- + +Quizzes are not timed. + +- + +You may use online resources or any +materials. + +- + +Collaboration is not permitted. + +- + +Late quiz submissions are not accepted. + + EXAMS + +�� +2 Exams + +- + +Midterm Exam on June 19, 2024 in class +during class time. + +- + +Final Exam on August 7, 2024 in class +during class time. + + PROJECT + +June +05 + +June +12 + +June +19 + +June +26 + +July +03 + +July +31 + +Aug +07 + +Aug +07 + +TEAM +FORMATION + +TEAM +INTRODUCTION + +PROJECT +PROPOSAL + +PROJECT +PROTOTYPE + +CODE +DESIGN + +PROJECT +DEMO + +FINAL +APPLICATION + +SURVEY + +2 points + +2 points + +2 points + +2 points + +4 points + +2 points + +4 points + +2 points + +● If you don't incorporate feedback from a previous assignment into the next one, you will +receive a 0 on that assignment. +● Your project grade depends on your contribution to the project! + + IMPORTANT + +You are expected to have +a solid understanding of +the following topics +- + +Variables +Functions +Conditionals +Iterations +Arrays + + IMPORTANT + +The slides are used to guide +the flow of the class, and +are not meant to be the only +reference for completing the +labs and quizzes, studying +for the exams, or finishing +the project! + + “Software development is hard, +but it opens the door to great +opportunities. Accept that it +is hard, embrace the +complexity, enjoy the ride.” +—Bruno”Sousa + + RESOURCES +At UTSA we are committed to providing you with the support and resources +necessary to help you succeed in your academic journey. Here are some available +resources that you can utilize: +Computing Resources +● +Virtual desktop machines VDIs (available remotely!) - details on Canvas +● +Computers & Internet available in JPL and CS Main Lab (NPB 2.118) +Tutoring Resources +● +UTSA CS Tutoring on Slack and in the CS Main Lab +Library Resources +● +Textbooks are available (for all UTSA courses!) for short loans through the +John Peace Library (UTSA JPL) - print and ebook format. +Remember, these resources are designed to support and empower you. Do not +hesitate to reach out and take advantage of the opportunities available. We are +here to help you thrive and achieve your goals. + + DO YOU HAVE ANY +QUESTIONS? + +THANK +YOU! + +@ + +hend.alkittawi@utsa.edu + +By Appointment +Online + + \ No newline at end of file diff --git a/Summer-2024/CS-3443/Slides/txt/02_Java-Basics.txt b/Summer-2024/CS-3443/Slides/txt/02_Java-Basics.txt new file mode 100644 index 0000000..8859db1 --- /dev/null +++ b/Summer-2024/CS-3443/Slides/txt/02_Java-Basics.txt @@ -0,0 +1,305 @@ +Application +Programming +Hend Alkittawi + + Java Basics +Introduction to Java Concepts and +User-defined Java Classes + + CONCEPTS + +JAVA + +OBJECT + +- Released in early 1990s + +- Defined by a class + +- Object-oriented + +- A class is a reusable + +- Java SE, Java EE, Java ME + +software components +- Non-primitive data type + + CONCEPTS + +JAVA APIs +- Application Programming +Interfaces +- Collections of existing +classes and methods in the +Java class libraries + +JDK +- Java Development Kit +- Includes compiler, loader, +debugger, JRE, and other +tools for Java development + + CONCEPTS + +JVM +- Java Virtual Machine +- A part of the JRE that + +IDE +- Integrated Development +Environment + +executes bytecodes. + +- A software that provides + +- Bytecodes are platform + +comprehensive facilities + +independent (portable) + +for software development. + + WHY DO WE USE OBJECTS? +● + +Let us discuss the difference between +○ + +Write a program to read n number of values in an array and +display them in reverse order. + +○ + +Write a program to calculate x raised to the power n (xn). + +○ + +Write a program to swap two numbers. + +and +○ + +Small Scale Applications + + OBJECT ANALOGY + +BLUEPRINTS + +My Car +color, … +accelerate, … + +Your Car + +Some Car + +color, … +accelerate, … + +color, … +accelerate, … + + JAVA OBJECTS +public class Car { + +Class Declaration + +private int colorID; +private double speed; +public void setSpeed(int s){ +speed = s; +} +public void accelerate(){ +speed = speed + 70; +} + +Attributes / Instance Variable(s) + +Behaviors / Method(s) + +public static void main(String[] args){ +Car myCar = new Car(); +myCar.setSpeed(50); +} +} + +Car.java + +Instantiation (building a Car object) + + OBJECT ANALOGY + +BIOLOGICAL +CLASSIFICATION + +My Dog +breed, … +bark, … + +Your Dog +breed, … +bark, … + +Some Dog +breed, … +bark, … + + JAVA OBJECTS +public class Dog { + +Class Declaration + +private int breedID; + +Attributes / Instance Variable(s) + +public void bark(){ +System.out.println("Woof"); +} + +Behaviors / Method(s) + +Dog.java + +public static void main(String[] args){ +Dog myDog = new Dog(); +Instantiation (building a Dog obj) +myDog.bark(); +} +} + + THE String CLASS +- + +The char primitive type stores one character of the Unicode +character set. + +- + +- + +A string is a sequences of characters. +- + +can be 0 or more characters long + +- + +"" is the empty string + +The String class facilitates handling multiple characters at +once. + +- + +A String object can be declared in order to work with strings +String someStringObject = new String(); +someStringObject = "HI"; + + THE String CLASS +- + +Many String manipulation methods are available, here are some: +- + +split() method to get an array of Strings from a String, based +on a delimiter. This object method takes a delimiter as a +parameter. + +- + +trim() method to clear off any additional space from the text. +This object method takes no parameters. + +- + +charAt() method to get the character at an index in the string +[starting with index 0]. This object method takes an index as +a parameter. + +- + +equals() method to check if two Strings contain the same text. +This object method takes a String object as a parameter. + + THE String CLASS +- + +Java also treats string literals as objects +- + +- + +A string literal is a quoted string: "Sam I am", "Hi", …, etc. + +Examples: +String strObj = "This is \"a\" String"; +strObj.charAt(0); +"HI + +".trim(); + +escape sequence + +"Hello".equals(strObj); +● + +Note how we can create/work with string literals as String +objects. + + JAVA OBJECTS +public class Dog { +private int breedID; +private String name; +public void bark(String dogBark){ +System.out.println(dogBark); +} + +} + +public static void main(String[] args){ +Dog myDog = new Dog(); +myDog.bark("Woof"); +} + +Dog.java + + Class Activity +public class SimpleLocation { +private double latitude; +private double longitude; +public void setLocation(double lat, double lon){ +latitude = lat; +longitude = lon; +} + +} + +public static void main(String[] args){ +SimpleLocation utsa = new SimpleLocation(); +utsa.setLocation(32.9, -117.2); +} + +What is +the value +of +longitude +? + + DO YOU HAVE ANY +QUESTIONS? + +THANK +YOU! + +@ + +hend.alkittawi@utsa.edu + +By Appointment +Online + + \ No newline at end of file diff --git a/Summer-2024/CS-3443/Slides/txt/03_Eclipse-IDE.txt b/Summer-2024/CS-3443/Slides/txt/03_Eclipse-IDE.txt new file mode 100644 index 0000000..caa0d1f --- /dev/null +++ b/Summer-2024/CS-3443/Slides/txt/03_Eclipse-IDE.txt @@ -0,0 +1,154 @@ +Application +Programming +Hend Alkittawi + + Eclipse IDE +Introduction to Eclipse IDE + + ECLIPSE IDE +● + +Eclipse is an integrated development environment (IDE) used in +computer programming. + +● + +It is a popular IDE for Java development. + +● + +In Eclipse you can create new Java projects and import +existing projects to the workspace. + +● + +An Eclipse workspace is a folder on the disk where the project +and application files are stored. + +● + +Get eclipse here + + CREATING A PROJECT IN ECLIPSE +1. + +Open Eclipse and select/create a workspace > Launch + +2. + +If the welcome window appears, choose to hide it + +3. + +In the Package Explorer (top left area of IDE), right +click and select New > Java Project + +4. + +Name your project + +5. + +Ensure that the create module-info.java file is unchecked + +6. + +Click “finish” + + Open Eclipse and +select/create a +workspace > Launch + +If the welcome window +appears, choose to hide +it + + Create a new Java project using the new project wizard (multiple ways) + + Name your project (for labs, follow the lab guidelines!) + +Ensure that the create module-info.java file is unchecked + + CREATING A CLASS IN AN ECLIPSE PROJECT +1. + +Expand your project + +2. + +Right-click on src > New > Class + +3. + +Name your class following Java naming convention + +4. + +To run your class, you need a main method. With that, +you can click the green “run” button at the top of the +IDE to run your program and see results in the console. + + Create a new Java class +right-click on src > New > Class +give the class a name > finish + +leave this as the default package + +optional, can be added later + + Edit and run your code + + IMPORTING A PROJECT IN ECLIPSE +1. + +If you have an Eclipse project in a zip file, unzip the +file + +2. + +Open Eclipse and select/create a workspace > Launch + +3. + +If the welcome window appears, choose to hide it + +4. + +In the Package Explorer (top left area of IDE), right +click and select Import … + +5. + +Select General > Existing Project Into Workspace > Next + +6. + +Browse to find the unzipped project directory > Finish + + Import an existing project using the import project wizard (multiple ways) + + Select General > Existing Project Into Workspace > Next + + Browse to find the unzipped project directory > Finish + + CODE DEMO +- + +Create a Java project +and a Java class to +demo concepts! + + DO YOU HAVE ANY +QUESTIONS? + +THANK +YOU! + +@ + +hend.alkittawi@utsa.edu + +By Appointment +Online + + \ No newline at end of file diff --git a/Summer-2024/CS-3443/Slides/txt/04_Java-Best-Practices.txt b/Summer-2024/CS-3443/Slides/txt/04_Java-Best-Practices.txt new file mode 100644 index 0000000..386d1ad --- /dev/null +++ b/Summer-2024/CS-3443/Slides/txt/04_Java-Best-Practices.txt @@ -0,0 +1,481 @@ +Application +Programming +Hend Alkittawi + + More on Java Classes +Best practices for Creating Java +Classes + + BEST PRACTICES FOR CREATING JAVA CLASSES +STYLE +- identifier naming +- indentation + +CONSTRUCTORS +- Ways to instantiate +objects + +METHODS +- getters and setters +- equals() +- toString() + +JAVADOC +- “special” Java +documentation + + STYLE +visibility + +type + +class name + +public class MyClass { +// attributes +private int intVar; +visibility + +type + +variable name + +// methods +public void myMethod(String myString){ +visibility + +} + +} + +return +type + +method +name + +parameter parameter +type +name + + METHODS +- + +The syntax (rules) for declaring a method +visibility returnType methodName(parameterList) +- + +visibility determines access +- + +- + +returnType is the type of data this method returns +- + +- + +public (all can access) or private (just this class can access) +if nothing is returned, use the keyword void + +methodName starts with a lowercase word +- + +it uses uppercase for the first letter of each additional word +(this is called “camel case”) + +- + +parameterList is any data we need to pass to the method +- + +The ordering must be followed exactly + + METHODS +- + +Getter and setter methods are used to get and set the +value of the attributes. +- + +Getters retrieve the value only + +- + +Setters update the value only + +public class Account { +private double balance; +private String name; +public void setBalance( double balance ){ +this.balance = balance; +} +public double getBalance(){ +return this.balance; +} +// add a getter and a setter for name +} + +● to use the class and its methods +public static void main(String[] args){ +Account myAccount = new Account(); +myAccount.setBalance(1000.0); +double balance = myAccount.getBalance(); +} + + METHODS +- + +toString() method returns a String representation of objects. +An example of a toString() method for the Account class: + +public class Account { +private double balance; +private String name; +public void setBalance( double balance ){ +this.balance = balance; +} +public double getBalance() { +return this.balance; +} +// … getter and a setter for name +public String toString() { +return "Account info: name: " + name ++ " with balance: " + balance; +} +} + +● to use the class and its methods +public static void main(String[] args){ +Account myAccount = new Account(); +myAccount.setName("Sam Adams"); +myAccount.setBalance(1000.0); +System.out.println( myAccount ); +} + + METHODS +- + +equals() method provides a way for users to compare instances +of your object to other instances. This also gives you control +over what is relevant to differentiate your objects. + +- + +● to use the class and its methods + +private double balance; +private String name; + +public static void main(String[] args){ +Account myAccount = new Account(); +Account yourAccount = new Account(); +myAccount.setName(“Mia”); +myAccount.setBalace(10); +yourAccount.setName(“Ken”); +yourAccount.setBalance(100); +boolean check = +myAccount.equals(yourAccount); +} + +public class Account { + +public void setBalance( double balance ) { +this.balance = balance; } +public double getBalance() { +return this.balance; } +public String toString() { +return "Account info: name: " + name ++ " with balance: " + balance; } +public boolean equals( Account account2 ) { +return this.getName().equals( account2.getName());} +} + + IMPORTANT + +● + +== is used for primitive types only +○ + +● + +Objects define an object-method called equals() +○ + +● + +2 == 5 + +objA.equals(objB); + +Core: Drawing Memory Models with Objects - Memory Models, Scope, +and Starting the Project | Coursera + + public class Account { +private double balance; +private String name; +public void setBalance( double balance ) { +this.balance = balance; } +public void setName( String name ) { +this.name = name; } + +yourAccount + +myAccount + +name + +name + +balance + +balance + +public double getBalance() { +return this.balance; } +public String getName() { +return this.name; } +public boolean equals( Account account2 ) { +return this.getName().equals( account2.getName()); +} +public String toString() { +return "Account info: name: " + name ++ " with balance: " + balance; } +} + +public static void main(String[] args){ +Account myAccount = new Account(); +Account yourAccount = new Account(); +myAccount.setName("Mia"); +myAccount.setBalace(10); +yourAccount.setName("Ken"); +yourAccount.setBalance(100); +boolean check = +myAccount.equals(yourAccount); +} + + CONSTRUCTORS +- + +Java requires a constructor call for every object that is created. + +- + +The keyword new creates a new object of a specified class by +calling a constructor. + +- + +A constructor is similar to a method but is called implicitly by +the new operator to initialize an object’s instance variables when +the object is created. + +- + +In any class that does not explicitly declare a constructor, the +compiler provides a default constructor (which always has no +parameters). + +- + +When a class has only the default constructor, the class’s +instance variables are initialized to their default value. + + METHODS +- + +You can provide your own constructor to specify custom +initialization for objects of your class. + +- + +A constructor must have the same name as the class. + +- + +If you declare a constructor for a class, the compiler will +not create a default constructor that class. + +public +class Account { +private double balance; +private String name; +public Account( String name, double balance ){ +this.name = name; +this.balance = balance; +} +/* … rest of class … */ +} + +● to use the class and its methods +public static void main(String[] args){ +Account myAccount = new Account("Sam", 1000); +Account yourAccount = new Account("Jane", 2000); +} + + JAVA GARBAGE COLLECTION +- + +More than one variable may refer to the same data. + +- + +Java will clear out old data that no variables are referencing +- + +- + +This is known as garbage collection + +Garbage collection is the process through which Java will +eventually clear out old data that no variables are +referencing. + + JAVADOC +- + +Javadoc comments are delimited between /** and */. + +- + +Javadoc comments enable you to embed program documentation +directly in your programs. + +- + +Javadoc utility program reads Javadoc comments and uses them +to prepare program documentation in HTML web-page format. +/** +* This is a Javadoc comment! +*/ + + JAVADOC +- + +Javadoc comments annotations: +- + +@author: designates the author of the code, belongs in the +class comment + +- + +@param: designates the parameter to a method, belongs in all +method comments which require parameters + +- + +@return: designates the returned value of a method, belongs in +method comments which return values + + JAVADOC +Jav + +ine +til t +l +u +M +men +Com + +/** +* The Account class represents a bank account. +* @author CS3443 +*/ +public class Account { +/* attributes here .. a multi-line comment starts with /* .. be careful! */ +/** +* sets the account balance +* @param balance, the account balance (double) +*/ +public void setBalance(double balance){ +this.balance = balance; +} + +doc + +a + +Jav + +c +ado + +} + +/** +* returns the balance for the account +* @return double, the account balance +*/ +public double getBalance(){ +return balance; +} + + JAVADOC + +- + +To generate Javadoc in Eclipse +1. + +Project > Generate Javadoc + +2. + +Destination: workspace/your_project/doc + +3. + +Next + +4. + +Select all “referenced archives and projects” + +5. + +Finish > Yes To All + +6. + +Open index.html + + Project > Generate Javadoc + + Destination:workspace/your_project/doc +> Next + + Select all +> Finish + +Yes To All + + Open index.html + + CODE DEMO +- + +Create a Java class +following the best +practices + +- + +Generate Javadocs + + DO YOU HAVE ANY +QUESTIONS? + +THANK +YOU! + +@ + +hend.alkittawi@utsa.edu + +By Appointment +Online + + \ No newline at end of file diff --git a/Summer-2024/CS-3443/Slides/txt/05_Arrays-and-ArrayLists.txt b/Summer-2024/CS-3443/Slides/txt/05_Arrays-and-ArrayLists.txt new file mode 100644 index 0000000..2b49320 --- /dev/null +++ b/Summer-2024/CS-3443/Slides/txt/05_Arrays-and-ArrayLists.txt @@ -0,0 +1,431 @@ +Application +Programming +Hend Alkittawi + + Basic Java Data Structures +Arrays and ArrayLists, Wrapper +Classes and Static Methods + + JAVA ARRAYS +- + +Arrays in Java are objects which can be declared +- + +by size +int[] myNumbers = new int[4]; +Employee[] employees = new Employee[10]; + +- + +by values directly (using an array initializer) +double[] myNumbers = {10.5, 20.34, 30.8, 40.12}; +Account[] accounts = {accountOne, accountTwo}; + +- + +Access values in an array by providing an index +double x = myNumbers[0]; + +- + +Overwrite values at an index by using assignment +x = x + 5; +myNumbers[1] = x; + +- + +Loop over array elements to fill array, modify elements,… etc. +for (int i = 0; i < myNumbers.length; i++){ +myNumbers[i] = i * 10; +System.out.println(myNumbers[i]); +} + + JAVA ARRAYS +- + +Recall the String manipulation methods +String stringA = "I’m out of candy corn, send help!"; +for( int i = 0; i < stringA.length(); i++ ){ +char c = stringA.charAt(i); +System.out.print( c ); +} +String[] sentences = stringA.split( "," ); +System.out.println( sentences.length ); +System.out.println( sentences[1].trim() ); + + JAVA ARRAYLISTS +- + +An ArrayList object is an array that can grow or shrink as +needed! Use an ArrayList when you don’t know how many of +something you need. + +- + +To create an ArrayList: +ArrayList grades = new ArrayList(); +ArrayList letters = new ArrayList(); +ArrayList employees = new ArrayList(); +ArrayList accounts = new ArrayList(); +More on generics later! + + JAVA ARRAYLISTS +- + +Some useful methods for working with ArrayLists: +- + +add() to add an object to the ArrayList + +- + +get(int index) to get an object from the ArrayList + +- + +contains() to check if an element is in the ArrayList + +- + +size() to get the number of elements currently in the ArrayList + +- + +remove(int index) to remove an object from an index in the +ArrayList +ArrayList grades = new ArrayList(); +grades.add(5); +boolean present = grades.contains(7); +ArrayList letters = new ArrayList(); +letters.add("CS3443"); + + WRAPPER CLASSES +- + +Each primitive data type has a corresponding wrapper class, +which enables you to manipulate primitive type values as +objects. For example: +- + +double has Double + +- + +int has Integer + +- + +char has Character + +- + +boolean has Boolean + + WRAPPER CLASSES +- + +The conversion between the primitive data type and wrapper +class type is mostly automatic +- + +converting a primitive type to wrapper class is called +autoboxing. + +- + +converting a wrapper class object to primitive type is called +unboxing. + +Double dbox = Math.sqrt(2); +double d = 1.0 / dbox; + +// autoboxing +// unboxing + + WRAPPER CLASSES +- + +Wrapper classes provide several methods for manipulating data. + +- + +Some of the methods provided by these classes: +- + +Double.parseDouble() to translate a String into a double value + +- + +Integer.parseInt() to translate a String into a int value + +- + +Character.getNumericValue() to translate a specified Unicode +character into the int value that it represents. + +- + +Note that there is no object associated with these methods + + STATIC METHODS +- + +Methods we have seen so far execute in response to method +calls on specific objects. + +- + +Sometimes a method performs a task that does not depend on an +object. These methods are called static/class methods. + +- + +To declare a method as static, place the static keyword before +the return type in the method’s declaration. +public static void myMethod( arguments ) { method body } + +- + +To call a class’s static method, specify the class name +followed by a dot (.), and the method name. +ClassName.methodName(arguments); + + STATIC METHODS +- + +Some of the static methods in the String class: +- + +String.valueOf() to get the String value of a given variable +of a primitive type +String s = String.valueOf( 350.4 ); +System.out.println( s.charAt(3) ); + +- + +String.format() to format a string, similar to sprintf in C. + +String.format("Account object: name = %s, balance = +$%.2f", name, balance); + + STATIC METHODS +- + +The class Math contains static methods for performing basic +numeric operations such as the elementary exponential, +logarithm, square root, and trigonometric functions + +- + +Here are a few class methods to try: +double absValPos = Math.abs(13) +double absValNeg = Math.abs(-13) +double minVal += Math.min(3, 4) + + OBJECT VS. STATIC METHODS +- + +There are two types of methods in Java +- + +- + +● + +Object methods +- + +Associated with an object + +- + +Sent as a message to an object + +- + +Implicitly passed to the current object + +- + +Keyword: this + +Class/Static methods +- + +Not associated with a particular object + +- + +Sent as a message to a class + +- + +Keyword: static + +When to use static methods - Stack Overflow + + CLASS ACTIVITY +- + +Given the strings below, which of the following lines contain +an object method? +String greeting = "HI"; +String obvious = "This is a string"; +String strWithSpace = " +1. + +greeting.toLowerCase(); + +2. + +String.valueOf(55); + +3. + +obvious.indexOf( "is"); + +4. + +String.valueOf(17.8); + +5. + +strWithSpace.trim(); + +This is a string. + +"; + + CLASS ACTIVITY +- + +Given the strings below, which of the following lines contain +an object method? +String greeting = + +"HI"; + +String obvious = "This is a string"; +String strWithSpace =᳚ " +1. + +greeting.toLowerCase(); + +2. + +String.valueOf(55); + +3. + +obvious.indexOf("is"); + +4. + +String.valueOf(17.8); + +5. + +strWithSpace.trim(); + +This is a string. + +"; + + ARRAYS AND ARRAYLISTS IN A JAVA CLASS +- + +In the case where a class variable contains a data structure, +multiple setter methods should be created. +- + +Setter to set the value of the entire data structure + +- + +Setter/Adder to add just one value to the data structure +public class HelloWorld{ +private String[] messages; +public void setMessages(String[] texts){ +this.messages = texts; +} +public void addMessage (String text){ +This.messages[0] = text; +} +public void addMessage (String text, int index){ +// code to add the value of text to the array +} +} + +Method Overloading + + ENHANCED for STATEMENT +- + +The enhanced for statement iterates through the elements of an +array/arraylist without using a counter! + +- + +for (paramType parameter : arrayName){ +/* statements that read/obtain array elements, cannot +modify elements with the enhanced for statement */ +} +parameter has a type and an identifier. + +- + +the type of the parameter must be consistent with the the type +of elements in the array +for (int x : myNumbers){ +sum = sum + x; +} + + JAVA PACKAGES +- + +Related classes are typically grouped into packages so that +they can be imported into programs and reused. + +- + +The ArrayList class is part of the java.util package, so the +package need to be imported to your class to be able to use +the ArrayList class. +import java.util.ArrayList; + +- + +The package java.lang is implicitly imported by the compiler, +so it is not necessary to import classes in that package to +use them. + +- + +String and Math are examples of classes in java.lang package + + CODE DEMO +- + +Create class(es) to +demo the use of arrays +and arraylists! +Create a class to demo +static methods and +variables. + + DO YOU HAVE ANY +QUESTIONS? + +THANK +YOU! + +@ + +hend.alkittawi@utsa.edu + +By Appointment +Online + + \ No newline at end of file diff --git a/Summer-2024/CS-3443/Slides/txt/06_File-IO.txt b/Summer-2024/CS-3443/Slides/txt/06_File-IO.txt new file mode 100644 index 0000000..f148ddb --- /dev/null +++ b/Summer-2024/CS-3443/Slides/txt/06_File-IO.txt @@ -0,0 +1,281 @@ +Application +Programming +Hend Alkittawi + + File I/O +Working with File Input and Output + + WORKING WITH DATA +- + +Data can be stored on a computer in a file with a particular name! + +- + +There are two fundamentally different ways to store data in a +file: +- + +Text files store data in text format: data items are represented in +human readable form, and can be edited using simple text editors. +- + +- + +*.txt, *.java, *.html, *.csv + +Binary files store data in binary format: data items are +represented in bytes, and stored using an internal format that +requires special software to process. +- + +*.jpeg, *.pdf + + READERS, WRITERS, AND STREAMS +- + +Java APIs provide two set of classes for handling input and +output. + +- + +If data is stored in text form (as a sequence of characters), +the Reader and Writer classes and their subclasses are used to +produce input and output. + +- + +If data is stored in binary form (as a sequence of bytes), the +InputStream and OutputStream classes and their subclasses are +used to produce input and output. + + READERS, WRITERS, AND STREAMS +Reader + +Writer + +InputStream + +OutputStream + +InputStreamReader + +PrintWriter + +FileInputStream + +FileOutputStream + +FileReader + +OutputStreamWriter + +ObjectInputStream + +ObjectOutputStream + +FileWriter + +PrintStream + + READERS, WRITERS, AND STREAMS +- + +To read text data from a disk file, create a FileReader object + +- + +To read binary data from a disk file create a FileInputStream +object + +- + +To write text data to a disk file, create a FileWriter object + +- + +To write binary data to a disk file create a FileOutputStream +object + + THE Scanner CLASS +- + +The Scanner class is flexible in that Scanner objects +can be attached to many different kinds of input. + +- + +- + +input from the console + +- + +input from a file + +Reader + +When constructing a Scanner from a file object, the +Scanner automatically constructs a FileReader. + +- + +The Scanner class is part of the java.util package. + +- + +If the program is unable to locate the specified input + +InputStreamReader + +file, it will generate an exception which will prevent +the the program from continuing normal execution. +- + +You can throw the exception or handle it with a +try/catch. + +FileReader + + THE Scanner CLASS +- + +Some of the useful methods for reading input in the Scanner +class: +- + +- + +token-based processing +- + +hasNext(): checks if the input has a token to read + +- + +next(): reads and returns the next token as a String + +- + +nextInt(): reads and returns an int value + +- + +nextDouble(): reads and returns a double value + +line-based processing +- + +hasNextLine(): checks if the input has a line to read + +- + +nextLine(): reads and returns the next line of input as a String + + FILES AND File OBJECTS +- + +To access a file from inside a Java program, you need to +construct an internal object that will represent the file. + +- + +Once you have constructed the object, you can call a number of +methods to manipulate the file. +File myFile = new File ("myFile.txt"); +if (file.exists() && file.canRead()) { +// read the file! +} + +- + +The File class is part of java.io package. + + READING A FILE WITH THE Scanner CLASS +- + +Instead of instantiating objects with fixed values coded into +the application, we can instantiate objects by reading data +from a file. +- + +create a data directory in your Eclipse project, and place the +file in it. Then, add code to read the data from a file + +public void loadData(String fileName) throws FileNotFoundException { +File file = new File( "data/" + filename ); +Scanner scan = new Scanner( file ); +while( scan.hasNextLine() ) { +String line = scan.nextLine(); +String[] tokens = line.split(","); +// do sth with the string and/or tokens, we will create an object based on the tokens! +MyClass obj = new MyClass(tokens[0], Double.parseDouble(tokens[1]), ...); +} +scan.close(); +} + + To create a data directory in your Eclipse project +right-click on project > New > Folder + + Create a new file in the data directory, or copy and paste an existing file +right-click on data folder > New > File then enter data +OR +copy an existing file > right-click on data folder > paste + + THE FileWriter CLASS +- + +The FileWriter class can be utilized to write text data +to a file. + +- + +Writer + +Use the write() method to write a String to the output +file. + +- + +If the program is unable to locate the specified input +file, it will generate an exception which will prevent + +PrintWriter + +the the program from continuing normal execution. You +can throw the exception or handle it with a try/catch. +public void writeFile(String filename) throws IOException{ +File outFile = new File("data/" + filename); + +OutputStreamWriter + +FileWriter out = new FileWriter(outFile); +out.write("Success! \n"); +out.write("Keep it up ..."); +out.close(); +} + +FileWriter + + CODE DEMO +- + +Modify the classes +created in previous +sessions to demo file +I/O concepts. + + DO YOU HAVE ANY +QUESTIONS? + +THANK +YOU! + +@ + +hend.alkittawi@utsa.edu + +By Appointment +Online + + \ No newline at end of file diff --git a/Summer-2024/CS-3443/Slides/txt/07_Project-Overview.txt b/Summer-2024/CS-3443/Slides/txt/07_Project-Overview.txt new file mode 100644 index 0000000..ebacd55 --- /dev/null +++ b/Summer-2024/CS-3443/Slides/txt/07_Project-Overview.txt @@ -0,0 +1,220 @@ +Application +Programming +Hend Alkittawi + + Project Overview +How to deliver a successful project! + + PROJECT + +June +05 + +June +12 + +June +19 + +June +26 + +July +03 + +July +31 + +Aug +07 + +Aug +07 + +TEAM +FORMATION + +TEAM +INTRODUCTION + +PROJECT +PROPOSAL + +PROJECT +PROTOTYPE + +CODE +DESIGN + +PROJECT +DEMO + +FINAL +APPLICATION + +SURVEY + +2 points + +2 points + +2 points + +2 points + +4 points + +2 points + +4 points + +2 points + +● If you don't incorporate feedback from a previous assignment into the next one, you will +receive a 0 on that assignment. +● Your project grade depends on your contribution to the project! + + PROJECT PROPOSAL +- + +The proposal will serve as the foundation for the +semester-long project +- + +Project Title and Overview + +- + +Project Goals and Objectives + +- + +Target Audience + +- + +Scope of the Project + +- + +User Interface (UI) Design + +- + +Competition + +- + +Team Agreement + +- + +Conclusion + + PAST LABS + + PAST LABS + + PROJECT PROTOTYPE +- + +The prototype will help you visualize the user interface and +user experience of your app before development begins. +- + +Adobe XD is a prototyping tool for user experience and +interaction designers to design websites, mobile apps, and +more. + +- + +Download Adobe XD and get started + +- + +Tutorial + + CODE DESIGN +- + +This assignment focuses on collecting the necessary data files +and obtaining a comprehensive overview of your application's +code design to ensure successful development of your +application. +- + +Collect and organize all data files relevant to your +application. This may include: csv files, txt files, image +files, and any other data sources integral to your +application. + +- + +Application UML diagram (MVC) + + PROJECT DEMO +- + +The demo is to showcase the functionality and features of your +Android app through a demonstration video. This will require +effective communication and presentation skills to highlight +key aspects of your app. + +- + +This assignment also aims to cultivate critical thinking +skills through the subsequent feedback survey evaluation +process. + + FINAL APPLICATION +- + +The final submission of your Android application project is a +crucial step in showcasing your team's work. This assignment +focuses on the successful delivery of your project code while +adhering to specific guidelines and ensuring the project’s +completeness. + +- + +I will be checking the GitHub repositories under the +organization for your final project submissions. +- + +Code + +- + +Readme + +- + +UML + + IMPORTANT + +When given the +choice between +being right or +being kind +choose kind! + + Check the Chocoholics +Anonymous Project Description +and Discuss the Basics of +Software Design Process + + DO YOU HAVE ANY +QUESTIONS? + +THANK +YOU! + +@ + +hend.alkittawi@utsa.edu + +By Appointment +Online + + \ No newline at end of file diff --git a/Summer-2024/CS-3443/Slides/txt/08_Inheritance.txt b/Summer-2024/CS-3443/Slides/txt/08_Inheritance.txt new file mode 100644 index 0000000..8290bb4 --- /dev/null +++ b/Summer-2024/CS-3443/Slides/txt/08_Inheritance.txt @@ -0,0 +1,446 @@ +Application +Programming +Hend Alkittawi + + OOP Concepts +Introduction to Inheritance in Java + + INHERITANCE +- + +When creating a class rather than declaring completely new members +you can designate that the new class should inherit the members of +an existing class. + +- + +The existing class is called the superclass and the new class is +the subclass. + +- + +With inheritance the instance variables and methods that are the +same for all the classes in the hierarchy are declared in a +superclass. + +- + +In inheritance, a new class is created by acquiring an existing +class’s members and possibly embellishing them with new or +modified capabilities. + + public class Animal { + +} + +public class Dog extends Animal { + +public class InheritanceDemo { + +private String name; + +private String breed; + +public String getName() { +return name; +} + +public String getBreed() { +return breed; +} + +Animal animal = new Animal(); +animal.eat(); + +public void setName(String name) { +this.name = name; +} + +public void setBreed(String breed) { +this.breed = breed; +} + +Dog dog = new Dog(); +// setName() is an inherited method +dog.setName("Buddy"); + +public void eat() { +System.out.println(getName() + +" eats food."); +} + +public void bark() { +System.out.println("The dog barks."); +} + +// setBreed() is a method of Dog class +dog.setBreed("Golden Retriever"); + +} + +public static void main(String[] args){ + +// eat() is an inherited method +dog.eat(); +// bark() is a method of Dog class +dog.bark(); +} +} + + INHERITANCE +- + +The direct superclass is the superclass from which the subclass +explicitly inherits. + +- + +An indirect superclass is any class above the direct +superclass in the class hierarchy, which defines the +inheritance relationships among classes. + +- + +In Java, the class hierarchy begins with a class Object which +every class in Java directly or indirectly extends. + +- + +Java supports only single inheritance in which each class is +derived from exactly one direct superclass. + + INHERITANCE +- + +Inheritance and constructors +- + +Constructors are not inherited, a superclass’s constructors are +still available to be called by subclasses. + +- + +Java requires that the first task of any subclass constructor is to +call its direct superclass’s constructor to ensure that the +instance variables inherited from the superclass are initialized +properly. + +- + +Superclass constructor call syntax: + +keyword super followed by a + +set of parentheses containing the super class constructor arguments +which are you used to initialize the super class instance +variables. + + public class Animal { + +public class Dog extends Animal { + +private String name; + +private String breed; + +public Animal(String name) { +this.name = name; +} + +public Dog(String name, String breed) { +super(name); +this.breed = breed; +} + +public String getName() { +return name; +} + +} + +public static void main(String[] args){ +Animal animal = new Animal("Hazel"); +animal.eat(); +Dog dog = new Dog("A Name", "A Breed"); + +public String getBreed() { +return breed; +} + +public void setName(String name) { +this.name = name; +} +public void eat() { +System.out.println(getName() + +" eats food."); +} + +public class InheritanceDemo { + +// eat() is an inherited method +dog.eat(); + +public void setBreed(String breed) { +this.breed = breed; +} + +} + +public void bark() { +System.out.println("The dog barks."); +} + +// bark() is a method of Dog class +dog.bark(); +} +} + + INHERITANCE +- + +A subclass can add its own fields and methods; it is more specific than its +superclass. + +- + +A subclass exhibits the behavior of its superclass and can modify these +behaviors so that they operate appropriately for the subclass. A subclass can +customize methods that it inherits from its superclass to do this the +subclass overrides/redefines the superclass method with an appropriate +implementation. + +- + +To override a superclass method in a subclass, the subclass must declare a +method with the same signature as the superclass method. + +- + +When a subclass method overrides an inherited superclass method, the +superclass version of the method can be accessed from the subclass by +preceding the super-class method name with the keyword super and a DOT (.) +separator. + + public class Animal { + +public class Dog extends Animal { + +private String name; + +private String breed; + +public Animal(String name) { +this.name = name; +} + +public Dog(String name, String breed) { +super(name); +this.breed = breed; +} + +public String getName() { +return name; +} + +public static void main(String[] args){ +Animal animal = new Animal("Hazel"); +animal.eat(); +Dog dog = new Dog("A Name", "A Breed"); +// eat() is an inherited method +dog.eat(); + +public String getBreed() { +return breed; +} + +public void setName(String name) { +this.name = name; +} + +// bark() is a method of Dog class +dog.bark(); + +public void setBreed(String breed) { +this.breed = breed; +} + +public void eat() { +System.out.println(getName() + +" eats food."); +} + +} + +public class InheritanceDemo { + +// toString() in Dog redefines the +// behavior of toString() in Animal +String s = dog.toString(); + +public void bark() { +System.out.println("The dog barks."); +} + +@Override +public String toString() { +return "Name: " + getName(); +} +} + +@Override +public String toString() { +return super.toString() + " Breed: " ++ getBreed(); +} + +} +} + + PUBLIC, PRIVATE AND PROTECTED KEYWORDS +- + +A class’s public members are accessible wherever the program +has reference to an object of that class or one of its +subclasses. + +- + +A class’s private members are accessible only within the class +itself. + +- + +Using protected access modifier offers an intermediate level +of access between public and private; a superclass’s protected +members can be accessed by members of that superclass, by +members of its subclasses and by members of other classes in +the same package. + + PUBLIC, PRIVATE AND PROTECTED KEYWORDS +- + +Public members of the superclass become public members of the +subclass and protected members of the superclass become +protected members of the subclass. + +- + +Methods of a subclass cannot directly access private members +of their superclass. Declaring private instance variables +helps you test, debug and correctly modify systems. + + package inheritance; +public class Animal { + +package inheritance; +public class Dog extends Animal { + +private String name; +public String aString; +public String publicString; +protected String protectedString; + +private String breed; +public Dog(String name, String breed) { +super(name); +this.breed = breed; +} + +public Animal(String name) { +this.name = name; +} + +public String getBreed() { +return breed; +} + +public String getName() { +return name; +} + +public void setBreed(String breed) { +this.breed = breed; +} + +public void setName(String name) { +this.name = name; +} + +public void bark() { +System.out.println("The dog barks."); +} + +public void eat() { +System.out.println(getName() + +" eats food."); +} + +private void testAccess() { +// String s0 = name; // invalid +String s1 = getName(); // indirect access +String s2 = publicString; // insecure +String s3 = protectedString; // valid +} + +@Override +public String toString() { +return "Name: " + getName(); +} + +} + +private void animalMethod() { +// method body +} +} + +@Override +public String toString() { +return super.toString() + " Breed: " ++ getBreed(); +} + +package inheritance; +public class InheritanceDemo { +public static void main(String[] args){ +Animal animal = new Animal("Hazel"); +animal.eat(); +// animal.animalMethod(); // inavlid +// animal.bark(); // invalid +// animal.name = "some string"; // invalid +animal.publicString = "some string"; +animal.protectedString = "some string"; +Dog dog = new Dog("A Name", "A Breed"); +// eat() is an inherited method +dog.eat(); +// bark() is a method of Dog class +dog.bark(); +// toString() in Dog redefines the +// behavior of toString() in Animal +String s = dog.toString(); +// dog.name = "some string"; // invalid +dog.publicString = "some string"; +dog.protectedString = "some string"; +} +} + + CODE DEMO +- + +Create classes to demo +inheritance concepts! + + DO YOU HAVE ANY +QUESTIONS? + +THANK +YOU! + +@ + +hend.alkittawi@utsa.edu + +By Appointment +Online + + \ No newline at end of file diff --git a/Summer-2024/CS-3443/Slides/txt/09_Polymorphism.txt b/Summer-2024/CS-3443/Slides/txt/09_Polymorphism.txt new file mode 100644 index 0000000..aa202f7 --- /dev/null +++ b/Summer-2024/CS-3443/Slides/txt/09_Polymorphism.txt @@ -0,0 +1,184 @@ +Application +Programming +Hend Alkittawi + + OOP Concepts +Polymorphism + + POLYMORPHISM +- + +Polymorphism enables you to write programs that processes +objects that share the same superclass either directly or +indirectly as if they were all objects of the superclass. + +- + +The polymorphism occurs when a program invokes a method +through a superclass variable, at execution time the correct +subclass version of the method is called based on the type of +reference stored in the superclass variable. + +- + +A program can determine the type of an object at execution +time and act on that object accordingly. + + POLYMORPHISM + +Animal + +Fish + +🐟 + +Frog + +🐸 + +Bird + +🐦 + +xy coordinates + +xy coordinates + +xy coordinates + +move() + +move() + +move() + + POLYMORPHISM +Quadrilatera +l + +Square + +Trapezoid + +Parallelogram +s + +color + +color + +color + +getPerimeter() + +getPerimeter() + +getPerimeter() + + POLYMORPHISM + +SpaceObject + +LaserBeam + +SpaceShip + +Plutonian + +picture + +picture + +picture + +draw() + +draw() + +draw() + + public class Animal { + +public class PolymorphismDemo { + +private String name; + +public static void main(String[] args) { + +public Animal(String name) { this.name = name; } + +// Animal reference but Dog object +Animal myAnimal = new Dog("Thunder", 30); +// Output: Thunder the dog barks. +myAnimal.makeSound(); + +public String getName() { return name; } +public void setName(String name) { this.name = name; } + +// Animal reference but Cat object +myAnimal = new Cat("Whiskers", "Persian"); +// Output: Whiskers the cat meows. +myAnimal.makeSound(); + +public void eat() { System.out.println(getName() + " eats food."); } +public void makeSound() { System.out.println("Animal makes a sound."); } +} + +} +} + +public class Dog extends Animal { +public class Cat extends Animal { +private int exerciseNeeds; // in min/day +private String breed; +public Dog(String name, int exerciseNeeds) { +super(name); +this.exerciseNeeds = exerciseNeeds; +} +public int getExerciseNeeds() { +return exerciseNeeds; +} +public void setExerciseNeeds(int exerciseNeeds) { +this.exerciseNeeds = exerciseNeeds; +} +@Override +public void makeSound() { +System.out.println(getName() + " the dog barks."); +} +} + +public Cat(String name, String breed) { +super(name); +this.breed = breed; +} +public String getBreed() { +return breed; +} +public void setBreed(String breed) { +this.breed = breed; } +@Override +public void makeSound() { +System.out.println(getName() + " the cat meows."); +} +} + + CODE DEMO +- + +Create classes to demo +polymorphism concepts! + + DO YOU HAVE ANY +QUESTIONS? + +THANK +YOU! + +@ + +hend.alkittawi@utsa.edu + +By Appointment +Online + + \ No newline at end of file diff --git a/Summer-2024/CS-3443/Slides/txt/10_Abstract-Classes.txt b/Summer-2024/CS-3443/Slides/txt/10_Abstract-Classes.txt new file mode 100644 index 0000000..1742dc9 --- /dev/null +++ b/Summer-2024/CS-3443/Slides/txt/10_Abstract-Classes.txt @@ -0,0 +1,175 @@ +Application +Programming +Hend Alkittawi + + OOP Concepts +Java Abstract Classes + + ABSTRACT CLASSES +- + +Sometimes it's useful to declare classes for which you never +intend to create objects. These classes are called abstract +classes. + +- + +The purpose of an abstract class is to provide an appropriate +superclass from which other classes can inherit and thus share +common design. + +- + +Abstract classes are used only as superclasses in inheritance +hierarchies. + +- + +Abstract classes are incomplete, and cannot be used to +instantiate objects. + + ABSTRACT CLASSES +- + +To make a class abstract, declare it with the keyword abstract +public abstract class MyClass { … } + +- + +Abstract classes normally contain one or more abstract methods + +- + +An abstract method is an instance method with the keyword +abstract and its declaration + +- + +An Abstract method do not provide implementations +public abstract myMethod(); + +- + +Constructors and static methods cannot be declared as +abstract. + + ABSTRACT CLASSES +- + +Subclasses must declare the missing pieces to become concrete +classes from which objects can be instantiated. + +- + +Each concrete subclass of an abstract superclass must provide +concrete implementations of each of the superclass abstract +methods. + + public abstract class Shape { + +public class AbstractClassDemo { + +private String color; +public String getColor() { +return color; +} +public void setColor(String color) { +this.color = color; +} +public void display() { +System.out.println("This is a " + getType() + " shape. Its color is: " + +} +public abstract String getType(); +public abstract void draw(); + +public static void main(String[] args) { +Circle circle = new Circle(); +circle.setColor("red"); +circle.setRadius(5.0); +circle.draw(); // implemented abstract method +circle.display(); // concrete method from +abstract class +} +} +getColor()); + +} +public class Circle extends Shape{ +private double radius; +public double getRadius() { +return radius; +} +public void setRadius(double radius) { +this.radius = radius; +} +public void draw() { +System.out.println("Drawing a " + getColor() + " circle with radius " + getRadius() + "."); +} +@Override +public String getType() { +return "Circle"; +} +} + + public abstract class Shape { +private String color; +public Shape(String color) { this.color = color; } +public String getColor() { return color; } +public void setColor(String color) { this.color = color; } +public void display(){ System.out.println("This is a " + getType() + " shape. Its color is: " + +public abstract String getType(); +public abstract void draw(); + +getColor()); } + +} +public class Circle extends Shape{ + +public class AbstractClassDemo { + +private double radius; +public Circle(String color, double radius) { +super(color); +this.radius = radius; } + +public static void main(String[] args) { +//Shape shape = new Shape("blue"); // invalid +Circle circle = new Circle("red", 5.0); +circle.draw(); // implemented abstract method +circle.display(); // concrete method from +abstract class +} + +public double getRadius() { return radius; } +public void setRadius(double radius) { this.radius = radius; } +} +@Override +public void draw() { +System.out.println("Drawing a " + getColor() + " circle with radius " + getRadius() + "."); +} +@Override +public String getType() { +return "Circle"; } +} + + CODE DEMO +- + +Create classes to demo +abstract classes +concepts! + + DO YOU HAVE ANY +QUESTIONS? + +THANK +YOU! + +@ + +hend.alkittawi@utsa.edu + +By Appointment +Online + + \ No newline at end of file diff --git a/Summer-2024/CS-3443/Slides/txt/11_Interfaces.txt b/Summer-2024/CS-3443/Slides/txt/11_Interfaces.txt new file mode 100644 index 0000000..92c29be --- /dev/null +++ b/Summer-2024/CS-3443/Slides/txt/11_Interfaces.txt @@ -0,0 +1,137 @@ +Application +Programming +Hend Alkittawi + + OOP Concepts +Introduction to Java Interfaces + + INTERFACES +- + +Java interfaces are particularly useful for assigning common +functionality to possibly unrelated classes + +- + +Java interfaces offer a capability requiring that unrelated classes +implement a set of common methods + +- + +A Java interface describes a set of methods that can be called on an +object to tell it to perform some tasks or return some piece of +information + +- + +An interface should be used in place of an abstract class when there is +no default implementation to inherit, that is, no fields and no +concrete methods implementations +- + +this allows objects of unrelated classes to be processed polymorphically + + INTERFACES +- + +An interface declaration begins with the keywords interface +and contains only constants and abstract methods +- + +all methods declared in an interface are implicitly public +abstract methods + +- + +all fields are implicitly public, static, and final +public interface InterfaceName { +public static final dataType varName; +public abstract returnType interfaceMethod(); +} + + INTERFACES +- + +To use an interface, a concrete class must specify that it +implements the interface and must declare each method in the +interface with the signature specified in the interface +declaration + +- + +Java does not allow subclasses to inherit from more than one +superclass, but it allows a class to inherit from one +superclass and implement as many interfaces as it needs +public class ClassName implements InterfaceName +or +public class ClassName extends SuperClass implements InterfaceName +where InterfaceName maybe a comma-separated list of interface names + + public interface Drawable { +public void draw(); +} + +public class InterfaceDemo { +public static void main(String[] args) { +// Creating objects of different +// classes that implement Drawable +Drawable rectangle = new Rectangle(2.5, 7.2); +Drawable tree = new Tree("Oak", 5.5); +Drawable person = new Person("John", 30); + +public class Tree implements Drawable { +private String type; +private double height; +public Tree(String type, double height) { +this.type = type; +this.height = height; } + +// Array of Drawable objects +Drawable[] drawables = {rectangle, tree, person}; + +// getters and setters are omitted + +// Drawing all drawable objects +for (Drawable drawable : drawables) { +drawable.draw(); +} + +@Override +public void draw() { +System.out.println("Drawing a tree with height " + getHeight() + " meters"); } +} + +} +} + +public class Rectangle implements Drawable{ +private double length; +private double width; +public Rectangle(double length, double width) { +this.length = length; +this.width = width; } +// getters and setters are omitted +public void draw() { +System.out.println("Drawing a rectangle with length " + length + " and width " + width); } +} + + CODE DEMO +- + +Create classes to demo +interfaces concepts! + + DO YOU HAVE ANY +QUESTIONS? + +THANK +YOU! + +@ + +hend.alkittawi@utsa.edu + +By Appointment +Online + + \ No newline at end of file diff --git a/Summer-2024/CS-3443/Slides/txt/12_UML-Diagrams-and-Class-Relationships.txt b/Summer-2024/CS-3443/Slides/txt/12_UML-Diagrams-and-Class-Relationships.txt new file mode 100644 index 0000000..defd578 --- /dev/null +++ b/Summer-2024/CS-3443/Slides/txt/12_UML-Diagrams-and-Class-Relationships.txt @@ -0,0 +1,694 @@ +Application +Programming +Hend Alkittawi + + UML Diagrams +UML Diagrams and Class Relationships + + WHAT IS APPLICATION PROGRAMMING? + +Documentation +Testing +Coding + +Engineering + +Collaboration + + UML DIAGRAMS +- + +UML: Unified Modeling Language +- + +- + +Graphical models of object-oriented software + +What do you think such graphical models should include? + + UML DIAGRAMS +- + +UML: Unified Modeling Language +- + +Graphical models of object-oriented software + +Class Name + +Variables + +Methods + + UML DIAGRAMS +- + +Create the UML diagram for the Account.java class +public class Account { +private String name; +private double balance; +public Account(String name) {// method body here} +public void setName(String name) {// method body here} +public void setBalance(double bal) {// method body here} +public String getName() {// method body here} +public double getBalance() {// method body here} +} + +Class Name + +Variables + +Methods + + UML DIAGRAMS +- + +Create the UML diagram for the Account.java class +public class Account { +private String name; +private double balance; + +} + +public Account(String name, double balance) {// method body here} +public void setName(String name) {// method body here} +public void setBalance(double bal) {// method body here} +Account +public String getName() {// method body here} +public double getBalance() {// method body here} +name +balance +Account() +getName() +setName() +getBalance() +setBalance() + + UML DIAGRAMS +- + +Create the UML diagram for the Account.java class +- + +A <> tag indicates interface class + +- + +A <> tag indicates constructor + +- + +Include variables data types + +- + +Include method parameters and their data type + +- + +Include method return data type + +- + +An underscore (_) indicates static + +- + +A minus(-) indicates private + +- + +A plus (+) indicates public + +- + +A hash (#) indicates protected + +Account +- name: String +- balance: double +<> Account( name: String, balance: double ) ++ getName() : String ++ setName( name: String ) ++ getBalance() : double ++ setBalance( amount: double ) + + UML DIAGRAMS +- + +Create the UML diagram for the Account.java class + +public class Account { +private String name; +private double balance; +public Account(String name, double balance) {// method body here} +public void setName(String name) {// method body here} +public void setBalance(double bal) {// method body here} +public String getName() {// method body here} +Account +public double getBalance() {// method body here} +} + +- name: String +- balance: double +<> Account( name: String, balance: double ) ++ getName() : String ++ setName( name: String ) ++ getBalance() : double ++ setBalance( amount: double ) + + UML Diagrams +- + +Classes depend and interact with each other + +- + +UML diagrams can visually show the interactions and +dependencies between classes + +- + +Can you name relationships/dependencies between classes? + + JAVA CLASSES +- + +In a Java application classes are related to each other +- + +In an is-a relationship an object of a subclass can also be treated +as an object of its superclass, or an object that implements an +interface can be treated as an object of the interface +(polymorphism). + +- + +- + +Example: A SavingsAccount class that extends Account class + +- + +Example: An Invoice class that implements Payable interface + +In a has-a relationship, an object contains as members references +to other objects (composition). +- + +Example: An Employee class where an employee has one or more Date +objects + +- + +Example: A Bank class where a bank has one or more Account objects + + UML Diagrams +- + +Dependencies and relationships between classes can be +- + +Dependency relationship + +- + +Unidirectional association + +- + +Bidirectional association + +- + +Aggregation relationship + +- + +Composition relationship + +- + +Realization relationship + +- + +Generalization relationship + + UML DIAGRAMS +- + +Generalization relationship +- + +- + +indicates inheritance between classes + +ClassA has a generalization relationship +with ClassB implies + +Freight + +- + +ClassA inherits from ClassB + +Variables + +- + +ClassA is the subclass, and ClassB is + +Methods + +the superclass +- + +declared in code as ClassA extends + +Luggage + +Cargo + +ClassB + +Variables + +Variables + +Methods + +Methods + + UML DIAGRAMS +- + +Realization relationship +- + +indicates inheritance, where ClassB is +an interface + +- + +<> + +ClassA has a realization relationship with + +Mammal + +ClassB implies + +Variables + +- + +ClassA inherits from ClassB + +- + +declared in code as ClassA implements +ClassB + +Methods + +Cat + +Dog + +Variables + +Variables + +Methods + +Methods + + UML DIAGRAMS +- + +- + +Composition relationship +- + +indicates not-shared association + +- + +strong dependency + +ClassA has a composition relationship with ClassB implies +- + +ClassA is a container for a data structure of ClassB + +- + +there is not a super-sub / parent-child relationship between +ClassA and ClassB + +- + +if ClassA is deleted, ClassB need to be removed as well +Folder +- files: File[] +Methods + +File +Variables +Methods + + UML DIAGRAMS +- + +Aggregation relationship +- + +- + +indicates shared association + +ClassA has an aggregation relationship with ClassB implies +- + +ClassA references a data structure of ClassB, but is not the +only reference + +- + +ClassA does not own ClassB + +- + +there is not a super-sub / parent-child relationship between +ClassA and ClassB +Wheel +Variables +Methods + +Car +engine: Engine[] +wheels: Wheel[] +Methods + +Engine +Variables +Methods + + CLASS ACTIVITY +- + +What does this UML tell you about the corresponding Java code? + +Polygon + ++ computeArea() + +Triangle + +Rectangle + +Variables + +Variables + +Methods + +Methods + + CLASS ACTIVITY +- + +What does this UML tell you about the corresponding Java code? +- + +We have three Java classes + +- + +Polygon is an abstract class + +- + +computeArea() is an abstract method + +- + +A Rectangle is-a Polygon +- + +- + +Rectangle extends Polygon + +Polygon + ++ computeArea() + +A Triangle is-a Polygon +- + +Triangle extends Polygon + +Triangle + +Rectangle + ++ computeArea() + ++ computeArea() + + VIOLET UML EDITOR +- + +A free, cross-platform UML editor +- + +You can get it here + +- + +We will be creating Class Diagrams + +- + +The UML diagram is saved as an html file and can be exported +as an image (*. png) file + + Save As *.html +file + + Save As *.png +file + + UML DIAGRAMS +- + +Unidirectional association +- + +- + +indicates dependency of only one class on another + +ClassA has a unidirectional association with ClassB implies +- + +ClassA uses and depends on ClassB, but ClassB does not +reference ClassA + +- + +at least one ClassB object is referenced in ClassA + +- + +there is an import statement in ClassA for ClassB + +- + +there is not an import ClassA statement in ClassB +Employee + +Date + +hireDate: Date + +Variables + +Methods + +Methods + + UML DIAGRAMS +- + +Bidirectional association +- + +- + +indicates codependency of two classes + +ClassA has a bidirectional association with ClassB implies +- + +both depend upon each other + +- + +at least one ClassB object is referenced in ClassA + +- + +at least one ClassA object is referenced in ClassB + +- + +there is an import statement in ClassA for ClassB + +- + +there is an import statement in ClassB for ClassA +UserProfile + +ProfilePicture + +profilePic: ProfilePicture + +userProfile: UserProfile + +Methods + +Methods + + UML DIAGRAMS +- + +Dependency relationship +- + +a generalized connection between two classes if other +relationships are not meaningful! + +- + +- + +We will primarily use it for classes referenced in main(). + +ClassA depends on ClassB implies one or more of the following +- + +at least one ClassB object is referenced in ClassA + +- + +there is an import statement in ClassA for ClassB + +- + +at least one class method in ClassB is called by ClassA +AccountTest + ++_main( args : String[] ) + +Account +Variables +Methods + + UML DIAGRAMS +- + +Dependencies and relationships between classes can be +- + +General Dependency relationship + +ClassA + +ClassB + +- + +Unidirectional association + +ClassA + +ClassB + +- + +Bidirectional association + +ClassA + +ClassB + +- + +Aggregation relationship + +ClassA + +ClassB + +- + +Composition relationship + +ClassA + +ClassB + +- + +Realization relationship + +ClassA + +ClassB + +- + +Generalization relationship + +ClassA + +ClassB + + UML DIAGRAMS +- + +You might see UML diagrams in different formats + + UML RESOURCES +- + +UML relationships & associations + +- + +UML.org + +- + +The UML 2 class diagram - IBM Developer + + DO YOU HAVE ANY +QUESTIONS? + +THANK +YOU! + +@ + +hend.alkittawi@utsa.edu + +By Appointment +Online + + \ No newline at end of file diff --git a/Summer-2024/CS-3443/Slides/txt/13_Design-Practice.txt b/Summer-2024/CS-3443/Slides/txt/13_Design-Practice.txt new file mode 100644 index 0000000..a637d09 --- /dev/null +++ b/Summer-2024/CS-3443/Slides/txt/13_Design-Practice.txt @@ -0,0 +1,60 @@ +Application +Programming +Hend Alkittawi + + Design Workshop +How to approach an app design! + + INTRODUCTION +Think about the +classes you need to +create for a Payroll +System application! +*Reference Document + + IMPORTANT + +At the design stage in an +object oriented system you +will often find that certain +classes are closely related. +You should factor out common +instance variables and +methods and place them in a +superclass, then use +inheritance to develop +subclasses, specializing them +with capabilities beyond +those inherited from the +superclass. + + DEMO +- + +UML diagram for the Payroll System in Chapter 10 + + Eclipse Hint! +- To automatically generate getters +and setters, right-click in the +code editor > Source > Generate +getters and setters. + +- This functionality is to save + +expert developers some time. Use +it when you are at that level! + + DO YOU HAVE ANY +QUESTIONS? + +THANK +YOU! + +@ + +hend.alkittawi@utsa.edu + +By Appointment +Online + + \ No newline at end of file diff --git a/Summer-2024/CS-3443/Slides/txt/14_Introduction-to-Android-and-Android-Studio.txt b/Summer-2024/CS-3443/Slides/txt/14_Introduction-to-Android-and-Android-Studio.txt new file mode 100644 index 0000000..fd8d8aa --- /dev/null +++ b/Summer-2024/CS-3443/Slides/txt/14_Introduction-to-Android-and-Android-Studio.txt @@ -0,0 +1,300 @@ +Application +Programming +Hend Alkittawi + + Android Development +Introduction to Android Studio and +Android Apps Anatomy + + GRAPHICAL USER INTERFACES (GUIs) +- + +Console app vs. Mobile app! +>> Enter employee name: Ryan +>> Enter employee title: Product +Manager +>> Enter hire date: 06-03-2018 + +Employee Management +Employee Name +Employee Title + +⏬ + +Employee Hire Date 📅 +Submit + + ANDROID STUDIO +- + +Android Studio is an integrated development environment (IDE) +for building Android apps + +- + +Download and install Android Studio here + +- + +Installing Android Studio includes +- + +Android SDK (Software Development Kit) + +- + +Android SDK tools and platform tools (for debugging & testing) + +- + +A system image for the Android emulator + +- + +JDK + + HELLO, ANDROID STUDIO! +- + +In Android Studio, create a new project +- + +Select “Phone and Tablet” template → next + +- + +Select “Empty Views Activity” (different from “No Activity”) → +next + +- + +- + +Package name: edu.utsa.cs3443.projectName → next + +- + +Language: Java → next + +- + +Minimum SDK: Android 8 (Oreo) + +- + +Finish → Finish + +Android Studio may need to install several things if this is +your first project - be patient and do not close the IDE until +it is finished! + + 1 + +2 + +3 + +4 + + Project tool window + +Editor tool window + + HELLO, ANDROID STUDIO! +- + +Layout Editor +- + +drag and drop views in the Design mode + +- + +view the xml code by clicking the Code button in the top left + + HELLO, ANDROID STUDIO! +- + +Resource: a piece of your app that is +not code (e.g. image files, audio, XML) + +- + +Layout: Defines a set of UI objects and +the objects’ positions on the screen + +- + +View: UI objects (View is a superclass +of all UI components) + +- + +Inflate: parse an XML layout resource +and convert it to a hierarchy of View +objects + + HELLO, ANDROID STUDIO! +- + +Activity: a class in the Android SDK which represents an entry point to into your +app and is responsible for managing user interactions with a screen of information +- + +Name your Activity class: + +SomeNameActivity.java + +- + +Name your layout file: + +activity_some_name.xml + +In this example: +MainActivity.java +and +activity_main.xml + + HELLO, ANDROID STUDIO! +- + +MainActivity.java (default template) +- + +onCreate() is called when an instance of the activity subclass is +created + +- + +setContentView() assigns this activity the UI it manages; it +inflates the layout & puts it on the screen, instantiating all views in +the layout file as defined by their attributes +package edu.utsa.cs3443.hello_world; +import androidx.appcompat.app.AppCompatActivity; +import android.os.Bundle; +public class MainActivity extends AppCompatActivity { +@Override +protected void onCreate(Bundle savedInstanceState) { +super.onCreate(savedInstanceState); +setContentView(R.layout.activity_main); +} +} + + ANDROID SDK +- + +Immediately after installing Android Studio for the first time it +is likely that only the latest released version of the Android SDK +has been installed. + +- + +To install older versions of the Android SDK simply select the +checkboxes corresponding to the versions and click on the Apply +button. + +- + +This task can be performed by clicking on the More Actions link +within the welcome dialog or by clicking the Preferences menu +option, then selecting the SDK Manager option from the drop-down +menu, +- + +select Android Oreo (8.0) + + CREATING A VIRTUAL DEVICE +- + +An Android application may be tested by installing and running +it either on a physical device or in an Android Virtual Device +(AVD) emulator environment. + +- + +As part of the standard Android Studio installation, several +emulator templates are installed allowing AVDs to be +configured for a range of different devices. + +- + +New AVDs are created and managed using the Android Virtual +Device Manager. +- + +Tools > Device Manager (or the + +icon) + + ANDROID DEVELOPMENT RESOURCES +● + +Our Textbook Forum +○ + +● + +Documentation +○ + +● + +● + +https://developer.android.com/ + +Newsgroups And Forums +○ + +https://stackoverflow.com/questions/tagged/android + +○ + +https://androidforums.com/ + +Development Tips +○ + +● + +https://forums.bignerdranch.com/ + +https://android-developers.googleblog.com/ + +Videos And Tutorials +○ + +https://www.youtube.com/user/androiddevelopers + + CODE DEMO +- + +Create a HelloWorld +Android Application +using Android Studio +and walk through the +project content! + + IMPORTANT + +Run the HelloWorld +Android App on your +machine and/or VDI +before the end of +the week! + + DO YOU HAVE ANY +QUESTIONS? + +THANK +YOU! + +@ + +hend.alkittawi@utsa.edu + +By Appointment +Online + + \ No newline at end of file diff --git a/Summer-2024/CS-3443/Slides/txt/16_MVC.txt b/Summer-2024/CS-3443/Slides/txt/16_MVC.txt new file mode 100644 index 0000000..56a3feb --- /dev/null +++ b/Summer-2024/CS-3443/Slides/txt/16_MVC.txt @@ -0,0 +1,312 @@ +Application +Programming +Hend Alkittawi + + MVC Architectural Pattern +Model-View-Controller Architectural +Pattern + + CODE DEMO +- + +Discuss the design of +a bank management app + + MODEL-VIEW-CONTROLLER +Welcome to UTSA Bank Management System +What would you like to do? +1. Display Accounts +2. Add Account +3. Remove Account +4. Exit +1 +Name: UTSA Bank +Account - name: Ash type: checking +Account - name: Sam type: saving +Account - name: Jen type: checking +Account - name: Mia type: saving +What would you like to do? +1. Display Accounts +2. Add Account +3. Remove Account +4. Exit +3 +Enter account name: +Mia +What would you like to do? +1. Display Accounts +2. Add Account +3. Remove Account +4. Exit +2 +Enter name and type: +Jim checking + +What would you like to do? +1. Display Accounts +2. Add Account +3. Remove Account +4. Exit +1 +Name: UTSA Bank +Account - name: Ash type: checking +Account - name: Sam type: saving +Account - name: Jen type: checking +Account - name: Jim type: checking +What would you like to do? +1. Display Accounts +2. Add Account +3. Remove Account +4. Exit +4 + + MODEL-VIEW-CONTROLLER + +Welcome to UTSA Bank +Management System + +What would you like to do? +View Accounts + +Welcome to UTSA Bank +Management System + +Welcome to UTSA Bank +Management System + +Welcome to UTSA Bank +Management System + +Here is a list of +accounts … + +Enter Account Name + +Enter Account Name + +Select Account type + +Add Account +Remove an Account + +Add Account + +Remove Account + + Welcome to UTSA BankManagement System +What would you like to do? +1. Display Accounts +2. Add Account +3. Remove Account +4. Exit +1 +Name: UTSA Bank +Account - name: Ash type: checking +Account - name: Sam type: saving +Account - name: Jen type: checking +Account - name: Mia type: saving +What would you like to do? +1. Display Accounts +2. Add Account +3. Remove Account +4. Exit +3 +Enter account name: +Mia +What would you like to do? +1. Display Accounts +2. Add Account +3. Remove Account +4. Exit +2 +Enter name and type: +Jim checking + + Welcome to UTSA Bank +Management System + +What would you like to do? +View Accounts +Add Account +Remove an Account + +Welcome to UTSA Bank +Management System + +Here is a list of +accounts … + + Welcome to UTSA Bank +Management System + +Welcome to UTSA Bank +Management System + +What would you like to do? + +Enter Account Name + +View Accounts + +Select Account type + +Add Account +Remove an Account + +Add Account + + Welcome to UTSA Bank +Management System + +What would you like to do? + +Welcome to UTSA Bank +Management System + +Enter Account Name + +View Accounts +Add Account +Remove an Account + +Remove Account + + MODEL-VIEW-CONTROLLER +- + +An architectural pattern captures the design structures of +various systems and elements of software so that they can be +reused. + +- + +Android applications can be designed around an architecture +called model-view-controller or MVC. + +- + +In MVC, all objects in your application must be a model +object, a view object, or a controller object. + +- + +MVC helps you design and understand an application, and makes +classes easier to reuse. + + MODEL-VIEW-CONTROLLER +- + +MVC is an architectural pattern which helps separate +- + +the application logic from the user interface + +- + +the control between the user interface and the application +logic + +model +data storage, +integrity, consistency, +queries & mutations + +controller +view +receive, interpret & +validate input, create & +update views, query and +modify models + +presentation assets & +code + +user + + MODEL +- + +The model represents the data and the rules that govern access +to and updates of this data, and the business logic + +- + +A model often serves as a software approximation of a +real-world process + +- + +Designed and implemented as one or more classes +- + +typically model the things your app is concerned with such as +a user, a product, a photo, at television show, … etc. + +- + +Model objects have no knowledge of the UI; its purpose is +holding and managing data. + + VIEW +- + +View objects know how to draw themselves on the screen + +- + +The view renders the contents of a model + +- + +The view specifies exactly how the model data should be +presented + +- + +If the model data changes, the view must update its +presentation as needed + +- + +Android provides a wealth of configurable view classes. You +can also create custom view classes. + + CONTROLLER +- + +Controller objects tie the View and Model objects together. +They contain application logic. + +- + +Controllers are designed to respond to various events +triggered by view objects and to manage the flow of data +between the model layer and the view layer. +- + +The controller translates the user's interactions with the +view into actions that the model will perform + +- + +In Android, a controller is typically a subclass of Activity, +Fragment, or Service. + +- + +Implemented as one or more classes + + DO YOU HAVE ANY +QUESTIONS? + +THANK +YOU! + +@ + +hend.alkittawi@utsa.edu + +By Appointment +Online + + \ No newline at end of file diff --git a/Summer-2024/CS-3443/Slides/txt/17_Android App Development - Rowdy Quiz V1.txt b/Summer-2024/CS-3443/Slides/txt/17_Android App Development - Rowdy Quiz V1.txt new file mode 100644 index 0000000..57ed02d --- /dev/null +++ b/Summer-2024/CS-3443/Slides/txt/17_Android App Development - Rowdy Quiz V1.txt @@ -0,0 +1,652 @@ +Application +Programming +Hend Alkittawi + + Android Development +Building Our First Android App + + OUR FIRST ANDROID APPLICATION +- + +What do you think we need to build this app? + +Rowdy Quiz + +Trivia Question Here + +True + +False +Next + + OUR FIRST ANDROID APPLICATION +- + +What do you think we need to build this app? +- + +- + +Model Objects +- + +Question.java + +- + +QuizBank.java + +View Objects +- + +- + +Rowdy Quiz + +layout xml file + +Controller Objects +- + +Trivia Question Here + +MainActivity.java +True + +False +Next + + OUR FIRST ANDROID APPLICATION + +Rowdy Quiz + +Trivia Question Here + +True + +False +Next + + OUR FIRST ANDROID APPLICATION +- + +Model Objects +- + +After you create the project in Android +Studio, create a model package + +- + +In edu.usta.cs3443.projectname +- + +right-click on the package + +- + +select New > Package + +- + +set the package name to model + +- + +create/place the model classes within +the model package + + OUR FIRST ANDROID APPLICATION +- + +View Objects +- + +layout xml file + +- + +Set up the layout (xml or drag and drop) +- + +Rowdy Quiz + +LinearLayout (Vertical) +- + +TextView - for Rowdy Quiz + +- + +TextView - for Trivia Question + +- + +LinearLayout (Horizontal) + +- + +- + +Button - for True + +- + +Button - for False + +Trivia Question Here + +True + +False + +Button - for Next + +Next + + TIPS FOR WORKING WITH LAYOUT XML FILES +- + +Views may have an integer id associated with them. These ids +are typically assigned in the layout XML files, and are used +to find specific views within the view tree. + +- + +Add id attributes for views that your code will be +interacting with + + + TIPS FOR WORKING WITH LAYOUT XML FILES +- + +Add strings to the string.xml resource file + +- + +res > values > strings.xml + +Rowdy Quiz +False +True +Next + + +- + +Use these strings with your views + + + + + + +