CSCE A201 Computer Programming I Lab 1 Lab Assistants: Deanna Flynn Elisha Waugh Goals for Today • File types (.java, .java~, .class) • Keyboard input • Arithmetic practice • Casting Programming Assignments • Which of these files should you submit? – .java~ – .java – .class • Windows explorer defaults to hide file extensions – Check box under View > File name extensions • Zip all of your .java files together for submitting to Blackboard • If you are using NetBeans, please zip your entire project folder for grading • If file right‐click > Send to > Compressed (zipped) folder option is missing, try to delete Bluetooth entry from your SendTo folder File Management • You are responsible for managing your programming files • Can do this using… – Google drive with UAA email account – Thumb drive – Email (not recommended) Using the Scanner Class • Before the class definition, add: import java.util.Scanner; • Create an object of the Scanner class: Scanner keyboard = new Scanner (System.in) • Read data (an int or a double, for example) int n1 = keyboard.nextInt(); double d1 = keyboard.nextDouble(); Some Scanner class methods Lab 1 Exercises 1. Complete the temperature conversion Lab Exercise in your ZyBook, Section 19.1 2. Use the Scanner class to read input from the user and perform type casting before printing the value to the screen: – read an int and cast it to a double – read an int and cast it to a byte • test the ints 125‐130 – read an int and cast it to a char – read a double and cast it to an int Be sure to use meaningful prompts to the user, and meaningful outputs that explain each cast 3. Work on ZyBook Challenge Activities for Chapters 1 & 2