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
castortr0y [4]
3 years ago
6

Assume that nextWord is a String variable that has been given a String value consisting entirely of letters. Write some Java cod

e that outputs the message "First half of the alphabet" , provided nextWord precedes "N" in alphabetic ordering. IfnextWord does not precede "N" in alphabetic ordering, the code should output"Second half of the alphabet" . (Note that "N"uses double quotes to produce aString value, as opposed to using single quotes to produce achar value.) '
Computers and Technology
1 answer:
wel3 years ago
8 0

Answer:

The code example is given below with explanation in c++ language.

Explanation:

Comments will explain what's going on in the code. Below code is already compiled and tested.

#include <time.h>

#include <iostream>

#include <sstream>

using namespace std;

int main(void)

{

//defining start and end time variable

// which will be used to break the infinte loop

   time_t endwait;

   time_t start = time(NULL);

   time_t seconds = 3; // end loop after this time has elapsed

cout<<"Input your number :";

long userNum;

cin>> userNum;

// initializing end time by adding seconds with start time

   endwait = start + seconds;

   // defining outputString which will concatenate all the  

   // divisible numbers in loop

string outputString="";

// bool isCompleted will use to check whether our  

// loop breaks successfully or time is expired.

bool isCompleted=true;

// iterate loop until it comes to 1. as in loop

// the program already displayed the 1 value.

   while (userNum>1)

   {  

  // checking start and end time comparison to  

  // break the infinite loop after some seconds

    if(start >= endwait){

     cout<< "Program end never reached.";

     isCompleted=false;

     break;

 }

 

    userNum=userNum/2;

   // defining stringstream to convert from long to string

    stringstream longToString;

    longToString<<userNum;

  // concatenating all the values

    outputString = outputString + longToString.str()+" ";

   // re initializing the start time with current time.

       start = time(NULL);

   }

   

  // check if while loop breaks successfully then print the

   // series of numbers here.

   if(isCompleted) {

    cout << outputString;

}

   return 0;

}

You might be interested in
What is the symbol that causes the computer to perform string concatenation?
neonofarm [45]

Answer: In java the symbol "+" operator is used to perform string concatenation.

Explanation:

String concatenation refers to joining of two strings. So in java + is used to join strings which works provided one of the operands must be a String variable. Then it works by converting the other variable to String variable and joins the second operand to the end of the first operand.

An example of String concatenation is as follows:

int age = 10;

System.out.println("The boys age is " + age);

Output:

The boys age is 10.

here, the age is integer variable but as the phrase "The boys age is" is a String variable so it converts the age to String variable and joins both the Strings.

4 0
3 years ago
How do companies use LinkedIn ?
Semenov [28]

Answer:

  1. Introducing new products or services you’ve developed.
  2. Differentiating yourself from your competitors.
  3. Finding job candidates who can make a significant contribution to your business success.
  4. Checking on what your competition is doing.
  5. Improving your ranking in search engines.
8 0
3 years ago
Read 2 more answers
Sql injections is an attack in which __ code is inserted into strings that are later passed to an instance of sql server.
jek_recluse [69]

Answer:

malicious code

Please Mark Brainliest If This Helped!

7 0
3 years ago
What are indications of a computer hardware problem? Check all that apply.
mr_godi [17]

Answer:

The keyboard keys are getting stuck.

The computer monitor is going blank.

The pointer of the mouse freezes.    

Explanation:

8 0
3 years ago
Read 2 more answers
8.9 Lesson Practice edhesive
lapo4ka [179]
Is what it is so it can’t be what it isn’t
6 0
3 years ago
Read 2 more answers
Other questions:
  • What does CSS stand for?
    8·2 answers
  • A sample containing 4.30 g of O2 gas has an initial volume of 13.0 L. What is the final volume, in liters, when each of the foll
    5·1 answer
  • a password to a certain database consists of digits that cannot be repeated. if the password is known to consist of at least 8 d
    14·1 answer
  • Instructions:Select the correct answer.
    8·2 answers
  • A(n) ____ instruction might look like a meaningless string of 0s and 1s, but it actually represents specific operations and stor
    9·1 answer
  • What is ana absolute adress
    11·1 answer
  • Emotions can have Impact on your driving?
    10·1 answer
  • The National Vulnerability Database (NVD) is responsible for actively performing vulnerability testing for every company's softw
    8·1 answer
  • Write a program that creates a two-dimensional array named height and stores the following data:
    15·2 answers
  • If the following are using default subnet masks, which one(s) of the following are valid node ip addresses: (select one) a) 220.
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!