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
Crazy boy [7]
3 years ago
8

In Java please:

Computers and Technology
1 answer:
Nana76 [90]3 years ago
6 0

Answer:

See explaination

Explanation:

public class PalindromeChange {

public static void main(String[] args) {

System.out.println("mom to non palindrom word is: "+changTONonPalindrom("mom"));

System.out.println("mom to non palindrom word is: "+changTONonPalindrom("aaabbaaa"));

}

private static String changTONonPalindrom(String str)

{

int mid=str.length()/2;

boolean found=false;

char character=' ';

int i;

for(i=mid-1;i>=0;i--)

{

character = str.charAt(i);

if(character!='a')

{

found=true;

break;

}

}

if(!found)

{

for(i=mid+1;i<str.length();i++)

{

character = str.charAt(i);

if(character!='a')

{

found=true;

break;

}

}

}

// This gives the character 'a'

int ascii = (int) character;

ascii-=1;

str = str.substring(0, i) + (char)ascii+ str.substring(i + 1);

return str;

}

}

You might be interested in
write a java program that prompts the user to enter scores (each number an integer from 0 to 10) and prints the following output
Vladimir [108]

Answer:

Explanation:

The following is written in Java. It continues asking the user for inputs until they enter a -1. Then it saves all the values into an array and calculates the number of values entered, the highest, and lowest, and prints all the variables to the screen. The code was tested and the output can be seen in the attached image below.

import java.util.ArrayList;

import java.util.Arrays;

import java.util.Scanner;

class Brainly {

   public static void main(String[] args) {

       Scanner in = new Scanner(System.in);

       int count = 0;

       int highest, lowest;

       ArrayList<Integer> myArr = new ArrayList<>();

       while (true) {

           System.out.println("Enter a number [0-10] or -1 to exit");

           int num = in.nextInt();

           if (num != -1) {

               if ((num >= 0) && (num <= 10)) {

                   count+= 1;

                   myArr.add(num);

               } else {

                   System.out.println("Wrong Value");

               }

           } else {

               break;

           }

       }

       if (myArr.size() > 3) {

           highest = myArr.get(0);

           lowest = myArr.get(0);

           for (int x: myArr) {

               if (x > highest) {

                   highest = x;

               }

               if (x < lowest) {

                   lowest = x;

               }

           }

           System.out.println("Number of Elements: " + count);

           System.out.println("Highest: " + highest);

           System.out.println("Lowest : " + lowest);

       } else {

           System.out.println("Number of Elements: " + count);

           System.out.println("No Highest or Lowest Elements");

       }

   }

}

4 0
3 years ago
What is also known as a visual aid in a presentation?
kap26 [50]

Answer:

Option D i.e., slide are the correct option.

Explanation:

The following option is true because in the PowerPoint presentation slide is the visual aid. With the help of the visual aid, the user can add the acumen to its PowerPoint presentation and it is the item in which the user can summarize their information and data that is slide. It is important for the creation of the official or the business purpose presentation.

3 0
4 years ago
Read 2 more answers
6 external parts or peripherals of a computer system and identify which are output and which are input devices.
djverab [1.8K]
A computer peripheral, or peripheral device, is an external object that provides input and output for the computer. Some common input devices include:

keyboard
mouse
touch screen
pen tablet
joystick
MIDI keyboard
scanner
digital camera
microphone
<span>
Some common Output Devices : 
</span>monitor
projector
TV screen
printer
plotter
<span>speakers</span>
3 0
3 years ago
Which of these is not considered by economists to be a want?
KATRIN_1 [288]
Bowl of cereal these is not considered by economists
4 0
3 years ago
FREEEEEEEEEEEEE FREEEEEEEEEEEEE Pointttssss​
Paul [167]

Answer:

Thx TYSM TYSM

Explanation:

8 0
3 years ago
Read 2 more answers
Other questions:
  • 2) Describe how data becomes knowledge.​
    10·1 answer
  • consider a group of 30 people who wish to establish pair-wise secure communications using symmetric-key cryptography. How many K
    15·1 answer
  • While you work on the customer’s printer, he continues chatting about his network and problems he’s been experiencing. One compl
    14·2 answers
  • What is pure carbon made of
    14·2 answers
  • Answer to this if you have apex legends on either pc xbox one or PS4 for the one that answers and does gets brainliest please do
    7·2 answers
  • A printer would be considered _____. Select 2 options. 1 an input device 2 an output device 3 hardware 4 software 5 storage
    10·1 answer
  • What is the promotion and advertising stage of a product or service called?
    15·1 answer
  • 8. Cloud Storage is
    5·2 answers
  • select the correct answer from each drop-down menu. “To clean a computer screen, use ___. To clean a keyboard, use a ___.”
    7·1 answer
  • True or false = the order of cannot be changed in slide shorter view ,true or false =menu bar is located just below the title ba
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!