Answered step by step
Verified Expert Solution
Question
1 Approved Answer
java questions. will like For the Employee Class Program in the Company Employee Program tutorial, imagine you need to add in a way to update
java questions. will like For the Employee Class Program in the Company Employee Program tutorial, imagine you need to add in a way to update the salary based on an input of "upd" and the employee ID. What code segment would need to be added to the while loop in the main method to implement this? a.) else if(cmd.tolowercase() . equals("upd")) \{ System.out.print("Employee ID to update: "); int emplid = input.nextInt(); input.nextline(); updateEmployees(emplId); else if(cmd.tolowercase() . equals("upd")) \{ updateEmployees(csvFile); \} else if(cmd.tolowercase().equals("upd")) \{ System.out.print("Employee ID to update: "); int emplId = input.nextInt(); input.nextline(); updateEmployees(csvFile, emplId); \} else if(cmd,tolowercase(). equals ("update")) \{ input.nextline(); updateEmployees(csvFile, emplId); \} A file was created under the /home/runner/IntrotoJava/ folder named myFile.txt. Assume that you have a File object named testFile pointed to the file. Which segment of code will output: /home/runner/IntrotoJava/myFile.txt a.) System.out.println(testFile.getPath()); b.) System.out.println(testFile); System. out.println(testFile.getPath()); System.out.println(testFile); System.out.println(testFile.getAbsolutePath()); System, out.println(testFile.getName()); Assume that the output txt file contains: First Line Given the following snippet of code: File output = new File("output.txt"); try \{ Files.writestring(output.topath(), "Second Line", standardopenoption.CREATE); Files.writestring(output.topath(), "Third Line", standardopenoption. CREATE); \} catch(IOException ex) \{ system.out.println("Error: " + ex.getMessage()); \} What would output txt contain? a.) Third Line b.) First Line c.) Second Line Third Line d.) First Line Second Line Third Line A myfile.txt has the following lines of text, with each line of text having a new line after it: Roses are red Violets are blue Given the following snippet of code: File output = new File("ayfile.txt"); try \{ Files.uritestring(output,toPath(), "Sugar is sweetln", standardopenoption. CREATE, standardopenoption. APPEND); \} catch(IoException ex) \& System.out.printlin("Error: " + ex.getMessage()); \} What would the myfile bxt contain after the code is run? o.) Roses are red Violets are blue b.) Sugar is sweet c.) Roses are red Violets are blueSugar is sweet d.) Roses are red Violets are blue Sugat is sweet
java questions. will like
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started