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
kirill115 [55]
3 years ago
14

Write a fragment of code that will read words from the keyboard until the word done is entered. For each word except done, repor

t whether its first character is equal to its last character. For the required loop, use a:_________.
a) while statement.
b) do-while statement.
Computers and Technology
1 answer:
hram777 [196]3 years ago
8 0

Answer:

a)

Scanner keyboard = new Scanner(System.in);

System.out.println("Enter a word");

String word = keyboard.next();

while(!word.equals("done"))

{

if(word.charAt(0) == word.charAt(word.length() - 1))

{

System.out.println("First and last character are equals for the word: " + word);

}

else

{

System.out.println("First and last character are NOT equals for the word: " + word);

}

word = keyboard.next();

}

b)

Scanner keyboard = new Scanner(System.in);

System.out.println("Enter a word");

String word = keyboard.next();

do

{

if(word.charAt(0) == word.charAt(word.length() - 1))

{

System.out.println("First and last character are equals for the word: " + word);

}

else

{

System.out.println("First and last character are NOT equals for the word: " + word);

}

word = keyboard.next();

}while(!word.equals("done"));

Next time note what language you are distributing programming with :)

You might be interested in
Worksheet titles and subtitles should be as wordy as possible.<br> a. True<br> b. False
Maru [420]
B) false, as you want them to be as simple as you can... the 'wordy' part comes underneath said title :)
5 0
3 years ago
Read 2 more answers
Bunch of points!!!!!!! help pls
alex41 [277]
Most likely B. Photographs.

Hope this helps!

Have a good day!
4 0
3 years ago
Read 2 more answers
Font size, font style, and _______ are all aspects of character formatting.
mel-nik [20]
The answer, im prettysure, is d. typeface.
hope this helps (:

6 0
3 years ago
Read 2 more answers
How do I cancel a friend request?
dusya [7]

Answer:

By pushing cancel

Explanation:

It's simple

3 0
3 years ago
Read 2 more answers
What email server does Global Enterprises use?
harina [27]

Answer:

Global Enterprises uses an open source mail server called Courier.

Explanation:

6 0
3 years ago
Other questions:
  • Write a converter program for temperatures. This program should prompt the user for a temperature in Celsius. It should then con
    10·1 answer
  • 20 Points!! Please hurry!!
    9·1 answer
  • Modern ssds use a technique called "____" to spread write operations around the storage medium, thus evening out the impact of d
    13·1 answer
  • Subana is writing a program which will calculate the mean average of a set of numbers by adding the numbers and dividing the res
    11·2 answers
  • The ash and dust from a volcanic eruption can cause a ______ change in the environment.
    8·1 answer
  • If two egg cells are fertilized what will happen?
    10·1 answer
  • Write a function called has_duplicates that takes a string parameter and returns True if the string has any repeated characters.
    7·1 answer
  • Where ....................... the books that you borrowed? *
    5·1 answer
  • Write any one method to delete a table in writer​
    11·1 answer
  • A hard drive cannot be partitioned until the device <br> is set.
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!