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
Is permanent software programmed into read-only memory.<br> Firmware<br> JavaScript<br> PHP<br> o
velikii [3]
Firmware is the software
5 0
2 years ago
Raw materials have two basic types what are the 2?
marissa [1.9K]
The answer Direct and inderect
8 0
2 years ago
Read 2 more answers
A network administrator has been given a network of 172.16.85.0/21 and wants to know the usable range of IP addresses on that su
viktelen [127]

Answer:

The correct answer to the following question will be option C.

172.16.80.1-172.16.87.254

Explanation:

IP Address: IP Address stands for Internet Protocol Address, a unique numerical label allotted to every computer network that are connected to the network of the computer and communicate through the internet protocol.

  • An IP address can be separated by periods and having four numbers that are called Octet. Range of IP address can be from 0 to 255.
  • We have to keep the first 21 bits and start setting all from the 22nd bit on to 0 (zero).
  • To get the suitable and the correct range of the address, we add and subtract 1 from the given broadcast address i.e.,172.16.85.0/21.

So, option C is the right answer and no other option is usable according to the given explanation and the address given by the administrator.

3 0
3 years ago
¿que significa “TTAQMMQMPDATLSPLNDTMGCCLFEQMMPQTEIUMDR” ?
OlgaM077 [116]

Answer: what

Explanation:

5 0
2 years ago
Read 2 more answers
Thsi is for gacha girl5467
djyliett [7]

Answer:

lol

Explanation:

3 0
2 years ago
Read 2 more answers
Other questions:
  • What are the advantage of transistors over vacuum tubes?
    6·1 answer
  • The voluntary linkage of computer networks around the world is called the ______.
    7·1 answer
  • Interactive sites where users write personal topics and comments to a threadded discussion are called?
    11·1 answer
  • How do emotions affect purchasing decisions?
    6·1 answer
  • This is pixlr
    6·1 answer
  • E-mail messages, instant messages (IMs), or text messages sent and/or received within an organization a. are not included on a r
    9·1 answer
  • Computer can do work very___​
    7·2 answers
  • computer is an electronic machine that is used for data processing to produce meaningful information explain in statement​
    5·1 answer
  • A company database needs to store information about employees (identified by ssn, with salary and phone as attributes), departme
    7·1 answer
  • Class Main {
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!