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
Scilla [17]
2 years ago
8

1. Create a class called Name that represents a person's name. The class should have fields named firstName representing the per

son's first name, lastName representing their last name, and middleInitial representing their middle initial (a single character). Your class should contain only fields for now.
2. Add two new methods to the Name class:

public String getNormalOrder()
Returns the person's name in normal order, with the first name followed by the middle initial and last name. For example, if the first name is "John", the middle initial is 'Q', and the last name is "Public", this method returns "John Q. Public".

public String getReverseOrder()
Returns the person's name in reverse order, with the last name preceding the first name and middle initial. For example, if the first name is "John", the middle initial is 'Q', and the last name is "Public", this method returns "Public, John Q.".

(You don't need to write the class header or declare the fields; assume that this is already done for you. Just write your two methods' complete code in the box provided.)
Engineering
2 answers:
beks73 [17]2 years ago
8 0

Answer: Jhon Greenheart

Explanation:

attashe74 [19]2 years ago
4 0

ANSWER:

<u>( 1 )</u><em><u>.</u></em>

<em><u /></em>

public class Name{       //header declaration for the class <em>Name</em>    

   /*

<em>    Declare all necessary fields.</em>

   The first and last names of the person are string variables.

   Hence they are of type String.

   The middle initial of the person is a single character.

   Hence it is of type char.

   */

    String firstName;     // <em>person's first name called firstName</em>

    String lastName;      // <em>person's last name called lastName</em>

    char middleInitial;    // <em>person's middle initial called middleInitial</em>

}

==========================================================

<u>( 2 )</u>

/*

Method getNormalOrder() is declared as follows.

It returns the person's name in normal order with first name

followed by the middle initial and last name.

*/

public String getNormalOrder(){      

    // concatenate the firstName, middleInitial and lastName and return the

   // result.

    return this.firstName + " " + this.middleInitial + ". " + this.lastName;

}

/*

Method getReverseOrder() is declared as follows.

It returns the person's name with the last name

followed by the first name and middle initial.

*/

public String getReverseOrder(){

   // concatenate the lastName, lastName and middleInitial  and return the

   // result.

   return this.lastName + " " + this.firstName + " " + this.middleInitial + ".";

}

EXPLANATION:

The above code has been written in Java.

The code contains comments that explain every part of the code. Please go through the comments carefully for a better understanding of the code.

<em>Special note: </em>

i. Concatenation which means joining strings together, is done in Java using the + operator.

ii. The this keyword used in the two methods is optional. It is just used to reference to the instance variables - firstName, lastName and middleInitial - of the object.

<em>Hope this helps!</em>

You might be interested in
An overpass is being built over the PVI of an existing equal-tangent sag curve. The sag curve has a 70 mi/h design speed and G1=
vivado [14]

Answer: Resultant elevation will be 30.98 ft

8 0
2 years ago
Which situation is an enabler for the rise of Artificial Intelligence (AI) in recent years?
Vladimir [108]

Explanation:

Which situation is an enabler for the rise of Artificial Intelligence (A in recent years? availability of cloud-based, hosted machine learning platforms.

8 0
2 years ago
Read 2 more answers
A hand crank generator is used to power a light bulb. The person turning the crank uses 22 Newtons of input force to turn the cr
ikadub [295]

Answer:

1. The input power is 17.6 Watts

2. The output power is 0.7232 Watts

3.The efficiency of the hand crank generator is approximately 4.109%

Explanation:

The given parameters are;

The force with which the crank generator is turned = 22 Newtons

The rate at which the crank is turned = 8 revolutions per 3 seconds

The distance the hand moves during each revolution = 0.3 meters

The current recorded by the multimeter = 0.08 amps

The voltage recorded by the multimeter = 9.04 volts

1. Power = The rate of doing work = Work done/(Time taken to do the work) = Force × Distance/Time

∴ The power input of the hand crank generator = 22 × 0.3 × 8/3 = 17.6 Watts

2. The power output to the bulb, P, is given by the formula for electrical power as follows;

Power = Current, I × Voltage V

∴ P = 0.08 ×  9.04 = 0.7232 Watts

3. Efficiency in percentage = Output/Input × 100

Therefore, the efficiency of the hand crank generator = )Output power/(Input power)) × 100 = (0.7232/17.6) × 100 ≈ 4.109%

8 0
2 years ago
To water his lawn, a homeowner uses two hoses. One connects to the faucet, the other to the end of the first hose to make the ho
Shtirlitz [24]

Answer: to be exact you need 28mm of tubing for that

Explanation:

When the election

8 0
2 years ago
Bananas are to be cooled from 28°C to 12°C at a rate of 1140 kg/h by a refrigerator that operates on a vapor-compression refrige
Lera25 [3.4K]

Answer:

A) COP = \frac{16.97}{9.8} = 1.731

B) P_{IN} = 0.4763

C) Second law efficiency 4.85%

exergy destruction for the cycle = 9.3237 kW

Explanation:

Given data:

T_1 = 28 degree celcius

T_2 = 12 degree celcius

\dot m = 1140 kg/h

Power to refrigerator = 9.8 kW

Cp = 3.35 kJ/kg degree C

A) Q = \dot m Cp \Delta T

        = 1140 \times 3.35\times (28-12) = 61,104 kJ/h

Q_{abs} = 61,104 kJ/h = 16.97 kJ/sec

COP = \frac{16.97}{9.8} = 1.731

b)

COP ∝ \frac{1}{P_{in}}

P_{in} wil be max when COP maximum

taking surrounding temperature T_H = 20 degree celcius

COP_{max} = \frac{T_L}{T_H- T_L} = \frac{285}{293 - 285} = 35.625

we know that

COP = \frac{heat\ obsorbed}{P_{in}}

P_{IN} = \frac{16.97}{35.62} = 0.4763

c) second law efficiency

\eta_{11} = \frac{COP_R}{(COP)_max} = \frac{1.731}{35.625} = 4.85\%

exergy destruction os given as X = W_{IN} - X_{Q2}

                                                         = 9.8 - 0.473 = 9.3237 kW

8 0
2 years ago
Other questions:
  • Consider a plane composite wall that is composed of two materials of thermal conductivities kA 0.1 W/mK and kB 0.04 W/mK and thi
    14·1 answer
  • A fatigue test was conducted in which the mean stress was 46.2 MPa and the stress amplitude was 219 MPa.
    12·1 answer
  • Which of the following is correct regarding the principal stresses and maximum in-plane shear stresses? a. Principal stresses ca
    14·1 answer
  • Carbon dioxide gas enters a pipe at 3 MPa and 500 K at a rate of 2 kg/s. CO2 is cooled at constant pressure as it flows in the p
    10·1 answer
  • A negative pressure respirator brings fresh air to you through a hose<br>A) True<br>B)False​
    15·2 answers
  • The small 5-oz slider A moves without appreciable friction in the hollow tube, which rotates in a horizontal plane with a consta
    7·1 answer
  • Water enters a circular tube whose walls are maintained at constant temperature at specified flow rate and temperature. For full
    8·1 answer
  • A 50-kg iron block and 20-kg copper block, both initially at 80 oC, are dropped into a large lake at 15 oC. Thermal equilibrium
    12·1 answer
  • An ideal Stirling cycle filled with air uses a 75 F energy reservoir as a sink. The engine is designed to so that the maximum ai
    8·1 answer
  • Test if a number grade is an A (greater than or equal to 90). If so, print "Great!". Hint: Grades may be decimals. Sample Run En
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!