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]
3 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]3 years ago
8 0

Answer: Jhon Greenheart

Explanation:

attashe74 [19]3 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
Since you became discouraged not being able to find a job in the San Diego area, you enlarged the area in which you looked for a
nordsb [41]

Answer:

need points 48986

Explanation:

5 0
3 years ago
Shielding gases are used to protect the molten metal from what?
Gre4nikov [31]

Answer:Oxygen,Carbon dioxide,Nitrogen

Explanation:

4 0
3 years ago
Discuss the organizational system that you believe would be the most effective for the safety officer in a medium-sized (100-200
marin [14]

Answer:

A safety manager is a person who designs and maintains the safety elements at workplace. A balance should be required for production and the job in providing work environment. As a safety officer in a medium sized manufacturing facility the following organizational system can be designed and maintained:

  • Maintaining a workplace as per the guidelines by Occupational safety and health association. The rules and regulation should be such that maintains the manufacturing facilities.  
  • For warning to workers proper labelling, floor mapping, signs, posters should be used.  
  • Procurement and usage of safe tools.  
  • A guideline that describes safety standard and precautionary measures should be available to the workers. They should be aware about all the steps that needs to be taken in crisis.  
  • Ensuring that the workers have enough training safety and health or accident prevention.  
  • Identify and eliminate the hazardous elements from the workplace.  
  • A strict action should be taken against the worker in case of violation of rules and not adhering with guidelines.

3 0
3 years ago
What else will change, if you change the point of view
JulijaS [17]

Answer:

We would need background context,

Explanation:

Then I would be happy to help!

4 0
3 years ago
Use the graph to determine which statement is true about the end behavior of f(x).
Airida [17]

Answer:

As the x-values go to negative infinity, the function’s values go to positive infinity.

Explanation:

if the ans choices are:

As the x-values go to negative infinity, the function’s values go to negative infinity.

As the x-values go to negative infinity, the function’s values go to positive infinity.

As the x-values go to positive infinity, the function’s values go to negative infinity.

As the x-values go to positive infinity, the function’s values go to zero.

the ans is the 2nd choice

4 0
3 years ago
Read 2 more answers
Other questions:
  • Water flows down a rectangular channel that is 1.2 m wide and 1 m deep. The flow rate is 0.95 m/s. Estimate the Froude number of
    15·1 answer
  • The value of the critical Reynolds number for the flow over a flat plate is 5 x10^5. The significance of the value is:
    13·1 answer
  • Considering the two tables below called Orders and OrderLines, how many rows would be returned by this SQL query? SELECT o.Order
    10·1 answer
  • Consider a step pn junction made of GaAs at T = 300 K. At zero bias, only 20% of the total depletion region width is in the p-si
    11·1 answer
  • Differentiate between isohyetal method and arithmetical average method of rainfall​
    10·1 answer
  • Name the famous engineer in the world​
    10·2 answers
  • Con que otro nombre se le conoce a los delitos informaticos
    5·1 answer
  • If y varies inversely as x, and y =23 when x=8, find y when x=4
    14·1 answer
  • Which of the following is true regarding screw gauges and shank?
    5·1 answer
  • Can someone please help!
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!