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]
3 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]3 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
The handle in a selected object’s upper-left corner is the ___________handle.
Lynna [10]

Answer: Move handle

Explanation: In the field of the database, the unique identifier for an object is created that is known as handle which is for the driving purpose in the database.It is also used for the connection of the database .The object in the database containing data keeps the management of the handle.

It has a handle named move handle ,which is responsible for the movement control of upper left corner in an object.It is in a large in form for the dragging of the object that is selected.

6 0
4 years ago
When Tomohiro Nishikado invented Space Invaders® in 1978, the microcomputers available in Japan could not handle its initial com
Burka [1]
B the need to import items for any technology to really work
8 0
2 years ago
Read 2 more answers
What technology will I use when I become a surgical technologist?
otez555 [7]

Explanation:

Preoperative: Sterile Hands

The surgical technologist is the first person to enter the OR before surgery. During this preoperative phase the surgical technologist adheres closely to the following routine:

Carefully dons his or her operating room attire, including scrubs

Begins to prepare and sterilize the room

Gathers all of the equipment and surgical tools that the surgery requires

Sterilizes, counts and carefully arranges them

The most important part of this preoperative phase is creating and maintaining the OR’s sterile environment. Sterile fields can be compromised in a variety of ways, the most common of which is by introducing moisture. To prevent this, the surgical technologist is responsible for arranging dry drapes around the operating table and keeping all surfaces in a sterile condition.

Intraoperative: The Third Hand

During the intraoperative phase of the surgery, surgical technologists are still responsible for maintaining the sterility of the OR, but they also effectively become a “third hand” to the surgeon and surgeon’s assistant during the procedure and perform the following tasks:

Help prepare medications and administer them to the patient

Assist in retracting tissues from the patient

Passes the surgical tools to the surgeon and surgical assistant during the operation

At any time during an operation, if a tool is missing or contaminated, the delay or resulting infection could cost a patient his or her life. That is why surgical technologists must be diligent and thorough at all times.

Postoperative: Tying Things Up

As the operation concludes, surgical techs are responsible for the following:

Counting all of the tools and instruments used during surgery to ensure that nothing is left behind in a patient

Suture the incision and apply disinfected dressings to the area

Dispose of items such as needles and gauze, and continue to maintain the OR’s sterile environment until the patient is sent to the recovery ward

Thinking-On-Your-Feet: Cell Phones in the OR

While surgical techs aren’t expected to work miracles, they must be able to think quickly on their feet in emergency situations. During a recent hospital blackout and emergency generator failure, one quick-thinking surgical tech, with the help of the patient’s family member, rounded up enough cell phones to illuminate the OR while surgeons completed an emergency appendectomy.

3 0
3 years ago
Read 2 more answers
Can you see what movie you went to on yout credit card history
KatRina [158]
The answer is no
-hope this helped-

3 0
4 years ago
Read 2 more answers
Can someone tell me what all of these are?
Allisa [31]

Answer:

parts of a camera

Explanation:

5 0
4 years ago
Other questions:
  • A data structure used to bind an authenticated individual to a public key is the definition of ________.
    14·1 answer
  • State what is meant by the terms: Parallel data transmission ...................................................................
    8·1 answer
  • What is a graphical user interface (GUI)?
    10·1 answer
  • Point out the wrong statement:
    7·1 answer
  • Write a Python program stored in a file q1.py to play Rock-Paper-Scissors. In this game, two players count aloud to three, swing
    13·1 answer
  • In the lungs,blood picks up carbon dioxide and releases oxygen true or false
    7·1 answer
  • I’ll mark brainlest
    14·2 answers
  • CLS
    12·1 answer
  • A user wants to print a spreadsheet horizontally on a piece of paper instead of vertically to fit more columns on a single page.
    15·1 answer
  • Lookups comes before Tags in the search-time operation sequence. True or False: Lookups can reference Tags.
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!