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
All java classes must contain a main method which is the first method executed when the java class is called upon.
uranmaximum [27]
This is false. Not all java classes need a main method. You can create you own class below the class with the main method and put your own user-created methods into it. Classes without a main method can be in its own separate class even.
3 0
3 years ago
Which device doesn't have wifi support? option (1) smartphone, (2) network printer, (3) table fan ​
Ne4ueva [31]
<h2><u>T</u><u>ABLE </u><u>FAN</u></h2>

Because it runs on electricity not by wi - fi.

5 0
3 years ago
What's the keyboard command that will allow you to "copy" text?
lana66690 [7]

For mac/apple operating systems; command c to copy command v to paste

For windows operating systems; control c to copy control v to paste

4 0
3 years ago
Read 2 more answers
What does every shot have with regards to depth?
djyliett [7]

This can be used to capture a larger area of acceptably sharp images. This can also be referred to as a deep depth of field, and some cinematographers will simply use the term “depth” to describe shots with a large DOF. It can also be referred to as deep focus.
5 0
3 years ago
The memory address that is saved by the system when a method is called and is the location to which the system should return aft
MA_775_DIABLO [31]

Answer:

Return point

Explanation:

4 0
3 years ago
Other questions:
  • it is important to include the __ attribute of the tag because some people use text-only web browsers
    5·2 answers
  • In what era did plants begin to flourish?
    9·1 answer
  • What type of window are you opening when you click the Start button on the Windows desktop, and then click the name of an app
    9·1 answer
  • Example of a question that could NOT be answered with a binary message
    10·2 answers
  • Implement (in Java) the radixSort algorithm to sort in increasing order an array of integer positive keys. public void radixSort
    13·1 answer
  • Convert each number into scientific notation.
    6·1 answer
  • Create and configure databases in oracle database management system operation administration
    6·1 answer
  • Would you rather be rich and unknown or famous and poor
    9·1 answer
  • Can someone pls help with this (20 points)
    8·1 answer
  • An engineer is designing an HTML page and wants to specify a title for the browser tab to display, along with some meta data on
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!