Important Updates and Reminders for CSE 121 Spring 2023

Important Updates and Reminders for CSE 121 Spring 2023
Slide Note
Embed
Share

Get ready for Quiz 2, scheduled for tomorrow! Don't miss out on retake opportunities and the upcoming Creative Project 2 deadline. Stay informed about study participation and the final exam. Find valuable formative feedback and tips for handling file I/O exceptions in your Java programs.

  • CSE 121
  • Spring 2023
  • Reminders
  • Java Programming
  • Quiz

Uploaded on Mar 20, 2025 | 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.If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.

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.

E N D

Presentation Transcript


  1. CSE 121 Lesson 14 Miya Natsuhara Spring 2023 Music: 121 23sp Lecture Vibes TAs: Jasmine Shananda Vidhi Larry Jacqueline Afifah Atharva Julia Anju Lydia Jonus Hugh Mia Archit Grace Kailye Joshua James Justin Aishah Claire Lydia Kai sli.do #cse121

  2. Announcements, Reminders Quiz 2 tomorrow (Thursday, May 18) in quiz sections While loops, user input Quiz Retakes May 23 Form will be posted soon Quiz 1 and Quiz 2 will be eligible for retake (last opportunity for Quiz 1) Creative Project 2 will be released later tonight Due Tuesday May 23 Study Participation Opportunity! Reminder: Final exam Thursday, June 8 2:30pm-4:20pm Lesson 14 - Spring 2023 2

  3. Formative Feedback: Closing the Loop The Good Resubmission and Retake Opportunities Pre-Class Work In-Class Demos Quiz Sections IPL Lesson 14 - Spring 2023 3

  4. Formative Feedback: Closing the Loop Suggestions More practice problems for Quizzes Assignment specification improvements Gradebook Lesson 14 - Spring 2023 4

  5. Formative Feedback: Closing the Loop Reminders Practice Problems & Resources tab Slides from Quiz Section Resubmission Deadlines Lesson 14 - Spring 2023 5

  6. (PCM) Scanner & File for File I/O File newFile = new File("newFile.txt"); Scanner fileScan = new Scanner(newFile); File is defined in the java.io package import java.io.*; Scanner Methods Description Reads the next token from the user as an int and returns it nextInt() Reads the next token from the user as a double and returns it nextDouble() Reads the next token from the user as a String and returns it next() Reads an entire line from the user as a String and returns it nextLine() Returns true if the next token can be read as an int, false otherwise hasNextInt() Returns true if the next token can be read as a double, false otherwise hasNextDouble() Returns true if there is another token of input to be read in, false otherwise hasNext() Returns true if there is another line of input to be read in, false otherwise hasNextLine() Lesson 14 - Spring 2023 6

  7. (PCM) Checked Exceptions If you try to compile a program working with file scanners, you may encounter this error message: error: unreported exception FileNotFoundException; must be caught or declared to be thrown To resolve this, you need to be throws FileNotFoundException at the end of the header of any method containing file scanner creation code, or any method that calls that method! This is like signing a waiver and telling Java "Hey, I hereby promise to not get mad at you when you bug out and crash my program if I give you a file that doesn't actually exist." Lesson 14 - Spring 2023 7

  8. (PCM) Typical Line-Processing Pattern while (fileScan.hasNextLine()) { String line = fileScan.nextLine(); // do something with line } Lesson 14 - Spring 2023 8

  9. (PCM) Typical Token-Processing Pattern while (fileScan.hasNext__()) { __ nextToken = fileScan.next__(); // do something line nextToken } Lesson 14 - Spring 2023 9

  10. (PCM) Typical Hybrid Pattern while (fileScan.hasNextLine()) { String line = fileScan.nextLine(); Scanner lineScan = new Scanner(line); while (lineScan.hasNext__()) { __ nextToken = lineScan.next__(); // do something with nextToken } } Lesson 14 - Spring 2023 10

Related


More Related Content