NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io


import java.util.Scanner;

public class Final10Percent {

public static Scanner numscan = new Scanner(System.in);
public static Scanner wordscan = new Scanner(System.in);

public static void main(String[] args) {

String wordOne;
String wordTwo;
int choice = 0;
boolean result;
int result2;

while (true) {

System.out.println();
System.out.println("Please choose an option: n 1. containsIgnoreCase n 2. 'The' Counter n 3. StringEquals n 4. AdditionEvaluator n 5. Exit");
System.out.println();

choice = numscan.nextInt();

if (choice == 1) {
System.out.println();
System.out.println("Please enter the first word");
wordOne = wordscan.nextLine();
System.out.println("Please enter the second word");
wordTwo = wordscan.nextLine();

result = containsIgnoreCase(wordOne, wordTwo);

System.out.println(result);
System.out.println();
}

if (choice == 2) {
System.out.println();
System.out.println("Please enter your sentence");
wordOne = wordscan.nextLine();

String[] sentence = wordOne.split("\s+");

System.out.println(counter(sentence));
System.out.println();
}

if (choice == 3) {
System.out.println();
System.out.println("Please enter the first sentence");

wordOne = wordscan.nextLine();
String[] sentence = wordOne.split("");

System.out.println("Please enter the second sentence");
wordTwo = wordscan.nextLine();
String[] sentenceTwo = wordTwo.split("");

System.out.println(stringEquals(sentence, sentenceTwo));
System.out.println();
}

if(choice == 4){

System.out.println();

System.out.println("Please enter an addition statement in the format `x + y = z`");

wordOne = wordscan.nextLine();
String[] sentence = wordOne.split("\s+");

System.out.println(additionEvaluator(sentence));

System.out.println();

}

if(choice == 5){

break;

}

}

}//end main

public static boolean containsIgnoreCase(String s1, String s2) {

boolean match = false;

if (s1.toLowerCase().contains(s2.toLowerCase()) || s2.toLowerCase().contains(s1.toLowerCase())) {

match = true;

}

return match;

}

public static int counter(String[] s1) {

int counter = 0;

for (int i = 0; i < s1.length; i++) {

if (s1[i].toLowerCase().contains("The".toLowerCase())) {

counter++;
}

}

return counter;
}//end counter

public static String stringEquals(String[] s1, String[] s2) {

for (int i = 0; i < s1.length; i++) {

if (s1.length == s2.length) {

if (s1[i].equals(s2[i])) {

return "Strings are equal";
}

}

}

return "Strings are not equal";

}//stringEquals

public static boolean additionEvaluator(String[] s1){

System.out.println(Integer.parseInt(s1[0]) + Integer.parseInt(s1[2]));


if(Integer.parseInt(s1[0]) + Integer.parseInt(s1[2]) == Integer.parseInt(s1[4])){

return true;

}

return false;
}

}//end class

     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.