CSE 122 Spring 2023: ArrayList Lecture Overview and Example Program - Movie Favorites

Slide Note
Embed
Share

In this CSE 122 lecture for Spring 2023, the instructors Tristan Huber and Hunter Schafer introduced ArrayLists, covered announcements, and presented a practice problem highly relevant for the course. They discussed the addAll method, techniques for functional decomposition, and key skills for iterative development using ArrayList methods. The session also included an example program, MovieFavorites.java, which manages a user's list of favorite movies using an ArrayList and allows various operations to be performed on the movie list.


Uploaded on Oct 02, 2024 | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. Download presentation by click this link. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

E N D

Presentation Transcript


  1. LEC 02: ArrayList CSE 122 Spring 2023 BEFORE WE START Talk to your neighbors: What s your all-time favorite album? LEC 02 ArrayList ArrayList More ArrayLists! Instructors Tristan Huber & Hunter Schafer TAs Ambika Andrew Audrey Autumn Ayush Ben Colton Di Eesha Elizabeth Evelyn Jacob Jaylyn Jin Joe Kevin Leon Megana Melissa Mia Poojitha Rishi Rucha Shivani Shreya Steven Suhani Yijia Ziao Questions during Class? Raise hand or send here sli.do #cse122

  2. LEC 02: ArrayList CSE 122 Spring 2023 Lecture Outline Announcements Warm Up Large Practice Problem - (highly relevant for C0)

  3. LEC 02: ArrayList CSE 122 Spring 2023 Announcements Quiz 0 next Tuesday - Topics: ArrayLists, Functional Decomp Creative Assignment 0 (C0) out this morning - due next Thursday, 4/13 @11:59pm P0 was due last night - Expect grades in about a week

  4. LEC 02: ArrayList CSE 122 Spring 2023 Lecture Outline Announcements Warm Up Large Practice Problem - (highly relevant for C0)

  5. LEC 02: ArrayList CSE 122 Spring 2023 addAll Write a method called addAllthat accepts two ArrayLists of Characters mainList and otherList and an integer location as parameters and inserts all of the elements from otherList into mainList at the specified location. https://edstem.org/us/courses/37899/lessons/58237/slides/326839

  6. LEC 02: ArrayList CSE 122 Spring 2023 Lecture Outline Announcements Warm Up Large Practice Problem - (highly relevant for C0)

  7. LEC 02: ArrayList CSE 122 Spring 2023 Example - Movie Favorites Key skills from this example: User Interaction (UI) loop Iterative development strategies Functional decomp Practice with ArrayList methods

  8. LEC 02: ArrayList CSE 122 Spring 2023 Movie Favorites We will write a program called MovieFavorites.java that manages a list of favorite movies for a user (using an ArrayList) and allows the user to perform various different operations on their stored list of favorite movies.

  9. LEC 02: ArrayList CSE 122 Spring 2023 Movie Favorites Operations Load a list of favorites in from a file provided by the user. Report the top n favorites according to the list, where the user can specify n. Move a specific favorite down in the list Add a list of favorites in a user-provided file to the stored list of favorites at a specified location. Save the current list of favorites to a file provided by the user.

  10. LEC 02: ArrayList CSE 122 Spring 2023 Movie Favorites: Development Strategy Set up main scaffold code Menu loop Each behavior, one at a time You ll see a similar development strategy in Creative Project 0 s specification we recommend you follow it!

  11. LEC 02: ArrayList CSE 122 Spring 2023 Movie Favorites Operations Load a list of favorites in from a file provided by the user. Report the top n favorites according to the list, where the user can specify n. Move a specific favorite down in the list Add a list of favorites in a user-provided file to the stored list of favorites at a specified location. Save the current list of favorites to a file provided by the user.

  12. LEC 02: ArrayList CSE 122 Spring 2023 Movie Favorites Operations Load a list of favorites in from a file provided by the user. Report the top n favorites according to the list, where the user can specify n. Move a specific favorite down in the list Add a list of favorites in a user-provided file to the stored list of favorites at a specified location. Save the current list of favorites to a file provided by the user.

  13. LEC 02: ArrayList CSE 122 Spring 2023 PrintStream Allows us to print to an output file. PrintStream output = new PrintStream(new File("output.txt")); output.print("hi"); output.println("hello");

  14. LEC 02: ArrayList CSE 122 Spring 2023 Movie Favorites - Extension w/Feature Flag When EXTENSION_FLAG is true, in addition to the usual operations, a user can: Compare the stored list of favorites to another list of favorites provided by the user in file.

Related


More Related Content