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 converging-diverging nozzle has an area ratio of 5.9. (1) Determine the (P0/Pt) values corresponding to the 1st, 2nd, and 3rd
nata0808 [166]

Answer:

Check the explanation

Explanation:

The Total pressure is the overall of fixed or static pressure p, the dynamic pressure q, as well as gravitational head. Total pressure can also be referred to as the measure of the overall energy of the airstream, and is the same to static pressure plus velocity pressure.

kindly check the step by step solution in the attached image below to Determine the (P0/Pt) values corresponding to the 1st, 2nd, and 3rd critical points.

5 0
3 years ago
1. A thin plate of a ceramic material with E = 225 GPa is loaded in tension, developing a stress of 450 MPa. Is the specimen lik
mina [271]

Answer:

fracture will occur as the value is less than E/10 (= 22.5)

Explanation:

If the maximum strength at tip Is greater than theoretical fracture strength value then fracture will occur and if the maximum strength is lower than theoretical fracture strength then no fracture will occur.

\sigma_m = 2\sigma_o [\frac{a}{\rho_t}]^{1/2}

=  2\times 750 (\frac{\frac{0.2mm}{2}}{0.001 mm}})^{1/2}

                 = 15 GPa

fracture will occur as the value is less than E/10 = 22.5

7 0
3 years ago
Type the correct answer in the box. Spell all words correctly.
Otrada [13]

Answer:

solar engineering field

5 0
3 years ago
Read 2 more answers
A large fraction of the thermal energy generated in the engine of a car is rejected to the air by the radiator through the circu
Rina8888 [55]
Open system because there is mass (water) flowing through the system of interest (radiator)
5 0
3 years ago
The product life cycle defines the stages that new products move through as they enter, are established in, and ultimately leave
Bas_tet [7]

Answer:

The four marketing mix of every new business are:

1. Product

2. Place

3. Price

4. Promotion

For each of the stages of product life cycle, those 4p should be use appropriately.

Explanation:

The four marketing mix of every new business are:

1. Product

2. Place

3. Price

4. Promotion

the product life cycle are directly proportional to the 4p of marketing. the product life cycle stages are introduction, growth, maturity and decline.

For each of the stages of product life cycle, those 4p should be use appropriately.

Stages of product life cycle and how the 4p fit into it.

The introduction stage:

at this stage, a new product just want to be introduced to the consumers. the product stage has being developed. The place where the product will fit in will also be consider. the location of people who consume this product. Pricing strategy consider a low price at the introduction stage, the business owner may not get any profit at this stage. then, continuous advertisement to create awareness of the product to the environment.

The growth stage:

the product will continuing to be move to different locations. the standard of the product quality will be maintained. the Pricing will start increasing. then, continuous advertisement to create awareness of the product and working on improving the product to suit the consumer.

the Mature stage:

At this stage, the consumer are fully aware of the product. wide range of location are reach. the pricing has reach its peak. Profit have been maximized. And, competitors of the product are in the market. Corporate social responsibility (CSR) will be the promotional value at this stage.

The Declining stage:

The business product have fully grown to its peak, and its only constant promotional values like CSR, advertisement, bonuses, can sustain it in the market. At this stage also, price comparison with other competitor should be carefully look into.

4 0
3 years ago
Other questions:
  • Your task is to fill in the missing parts of the C code to get a program equivalent to the generated assembly code. Recall that
    5·1 answer
  • In order to avoid slipping in the shop, your footwear should __
    10·2 answers
  • The penalty for littering 15 lb or less is _____.<br> A. $25<br> B. $50<br> C. $100<br> D. $150
    14·1 answer
  • The major resisting force in gravity dam? ​
    14·2 answers
  • The current through a 10-mH inductor is 10e−t∕2 A. Find the voltage and the power at t = 8 s.
    15·2 answers
  • Why do engineers need to be particularly aware of the impact of hubris?
    8·1 answer
  • Air is compressed by a 30-kW compressor from P1 to P2. The air temperature is maintained constant at 25°C during this process as
    11·1 answer
  • Technician a says that diesel engines can produce more power because air in fuel or not mix during the intake stroke. Technician
    9·1 answer
  • In order to avoid a rollover, what is the highest degree incline one should mow on? 10-degree incline 5-degree incline 30-degree
    15·1 answer
  • In a long trip what is considered a life line to take with you.
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!