Lab 8 - Strings CSE 110 Principles of Programming with Java Spring 2021 Due April 4th 2021, 11:59PM Arizona Time 1 Lab Objectives The following objectives will be met at the end of this lab - •...

1 answer below »
Please find attached Lab 8 instructions for solution guidance



Lab 8 - Strings CSE 110 Principles of Programming with Java Spring 2021 Due April 4th 2021, 11:59PM Arizona Time 1 Lab Objectives The following objectives will be met at the end of this lab - • Declare and define String objects • Find the length of a String object • Use various String functions • Perform String manipulation 1.1 Lab Objectives The source code file Lab8.java that you will create in this section, is what you will upload as your submission file to Canvas by the due date for this lab. Please ensure that the source code runs on your machine and produces the correct output as required. Overall Objective: For this lab, you will accept two Strings from the user and then perform the following operations on them - find the length of the two Strings, determine if they are uppercase, lowercase or mixed case Strings and finally you will check if the two user-input Strings are equal or not. For this section, you will create a new project in your IDE called Lab8 and create a source file called Lab8.java inside that project. The following requirements must be met to successfully complete this section - Obj.1 [1 point] Within the main() function create an object of the Scanner class for user input. Obj.2 [2 points] Within the main() function, create two String objects to hold the user input. Obj.3 [2 points] Within the main() function, accept two Strings from the user using the Scanner object. Obj.4 [2 points] Within the main() function, determine and display the length of the two user-input String objects. Obj.5 [5 points] Within the main() function, determine if the user input Strings are alphanumeric or if they contain any special characters in them. Display a message letting the user what type of Strings have been entered. Obj.6 [(2+4) points] Define a static boolean function called compareStrings(String s1, String s2) that returns true if the Strings s1and s2 are the same. Obj.7 [2 points] Within the main()function, call the function compareStrings(...) to compare and display if the two user input Strings are the same or not. Note: You can use extra functions as you see fit. There is no limitation on how many functions you use to achieve the end result. Once you are done editing your source code, make sure to save it (save often to prevent loss of data and work) and then compile your source code. The next step is to follow the submission guidelines in Section 2 of this document and turn your lab in. 1.2 Comment Header Please include the following comment lines at the top of your Lab8.java file. Make sure you fill in the required fields as well. Listing 1: Comment Header 1 // ================================================ 2 // Lab8 . java 3 // Name : 4 // ASU ID : 5 // Time taken to complete t h i s lab : 6 // ================================================ 2 Submission Guidelines Please follow the guidelines listed below prior to submitting your source code file Lab8.java on Canvas - 1. Make sure that your source code file is named as Lab8.java prior to submitting. 2. Make sure that you have completed all the objectives listed in section 1.1. 3. Include the completed comment header shown in section 1.3 at the top of your source code file 4. Submit your Lab8.java file only to the Canvas link for Lab 8 by April 4th 2021, 11:59PM Arizona Time. 3 Grading Rubric As noted in Section 1.1, each of the seven objectives have their own points. They are independent of each other and you will be scored for each objective that you complete successfully. Partial points will be awarded for partially completing objectives. 1 Lab Objectives Lab Objectives Comment Header Submission Guidelines Grading Rubric
Answered Same DayApr 02, 2021

Answer To: Lab 8 - Strings CSE 110 Principles of Programming with Java Spring 2021 Due April 4th 2021, 11:59PM...

Aditya answered on Apr 03 2021
160 Votes
// ================================================
// Lab8.java
// Name :
// ASU ID :
// Time t
aken to complete this lab :
// ================================================
import java.util.Scanner;
public class Lab8 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in); // creating a scanner object
        
        // creating two string object
        String userFirstInput;
        String userSecondInput;
        
        //taking input from user
        System.out.print("Enter first string: ");
        userFirstInput = scanner.nextLine();
        
        System.out.print("Enter second string: ");
        userSecondInput = scanner.nextLine();
        // Dislpaying length of both string
        System.out.println("Length of first string: "+userFirstInput.length());
        System.out.println("Length of second string: "+userSecondInput.length());
        
        // cheking for alphanumeric and...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here