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
A parallel circuit has a resistance of 280 and an inductive reactance of 360 02. What's this circuit's impedance?
Doss [256]

Answer:

540 W

Explanation:

4 0
3 years ago
Which of the following situations best describes student engaged in active learning
ioda

A situation which best describes a student that is engaged in active learning is: C. a student records questions to ask the teacher about a concept.

<h3>What is a question?</h3>

A question can be defined as a group of words or sentence that are developed, so as to elicit an information in the form of answer from an individual such as a student or teacher.

This ultimately implies that, questions are primarily formulated by professionals to test the understanding of an individual. Also, questions should be formulated by a good reader or student so as to enable him or her connect to a story and understand a concept better.

In this context, we can reasonably infer and logically deduce that a situation which best describes a student that is engaged in active learning is when a student records questions to ask the teacher about a concept.

Read more on questions here: brainly.com/question/9044572

#SPJ1

Complete Question:

Which of the following situations best describes a student engaged in active learning?

A. A student uses only one of the resources provided by the teacher.

B. A student skips parts of the lesson that she finds difficult.

C. A student records questions to ask the teacher about a concept.

D. A student does not discuss math outside of the lesson.

3 0
1 year ago
Which of the following is not true about manufacturing employment in the U.S?
MakcuM [25]

Explanation:

If I guessed, I'd say the answer is choice (a).

The change in skills required to perform new tasks in manufacturing, along with import competition and a decline in mobility, have contributed to the decline of employment rate for manufacturing since 2000

4 0
2 years ago
g An analog voice signal, sampled at the rate of 8 kHz (8000 samples/second), is to be transmitted by using binary frequency shi
slamgirl [31]

Answer:

The module is why it’s goin to work

Explanation:

4 0
2 years ago
For the following circuit diagram, if A=010 , B= 101.
Fantom [35]

Answer:

cgghhhh chick jjkkkkkki

4 0
2 years ago
Other questions:
  • Most licensed architects are members of which association?
    13·2 answers
  • A small wind tunnel in a university’s undergraduate fluid flow laboratory has a test section that is 20 in. by 20 in. in cross s
    8·1 answer
  • Which is the correct order for handwashing
    11·2 answers
  • A coin placed 30.8 cm from the center of a rotating, horizontal turntable slips when its speed is 50.8 cm/s.
    12·1 answer
  • Ok I need a new laptop but I'm not sure which one. The Surface laptop 3 is better in many fields like the camera, speaker, audio
    14·1 answer
  • Many of the products that we eat and drink are advanced manufactured products. Is this statement TRUE or FALSE?
    12·1 answer
  • Who invented a control unit for an artificial heart?<br> ements<br> ante
    8·1 answer
  • Witch one is cuter compared to ur opinion calico kitten or grey?​
    5·1 answer
  • Who is the strongest avenger i say hulk but who knows at this point
    7·2 answers
  • ¿Por qué la lógica de proposiciones es conocida también como lógica de las proposiciones sin analizar?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!