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
Slav-nsk [51]
3 years ago
6

How to do assignment 5 on edhesive please help

Computers and Technology
1 answer:
Shalnov [3]3 years ago
8 0

Answer:

//To enter a string, and enter a pivot string, and then print in required sequence, the string from pivot string to last as first string, and printed before the left portion of string.

import java.util.Scanner;

public class Main {

 public static void main(String args[]) {

   Scanner s1 = new Scanner(System.in);

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

   String f1 = s1.nextLine();

   System.out.println("Enter pivot(string):");

   String piv = s1.nextLine();

   int start1 = f1.indexOf(piv);

   int end1 = piv.length()+start1;

   if (start1 == -1){

     System.out.println("Error: Sub string(Pivot) cannot be found.");

     return;

   }

   String first1 = f1.substring(0,start1-1);

   String second1 = f1.substring(end1);

   if (f1.charAt(start1-1)==' '){

     System.out.println(second1 + " " + piv + " " + first1);

     return;

   }

   System.out.println(second1 + piv + first1);

   

 }

}

Explanation:

Please check the answer section

You might be interested in
A software-based _________ is dedicated to examining and blocking internet traffic.
igomit [66]

A software-based <u>Firewall</u> is dedicated to examining and blocking internet traffic.

7 0
3 years ago
Read 2 more answers
Brainstorm what you want your LED board to do. What would need to happen first? What happens next?
lbvjy [14]
First it will glow then change what color you want
5 0
2 years ago
Read 2 more answers
How technology works?
Nastasia [14]

First of all, technology refers to the use of technical and scientific knowledge to create, monitor, and design machinery. Also, technology helps in making other goods.

5 0
1 year ago
Develop a plan to design and finally implement a set of functions using C++ that would implement the IEEE standard. Phase 1 will
AnnZ [28]

Answer:

See explaination code

Explanation:

#include<iostream>

#include<math.h>

using namespace std;

typedef union {

float number;

struct

{

// Order is important.

// Here the members of the union data structure

// use the same memory (32 bits).

// The ordering is taken

// from the LSB to the MSB.

unsigned int mantissa : 23;

unsigned int exponent : 8;

unsigned int sign : 1;

} Raw;

} MyFloat;

void printBinary(int n, int i)

{

// Prints the binary representation

// of a number n up to i-bits.

int k;

for (k = i - 1; k >= 0; k--) {

if ((n >> k) & 1)

cout << "1";

else

cout << "0";

}

}

void decToHex(int n){

// char array to store hexadecimal number

char hexaDeciNum[100];

// counter for hexadecimal number array

int i = 0;

while(n!=0)

{

// temporary variable to store remainder

int temp = 0;

// storing remainder in temp variable.

temp = n % 16;

// check if temp < 10

if(temp < 10)

{

hexaDeciNum[i] = temp + 48;

i++;

}

else

{

hexaDeciNum[i] = temp + 55;

i++;

}

n = n/16;

}

// printing hexadecimal number array in reverse order

for(int j=i-1; j>=0; j--)

cout << hexaDeciNum[j];

}

void floatBinary(float f){

long double binaryTotal, binaryFrac = 0.0, frac, fracFractor = 0.1;

long int integer, binaryInt = 0;

long int p = 0, rem, temp;

//separate the integer part from the input floating number

integer = (int)f;

//separate the fractional part from the input floating number

frac = f - integer;

//loop to convert integer part to binary

while (integer != 0) {

rem = integer % 2;

binaryInt = binaryInt + rem *pow(10, p);

integer = integer / 2;

p++;

}

//loop to convert fractional part to binary

while (frac != 0) {

frac = frac * 2;

temp = frac;

binaryFrac = binaryFrac + fracFractor * temp;

if (temp == 1)

frac = frac - temp;

fracFractor = fracFractor / 10;

}

cout << binaryInt + binaryFrac;

}

int findDecimal(float number){

int nfloor = number;

float nfloat = number - nfloor;

int nfloatfloor;

do {

nfloat *= 10;

nfloatfloor = nfloat;

} while (nfloat > nfloatfloor);

return nfloatfloor;

}

void first(float number){

if(number < 0)

cout << "SIGN BIT IS (1) SINCE NUMBER IS NEGATIVE" << endl;

else

cout << "SIGN BIT IS (0) SINCE NUMBER IS POSITIVE" << endl;

}

void second(float number){

cout << "INTEGER PART IN BASE-10:" << int(number) << " AND IN BINARY:";

printBinary(int(number),16);

cout << endl;

}

void third(float number){

cout << "DECIMAL PART IN BASE-10:" << findDecimal(number) << " AND IN BINARY:";

printBinary(findDecimal(number),16);

cout << endl;

}

void fourth(float number){

cout << "ENTERED NUMBER IN BASE-10:" << number << " AND IN BINARY:";

floatBinary(number);

cout << endl;

}

void fifth(MyFloat myfloat){

cout << "MANTISA IN BINARY:";

printBinary(myfloat.Raw.mantissa,32);

}

void sixth(MyFloat myfloat){

cout << "EXPONENT IN BASE-10:" << myfloat.Raw.exponent << " AND IN BINARY:";

printBinary(myfloat.Raw.exponent,8);

cout << endl;

}

void seventh(MyFloat myfloat){

cout << myfloat.Raw.sign << " | ";

printBinary(myfloat.Raw.exponent,8);

cout << " | ";

printBinary(myfloat.Raw.mantissa,32);

cout << endl;

}

void eigth(MyFloat myfloat){

cout << myfloat.Raw.sign << " | ";

decToHex(myfloat.Raw.exponent);

cout << " | ";

decToHex(myfloat.Raw.mantissa);

cout << endl;

}

int main(){

float number;

cout << "PLEASE ENTER A NUMBER TO DISPLAY THE IEEE 754 FLOATING POINT OPTIONS" << endl;

cin >> number;

MyFloat myfloat;

myfloat.number = number;

cout << "PLEASE CHOOSE ONE OF THE FOLLOWING OPERATIONS" << endl;

cout << " 1. DISPLAY THE SIGN BIT VALUE" << endl;

cout << " 2. DISPLAY THE INTEER PART IN BOTH BASE-10 AND CINARY FORMATS" << endl;

cout << " 3. DISPLAY THE DECIMAL PART IN BOTH BASE-10 AND BINARY FORMATS" << endl;

cout << " 4. DISPLAY THE NUMBER ENTERED IN BOTH BASE-10 AND BINARY FORMATS" << endl;

cout << " 5. DISPLAY THE MANTISA IN BINARY FORMATS" << endl;

cout << " 6. DISPLAY THE EXPONENT IN BORH BASEE-10 AND BINARY FORMATS" << endl;

cout << " 7. DISPLAY THE IEEE 754 SINGLE PRECISION BINARY LAYOUT" << endl;

cout << " 8. DISPLAY THE IEEE 754 SINGLE PRECISION BINARY LAYOUT" << endl;

int choice;

cin >> choice;

switch(choice){

case 1:first(number);

break;

case 2:second(number);

break;

case 3:third(number);

break;

case 4:fourth(number);

break;

case 5:fifth(myfloat);

break;

case 6:sixth(myfloat);

break;

case 7:seventh(myfloat);

break;

case 8:eigth(myfloat);

break;

default:cout << "ENTER VALID CHOICE" << endl;

}

}

Refer to attachment please for onscreen look.

6 0
2 years ago
Sarah is working on a project in which she needs to record all the extracurricular activities in her college. Her college teache
EastWind [94]
It sounds like the answer is A because there are 5 types of sports and the question only asks for the sports folders
8 0
3 years ago
Read 2 more answers
Other questions:
  • Launched in 1995, ________ has become the most popular web browser.
    6·1 answer
  • Users in a corporation currently authenticate with a username and password. A security administrator wishes to implement two-fac
    8·1 answer
  • harry is analyzing inbound network traffic and notices a tcp packet that has the FIN,PSH, and URG flags set at the same time. wh
    8·1 answer
  • A(n) ____ represents a particular type of object in the real world.
    7·1 answer
  • When comparing alternative methods for making information systems identification and selection decisions, top management's selec
    7·1 answer
  • Type the correct answer in the box. Spell all words correctly.
    5·1 answer
  • For which input values will the following loop not correctly compute the maximum of the values? 1. Scanner in = new Scanner (Sys
    14·1 answer
  • If you walked into a room containing three computers and were told one of them was infected with malware, how would you determin
    10·1 answer
  • Given a list of syntax errors from a compiler, a programmer should focus attention on which error(s), before recompiling?
    14·1 answer
  • The condition known as __________ occurs when you try to store an integer that is bigger than the maximum allowed by the number
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!