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
The user will input a three digit number
zlopas [31]

import java.util.Scanner;

public class U1_L5_Activity_One {

public static void main(String[] args) {

Scanner scan = new Scanner(System.in);

System.out.print("Please enter a two digit number: ");

int x = scan.nextInt();

System.out.println("Here are the digits:");

System.out.println(x/100);

System.out.println((x/10)%10); <em>//Just divide the result by 10 and find the remainder</em>

System.out.println(x%10);  

}

}

<em>//Or, you can do that way:</em>

<em />

import java.util.Scanner;

 

public class U1_L5_Activity_One {

public static void main(String[] args) {

Scanner scan = new Scanner(System.in);

System.out.print("Please enter a two digit number: ");

String[] x = scan.nextLine().split(""); <em>//We need it to be a string array, to split the values after "", that is, after each symbol(number)</em>

System.out.println("Here are the digits:");

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

          System.out.println(Integer.parseInt(x[i])); <em>//Converting the string into int, as you want</em>

      }  

}

}

5 0
2 years ago
Why was packet-switching an advancement over previous forms of networking?
Elina [12.6K]

The answer should be B tell me if I'm wrong.


8 0
2 years ago
Read 2 more answers
Add my epic games account "Lil Carr OXB" and if that not work, then "swish4444"
Andrew [12]

Answer:

-_________________________________-

Explanation:

-__________________________________________________________-

3 0
3 years ago
Read 2 more answers
A typical day in programming and software development would involve
mrs_skeptik [129]

Answer:

writing code for a software program.

Explanation:

Software development life cycle (SDLC) can be defined as a strategic process or methodology that defines the key steps or stages for creating and implementing high quality software applications.

Some of the models used in the software development life cycle (SDLC) are; waterfall model, incremental model, spiral model, agile model, big bang model, and V-shaped model.

The five (5) standard stages of development in software development are;

I. Analysis.

II. Design.

III. Implementation (coding).

IV. Testing.

V. Maintenance.

A typical day in programming and software development would involve writing code for a software program.

Generally, software applications or programs require a code containing series of sequential instruction to perform specific tasks, commands and processes. These sets of code are typically written by a software developer (programmer).

3 0
3 years ago
What hull type is best for use on ponds small lakes and calm rivers?
Vika [28.1K]
There are different types of hull, the hull type that is best for use on ponds, small lakes and calm rivers is the FLAT BOTTOM HULL. This is the type usually find in fishing boat, it has a flat spanning and a shallow draft which is very stable in calm weather. 
5 0
3 years ago
Other questions:
  • An ______ search is when the buyer looks for information beyond personal knowledge to help make the buying decision, such as che
    10·1 answer
  • For your biology class, you have taken a number of measurements for a plant growth experiment. You wish to create a chart that s
    10·1 answer
  • Arrange the types of movies in terms of the amount of content they can hold
    14·1 answer
  • What is an avenue in a Karel world?
    6·2 answers
  • A folder has been shared with other users and set to read-only. What does this mean for users?
    12·2 answers
  • A reference parameter differs from an output parameter in that a reference parameter ______________________ but an output parame
    5·1 answer
  • Software that displays advertising material when online.
    12·2 answers
  • How do we Rewrite the following Python code to avoid error. mark=inpt("enter your mark ")
    6·1 answer
  • What is the abuse of electronic messaging systems to indiscriminately send unsolicited bulk messages, many of which contain hoax
    5·1 answer
  • a central issue in the microsoft antitrust lawsuit involved microsoft's integration of its internet browser into its windows ope
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!