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

Answer: Jhon Greenheart

Explanation:

attashe74 [19]4 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
What is the weight of a glider with a mass of 5.3 grams? (Hint: watch your units!)
Vinvika [58]

Answer: 0.053

Explanation:

So, we convert 5.3 grams into kilograms.

5.3g = 0.0053 kg (Since 1kg equals 1000g)

On Earth, gravity is 10 N/kg.

Weight = mass x gravity

Weight = 0.0053kg x 10 N/kg

Weight = 0.053 Newtons (On Earth)

6 0
3 years ago
The Transportation and Logistics career cluster serves
alukav5142 [94]

Answer:

C - airplane and grocery store

Explanation:

i hope this helps

8 0
3 years ago
The basic concept of feedback control is that an error must exist before some corrective action can be made?
weqwewe [10]

Answer:

The correct answer is True.

Explanation:

The feedback control system implies that to make a feedback, there must first be an error, otherwise there will be nothing to correct.

This system works so that there is an output that is controlled through a signal.

This signal will be feedback and it will signal an error which will be detected by a controller that will allow entry into the system.

In basic words, this system processes signals, samples them in the form of an output, and re-enters them feedback to detect the error signal.  

7 0
3 years ago
Determine the carburizing time necessary to achieve a carbon concentration of 0.30 wt% at a position 4 mm into an iron–carbon al
Ahat [919]

Answer:

the carburizing time necessary to achieve a carbon concentration is 31.657 hours

Explanation:

Given the data in the question;

To determine the carburizing time necessary to achieve the given carbon concentration, we will be using the following equation:

(Cs - Cx) / (Cs - C0) = ERF( x / 2√Dt)

where Cs is Concentration of carbon at surface = 0.90

Cx is Concentration of carbon at distance x = 0.30 ; x in this case is 4 mm = ( 0.004 m )

C0 is Initial concentration of carbon = 0.10

ERF() = Error function at the given value

D = Diffusion of Carbon into steel

t = Time necessary to achieve given carbon concentration ,

so

(Cs - Cx) / (Cs - C0) = (0.9 - 0.3) / (0.9 - 0.1)

= 0.6 / 0.8

= 0.75

now, ERF(z) = 0.75; using ERF table, we can say;

Z ~ 0.81; which means ( x / 2√Dt) = 0.81

Now, Using the table of diffusion data

D = 5.35 × 10⁻¹¹ m²/sec at (1100°C) or 1373 K

now we calculate the carbonizing time by using the following equation;

z = (x/2√Dt)

t is carbonizing time

so we we substitute in our values

0.81 = ( 0.004 / 2 × √5.35 × 10⁻¹¹ × √t)

0.81 = 0.004 / 1.4628 × 10⁻⁵ × √t

0.81 × 1.4628 × 10⁻⁵ × √t = 0.004

1.184868 × 10⁻⁵ × √t = 0.004  

√t = 0.004 / 1.184868 × 10⁻⁵

√t = 337.5903

t = ( 337.5903)²  

t = 113967.21 seconds

we convert to hours

t = 113967.21 / 3600

t = 31.657 hours

Therefore, the carburizing time necessary to achieve a carbon concentration is 31.657 hours

7 0
3 years ago
8) Microsoft Windows is
Alisiya [41]
The Answer Is C. A collection of computer programs or applications along with its related data
Hope this helps
8 0
2 years ago
Other questions:
  • Write a function that multiplies two decimal string representations of non-negative integers. The function takes two parameters
    9·1 answer
  • Inventions for a 9 year old​
    15·1 answer
  • Steam is contained in a closed rigid container which has a volume of 2 initially the the pressure and the temperature is the rem
    5·1 answer
  • What is usually the strongest part of a unibody
    8·1 answer
  • A plane wall, 7.5 cm thick, generates heat internally at the rate of 105W/m3. One side of the wall is insulated and the other si
    14·1 answer
  • What is working fluid and mention five example of working fluid.​
    14·2 answers
  • A vehicle is towed into a shop with a thrown serpentine belt.
    13·1 answer
  • In a morphological matrix, which of the following contains the parameters that are essential to a design?
    7·1 answer
  • Which type of astm c150 standard portland cement is best suited for a concrete where minimal total heat evolution and minimal ra
    5·1 answer
  • Subject of the study about vacuum cleaner
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!