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
Add a clause for identifying the sibling relationship. The predicate on the left handside of the rule should be sibling(X, Y), s
jolli1 [7]

Answer:

following are the solution to this question:

Explanation:

For Siblings (X,Y);

Alice(X),

Edward(Y),

parent(Edward,Victoria,Albert) //Albert is the father F

parent(Alice,Victoria,Albert)  //Victoria is the Mother M

Therefore,

X is siblings of Y when;

X is the mother M and father is F, and  Y is the same mother and father as X does, and satisfing the given condition.

It can be written as the following prolog rule:

Siblings_of(X,Y):

parents(X,M,F)

parents(Y,M,F)

Siblings_of(X,Y): parents(X,M,F), parents(Y,M,F)

|? - sibling_of(alice,edward).

yes

|? - Sibling_of(alice,X).

X=Edward

|? - Sibling_of(alice,alice).

yes

5 0
3 years ago
I used the Pearson correlation coefficient for my study to test the correlation and how strong is the relationship between two v
slamgirl [31]

Answer: NO

Explanation:

6 0
3 years ago
Read 2 more answers
Xbox one is not turning on and power brick is orange why is that?​
NISA [10]

Answer:

the power supply is working fine but has been set to energy-saving power mode.

Explanation:

A steady orange light on the power brick means that the power supply is working fine but has been set to energy-saving power mode. This happens as a safety precaution when a power surge is detected. In order to fix this, you must first unplug the power brick from both the Xbox one and the wall socket. Next, you have to leave the power brick disconnected for about 30 seconds to a minute so that the energy completely fades. Finally, plug back in the cable and restart your console. It should now have a steady white light and be back to functioning perfectly.

5 0
3 years ago
​ In a systems development life cycle (SDLC) model, the purpose of the _____ is to build a logical model of the new system.
faust18 [17]

Answer:

Systems analysis phase.

Explanation:

In a systems development life cycle (SDLC) model, the purpose of the systems analysis phase is to build a logical model of the new system.

In the systems analysis phase, the system developer examines or analyzes the information or data about the requirements of an end-user, which are then implemented to achieve the organizational set goals and objectives.

Hence, systems analysis refers to the process of gathering data or factual informations, understanding processes, problem identification and suggestions of probable solutions for an effective and efficient functioning of the system.

4 0
3 years ago
Why is democracy the best form of government
julia-pushkina [17]

Democracy is the best form of government simply because no other form of government is known to work well. Democracy may have its flaws but all in all it .

3 0
3 years ago
Other questions:
  • What is value parameter and reference parameter while things are passed by Also, do a c code to show it
    13·1 answer
  • What kind of user training should be conducted to deal with the issue of noise. How do you strike a balance between being overwh
    12·1 answer
  • It is perhaps not surprising that Etsy was an early adopter of DevOps. It is a relatively small company, with a start-up culture
    7·1 answer
  • A palindrome is any word, phrase, or sentence that reads the same forward and backward. Here are some well-known palindromes: Ab
    11·1 answer
  • Greg works outside. He is often found cutting grass and making the local park grounds look nice for guests.
    10·1 answer
  • What is 4x+2x(-3-3) thanku
    11·2 answers
  • To print photographs in color.​
    7·1 answer
  • Do you agree that technology is always at the advantageous side wherein it only results in good things?
    14·1 answer
  • Selection Sort List the resulting array after each iteration of the outer loop of the selection sort algorithm. Indicate the num
    10·1 answer
  • Service provided by multiple servers acting in parallel is referred to as: a. Multiple-phase queuing system b. Multiple-channel
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!