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
Vaselesa [24]
3 years ago
7

ask user to input a string. (assume length of input string is 1) If the string is lower case, print its upper case If the string

is upper case, print its lower case If the input string is a number, stop program, otherwise repeat it. (In java)
Computers and Technology
1 answer:
Helga [31]3 years ago
8 0

Answer:

import java.util.*;

import java.util.Scanner;

class Main

{

public static void main(String[] args) {

System.out.println("Enter String");

Scanner sc1=new Scanner(System.in);

String s1= sc1.nextLine();

boolean b= isNumerc(s1);

if (b== true)

{

    System.out.println("Its number: Sorry");

}

else

{

boolean a=isStringUpperCas(s1);

if(a == false)

{

    System.out.println(s1.toUpperCase());

}

else

{

    System.out.println(s1.toLowerCase());

}

}

}

private static boolean isStringUpperCas(String st1){

     

     

      char[] arr = st1.toCharArray();

     

      int k =0; boolean flag=true;

      while(k<arr.length)

      {

         

          if( Character.isUpperCase( arr[k] ))

          {

              flag=true;

              k++;

          }

          else

          {

              flag=false;

              k++;

          }

         

      }

      return flag;

}

             

  public static boolean isNumerc(final String st1) {

     

      if (st1 == null || st1.length() == 0) {

          return false;

      }

      for (char ch : st1.toCharArray()) {

          if (!Character.isDigit(ch)) {

              return false;

          }

      }

      return true;

  }

 

}

Explanation:

Please find the program above.

You might be interested in
A(n) Blank______ database model stores data in the form of logically related two-dimensional tables. Multiple choice question. w
Rus_ich [418]

Answer:

relational database model

Explanation:

6 0
2 years ago
Write a function that simulates the roll of a six-sided dice. The name of the function is rollDice. The function accepts no para
Mumz [18]

Answer:

int rollDice(){

  return 1 + rand() % 6;

}

Explanation:

4 0
3 years ago
Which of the following are input devices? Check all that apply.
postnew [5]

Answer:

Keyboard,speaker,scanner,mouse,printer and monitor

Explanation:

In computing, an input device is a piece of equipment used to provide data and control signals to an information processing system such as a computer or information appliance. Examples of input devices include keyboards, mouse, scanners, cameras, joysticks, and microphones.

7 0
3 years ago
Read 2 more answers
Vector images take up much less space when saved to a computer or storage device because computers and storage devices just need
AleksandrR [38]

Answer:

False

Explanation:

4 0
2 years ago
Read 2 more answers
A ____________ is a collection of infected IT devices that an attacker or attack group controls.
sattari [20]
The answer would be a Botnet .
8 0
3 years ago
Other questions:
  • propose,two new ,proudly South African ways,which you can visualize that the IoT,can be used at work to make life better.
    12·1 answer
  • What purpose would tracking changes be most useful for?
    7·1 answer
  • To view the results of a saved query, right-click the query in the Navigation Pane and click ____ on the shortcut menu.
    7·1 answer
  • Which of the following is an advantage to using plain text format? Check all of the boxes that apply.
    15·2 answers
  • What do you adjust to allow more or less vertical space between lines of a paragraph?
    14·1 answer
  • Riley is using access to collect data for a science project. he is creating a report and wants to apply predefined color and fon
    6·1 answer
  • Suppose that TCP's current estimated values for the round trip time (estimatedRTT) and deviation in the RTT (DevRTT) are 400 mse
    9·1 answer
  • Cual es el procedimientos para asistir en el transporte publico a personas discapacitadas
    6·1 answer
  • Which item can you add using the tag?
    10·2 answers
  • A user can add color to a database to highlight a modification. To do this with a macro, which command screen would you access o
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!