Best writers. Best papers. Let professionals take care of your academic papers

Order a similar paper and get 15% discount on your first order with us
Use the following coupon "FIRST15"
ORDER NOW

Chapter 2 Notes

System.out.println(secondVerse);return;}}2.13.1: String with digit.Set hasDigit to true if the 3-character passCode contains a digit. public class CheckingPasscodes {public static void main (String [] args) {boolean hasDigit = false;String passCode = “”;int valid = 0;passCode = “abc”;if (Character.isDigit(passCode.charAt())) { hasDigit = true;} if (Character.isDigit(passCode.charAt(1))) { hasDigit = true;} if (Character.isDigit(passCode.charAt(2))) { hasDigit = true; }

if (hasDigit) {System.out.println(“Has a digit.”);}else {System.out.println(“Has no digit.”);}return;}}2.13.2: Whitespace replace.Write code to print the location of any space in the 2-character string passCode. Each space detected should print a separate statement followed by a newline. Sample output for the given program:Space at 1import java.util.Scanner;public class FindSpaces {public static void main (String [] args) {String passCode = “”;passCode = “A “;if (Character.isWhitespace(passCode.charAt(0)) && Character.isWhitespace(passCode.charAt(1))) {System.out.println(“Space at 0”);System.out.println(“Space at 1”);} else if (Character.isWhitespace(passCode.charAt(0))) { System.out.println(“Space at 0”);} else if (Character.isWhitespace(passCode.charAt(1))) {

System.out.println(“Space at 1”);} else {}return;}}

 
Looking for a Similar Assignment? Order now and Get 10% Discount! Use Coupon Code "Newclient"