1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Ivahew [28]
4 years ago
10

Problem 1: you must write a method for this problem called sentenceAnalyzer Write a program that reads a sentence from the keybo

ard. Depending on the last character of the sentence, generate output identifying the sentence as declarative (ends with a period), interrogative (ends with a question mark), exclamatory (ends with an exclamation point), or unknown.
Computers and Technology
1 answer:
forsale [732]4 years ago
8 0

Answer:

   static void sentenceAnalyzer(String sentence){

       int lenOfString = sentence.length()-1;

   

           if(sentence.charAt(lenOfString)=='.'){

               System.out.println("Declarative");

             

           }

           else   if(sentence.charAt(lenOfString)=='?'){

               System.out.println("Interrogative");

             

           }

           else if(sentence.charAt(lenOfString)=='!'){

               System.out.println("Exclamation");

             

           }

           else{

               System.out.println("Unknown");

             

           }

   

   }

Explanation:

Using Java programming language

Create the method as required

Obtain the index of the last element using the string length method

Use if and else statements to check if the character at the last index is equal to any of the characters given and print the expected output

see a complete code with the main method below

<em>import java.util.Scanner;</em>

<em>public class num11 {</em>

<em>    public static void main(String[] args) {</em>

<em>        Scanner in = new Scanner(System.in);</em>

<em>        //Receiving User input</em>

<em>        System.out.println("Enter a sentence");</em>

<em>        String sentence = in.nextLine();</em>

<em>        // Calling the method</em>

<em>        sentenceAnalyzer(sentence);</em>

<em>    }</em>

<em>    static void sentenceAnalyzer(String sentence){</em>

<em>        int lenOfString = sentence.length()-1;</em>

<em />

<em>            if(sentence.charAt(lenOfString)=='.'){</em>

<em>                System.out.println("Declarative");</em>

<em>            }</em>

<em>            else   if(sentence.charAt(lenOfString)=='?'){</em>

<em>                System.out.println("Interrogative");</em>

<em>            }</em>

<em>            else if(sentence.charAt(lenOfString)=='!'){</em>

<em>                System.out.println("Exclamation");</em>

<em>            }</em>

<em>            else{</em>

<em>                System.out.println("Unknown");</em>

<em>            }</em>

<em>    }</em>

<em>}</em>

<em />

You might be interested in
Which very high-speed fiber network was already in place and being used for wide area networking (wan) transmissions, before the
Stolb23 [73]

The high-speed fiber network that is already in place and being used for wide area networking (wan) transmissions, before the IEEE developed the 10gbe ethernet standards is called SONET.

<h3>What does SONET stand for in networking?</h3>

SONET  is known to be a term that is called Synchronous Optical Network.

This is said to be defined as a standard  that is known to be used in linking or in the act of connecting fiber-optic transmission systems and it is one that is sold in North America only.

Therefore, The high-speed fiber network that is already in place and being used for wide area networking (wan) transmissions, before the IEEE developed the 10gbe ethernet standards is called SONET.

Learn more about fiber network from

brainly.com/question/26259562
#SPJ1

8 0
2 years ago
True and false 1. Trace topology is also referred to as tree bus topology. ​
algol13

Answer:

Trace topology is also referred to as tree bus topology.

Explanation:

6 0
2 years ago
Question # 4
bezimeni [28]

Answer:

the last one I think not 100% sure

6 0
4 years ago
How can you use Word in order to edit and print documents ?
AleksandrR [38]

Answer:

in word, you go to the File tab on a document, then click print, or enter the keyboard shortcut: ctrl+p

to edit a downloaded document, open the document, and on the top of the document, click "enable editing"

Explanation:

hope this helps!

4 0
3 years ago
Question 1(Multiple Choice Worth 5 points)
aleksley [76]

Answer:

b

Explanation:

it's not a c or d and now I have to make it 20 characters long so I will do this

3 0
3 years ago
Read 2 more answers
Other questions:
  • Machine language is made up of which following codes
    11·1 answer
  • For each of the following six program fragments: a) Give an analysis of the running time (Big-Oh will do). b) Implement the code
    5·1 answer
  • what is the software that controls the storage, retrieval and manipulation of database stored in a database
    14·1 answer
  • Dillion’s company has decided it wants to find a way to do a better job of tracking clothing inventories. Dillon has been asked
    5·1 answer
  • What kind of storage is an internet service that provides storage to computer users?
    12·1 answer
  • What is the main type of energy used to help convert metamorphic rocks into igneous rocks in the rock cycle ?
    10·1 answer
  • Having friends who cause you stress can decrease your happiness, which can in turn
    13·2 answers
  • Select the correct navigational path to edit the name of a cell range using name manager
    12·2 answers
  • Lyla is writing a program that uses a recursive method. Why might she want to use a recursive helper method?
    8·1 answer
  • many police departments coordinate youth-oriented programs as part of their prevention efforts. which of the following is not an
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!