answer.
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
RUDIKE [14]
2 years ago
14

Given the following code, what indexes must be passed to the substring method to produce the new String with the value "SCORE"?

What indexes to substring produce "fouryears"?
// index 012345678901234567890123456789
String quote = "Four score and seven years ago";
String expr1 = quote.substring(a, b).toUpperCase(); // "SCORE"
String expr2 = quote.toLowerCase().substring(c, d) + quote.substring(e, f); // "fouryears"
a.
b.
c.
d.
e.
f.
Engineering
1 answer:
Ierofanga [76]2 years ago
6 0

Answer:

For expr1 = index 5, length 5

For expr2 = index 0, length 4 and index 21, length 5

string quote = "Four score and seven years ago";

           string expr1 = quote.Substring(5, 5).ToUpper(); // "SCORE"  

           string expr2 = quote.Substring(0, 4) + quote.Substring(21, 5).ToLower(); // "fouryears"

           Console.WriteLine(expr1);

           Console.WriteLine(expr2);

Explanation:

Then code is written in c# and it produces SCORE and f

ouryears

Substring takes 2 arguments, the start of the specific character and the length

You might be interested in
Compute the mass fractions of α ferrite and cementite in pearlite. Assume T=726⁢ C∘.
kotykmax [81]

Answer:

The mass composition of ∝ ferrite is 88.94%.

The mass composition of cementite is 11.05%.

Explanation:

Given that

T=726 °C

We have to find the mass fractions of ferrite nad cementite in pearlite.

Lets take data from ideal Iron -carbon diagram at 726 °C

Composition of ∝ ferrite=0.022 5

Composition of pearlite =0.76 %

Composition of cementite =7.6%

We know that if we want to find the mass fraction the  we use Lever rule .So now by using lever rule

The\ mass\ composition\ of\alpha \ ferrite =\dfrac{6.7-0.76}{6.7-0.022}

So the mass composition of ∝ ferrite is 88.94%.

The\ mass\ composition\ of\ cementite =\dfrac{0.76-0.022}{6.7-0.022}

So the mass composition of cementite is 11.05%.

4 0
2 years ago
Write a program with total change amount as an integer input, and output the change using the fewest coins, one coin type per li
pshichka [43]

Answer:

The C code is given below with appropriate comments

Explanation:

#include<stdio.h>

//defining constants

#define DOLLAR 100

#define QUARTER 25

#define DIME 10

#define NICKEL 5

#define PENNIES 1

//converting method

void ExactChange(int userTotal,int coinVals[])

{

//checking dollars

if (userTotal >=100)

{

coinVals[0]=userTotal/DOLLAR;

userTotal=userTotal-(100*coinVals[0]);

}

//checking quarters

if (userTotal >=25)

{

coinVals[1]=userTotal/QUARTER;

userTotal=userTotal-(25*coinVals[1] );

}

//checking dimes

if (userTotal >=10)

{

coinVals[2]=userTotal/DIME;

userTotal=userTotal-(10*coinVals[2]);

}

//checking nickels

if (userTotal >=5)

{

coinVals[3]=userTotal/NICKEL;

userTotal=userTotal-(5*coinVals[3]);

}

//checking pennies

if (userTotal >=1)

{

coinVals[4]=userTotal/PENNIES;

userTotal=userTotal-coinVals[4];

}

}

//main method

int main() {

//defining the variables

int amount;

//asking for input

printf("Enter the amount in cents :");

//reading the input

scanf("%d",&amount);

//validating the input

if(amount<1)

{

//printing the message

printf("No change..!");

}

//when the input is >0

else

{

int coinVals[5]={0,0,0,0,0};

ExactChange(amount,coinVals);

//checking dollars

if (coinVals[0]>0)

{

//printing dollars

printf("%d Dollar",coinVals[0]);

if(coinVals[0]>1) printf("s");

}

//checking quarters

if (coinVals[1]>0)

{

//printing quarters

printf(" %d Quarter",coinVals[1]);

if(coinVals[1]>1) printf("s");

}

//checking dimes

if (coinVals[2]>0)

{

//printing dimes

printf(" %d Dime",coinVals[2]);

if(coinVals[2]>1) printf("s");

}

//checking nickels

if (coinVals[3]>0)

{

//prinitng nickels

printf(" %d Nickel",coinVals[3]);

if(coinVals[3]>1) printf("s");

}

//checking pennies

if (coinVals[4]>0)

{

//printing pennies

printf(" %d Penn",coinVals[4]);

if(coinVals[4]>1) printf("ies");

else printf("y");

}

}

//end of main method

}

6 0
2 years ago
Write cout statements with stream manipulators that perform the following:
Semenov [28]

Answer:

A)cout<<setw(9)<<fixed<<setprecision(2)<<34.789;

B)cout<<setw(5)<<fixed<<setprecision(3)<<7.0;

C)cout<<fixed<<5.789E12;

D)cout<<left<<setw(7)<<67;

Explanation:

Stream Manipulators are functions specifically designed to be used in conjunction with the insertion (<<) and extraction (>>) operators on stream objects in C++ programming while the 'cout' statement is used to display the output of a C++to the standard output device.

setw:  used to specify the minimum number of character positions on the output field

setprecision: Sets the decimal precision to be used to format floating-point values on output operations.

fixed:  is used to set the floatfield format flag for the specified str stream.

left: adjust output to the left.

A) To display the number 34.789 in a field of eight spaces with two decimal places of precision. cout<<setw(9)<<fixed<<setprecision(2)<<34.789;

B) To display the number 7.0 in a field of six spaces with three decimal places of precision. cout<<setw(5)<<fixed<<setprecision(3)<<7.0;

C) To print out the number 5.789e+12 in fixed-point notation.  cout<<fixed<<5.789E12;

(D) To display the number 67 left-justified in a field of six spaces. cout<<left<<setw(7)<<67;

7 0
2 years ago
A well-insulated tank in a vapor power plant operates at steady state. Saturated liquid water enters at inlet 1 at a rate of 125
kompoz [17]

Answer:

a. The mass flow rate (in lbm/s) is 135lbm/s

b. The temperature (in o F) is 200.8°F

Explanation:

We assume that potential energy and kinetic energy are negligible and the control volume operates at a steady state.

Given

a. The mass flow rate (in lbm/s) is 135lbm/s

b.

m1 = Rate at inlet 1 = 125lbm/s

m2 = Rate at inlet 2 = 10lbm/s

The mass flow rate (in lbm/s) is calculated as m1 + m2

Mass flow rate = 125lbm/s + 10lbm/s

Mass flow rate = 135lbm/s

Hence, the mass flow rate (in lbm/s) is 135lbm/s

b. To calculate the temperature.

First we need to determine the enthalpy h1 at 14.7psia

Using table A-3E (thermodynamics)

h1 = 180.15 Btu/Ibm

h2 at 14.7psia and 60°F = 28.08 Btu/Ibm

Calculating h3 using the following formula

h3 = (h1m1 + h2m2) / M3

h3 = (180.15 * 125 + 28.08 * 10)/135

h3 = 168.8855555555555

h3 = 168.89 Btu/Ibm

To get the final temperature; we make use of table A-2E of thermodynamics.

Because h3 < h1, it means the liquid is at a compressed state.

The corresponding temperature at h3 = 168.89 is 200.8°F

The temperature (in o F) is 200.8°F

6 0
2 years ago
A thin, flat plate that is 0.2 m × 0.2 m on a side is oriented parallel to an atmospheric airstream having a velocity of 40 m/s.
Leto [7]

Answer:

The rate of heat transfer from both sides of the plate to the air is 240 W

Explanation:

Given;

area of the flat plate = 0.2 m × 0.2 m = 0.04 m²

velocity of atmospheric air stream, v = 40 m/s

drag force, F =  0.075 N

The rate of heat transfer from both sides of the plate to the air:

q = 2 [h'(A)(Ts -T∞)]

where;

h' is heat transfer coefficient obtained from Chilton-Colburn analogy

h' = \frac{C_f}{2} \rho u C_p P_r^{-2/3}\\\\\frac{C_f}{2} = \frac{\tau'_s}{2*\rho u^2/2}

Properties of air at 70°C and 1 atm:

ρ = 1.018 kg/m³, cp = 1009 J/kg.K, Pr = 0.7, v = 20.22 x 10⁻⁶ m²/s

\frac{C_f}{2} = \frac{(0.075/2)/(0.2)^2}{2*(1.018)(40)^2/2} = 5.756*10^{-4}\\\\Thus,\\h' = 5.756*10^{-4} (1.018*40*1009)*(0.7)^{-2/3}\\\\h' = 30 \ W/m^2.K

Finally;

q = 2 [ 30(0.04)(120 - 20) ]

q = 240 W

Therefore, the rate of heat transfer from both sides of the plate to the air is 240 W

4 0
2 years ago
Read 2 more answers
Other questions:
  • A 0.9% solution of NaCl is considered isotonic to mammalian cells. what molar concentration is this?
    10·1 answer
  • If the electric field just outside a thin conducting sheet is equal to 1.5 N/C, determine the surface charge density on the cond
    9·1 answer
  • An excavation is at risk for cave-in and water accumulation because of the excess soil that has accumulated. What type of excava
    12·1 answer
  • A fireboat is to fight fires at coastal areas by drawing seawater with a density of 1030 kg/m through a 20-cm-diameter pipe at a
    13·1 answer
  • The components of an electronic system dissipating 90 W are located in a 1-m-long circular horizontal duct of 15-cm diameter. Th
    11·1 answer
  • A thin-walled tube with a diameter of 6 mm and length of 20 m is used to carry exhaust gas from a smoke stack to the laboratory
    7·1 answer
  • Benzene vapor at 480°C is cooled and converted to a liquid at 25°C in a continuous condenser. The condensate is drained into 1.7
    15·1 answer
  • When encountering low visibility from rain or fog, you should use your ____.
    12·1 answer
  • Question 14<br> Which of these is true of a spray wash cabinet?
    6·1 answer
  • Mr. Ray deposited $200,000 in the Old and Third National Bank. If the bank pays 8% interest, how much will he have in the accoun
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!