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
What is it called when a programmer includes a step in an algorithm that lets
Oksanka [162]

Selection is the step in algorithm that let's the computer decide which group of steps to perform.

<h3>What is Algorithm?</h3>

This can be defined as set of instructions which are used for solving a problem or accomplishing a task.

Selection happens when there are one or more options are available in which the computer decide which group of steps to perform.

Read more about Algorithm here brainly.com/question/11302120

3 0
2 years ago
Betty was sitting at a coffee shop reading her favorite book. She heard an explosion nearby. In a few, she could hear ambulance
enot [183]
B or D are the options I would suggest.
4 0
3 years ago
Read 2 more answers
What item is at the front of the list after these statements are executed?
Veseljchak [2.6K]

Answer:

A.Sam.

Explanation:

We are using Deque interface which is sub type of  Queue interface. Deque supports insertion and deletion from both ends front and end.So it can be used as a queue and stack also.

In this question we have inserted Jack at the front first.Then Rudy at the back then larry also at the tail.Now we have added sam at the front then nothing is added to the front.So the answer is Sam.

7 0
3 years ago
The node of a doubly linked list contains _____.
meriva

Answer:

Hi!

The correct answer is one data field and two links fields.

Explanation:

The node of a doubly-linked list contains one data field, and two links fields that references to the next node on the list and another one link field that references to the previous node in the sequence of nodes).

3 0
4 years ago
You can access various sites on the WWW by using hyperlinks or by
Vilka [71]
<span>or by following directions on screen </span>
5 0
3 years ago
Other questions:
  • All of the following except one are issues that should be covered in an AUP. Which one is the exception?
    5·1 answer
  • . _______ are the components that allow a posi-traction differential to transfer power from one drive wheel to another.
    10·1 answer
  • The third wave of computing was characterized by the introduction of _____.
    10·1 answer
  • What function(s) does an interpreter perform with the instructions in a high-level programming language?
    11·1 answer
  • Which of the following laptop features allows users to overcome keyboard size restrictions?
    11·1 answer
  • 3.3 Code Practice: Question 1
    15·1 answer
  • Please help!<br><br> What is a non-iterative programming structure?
    11·1 answer
  • how to create use an array of Course objects instead of individual objects like course 1, course 2, etc
    11·1 answer
  • dash is a set of communication standard using for transferring file information between computers in a network​
    5·1 answer
  • You are working on a ticket for a user who cannot access the Internet from their PC. After troubleshooting, how do you confirm t
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!