Question: Write the Java code for a method with the signature shown below that calculates and returns the average of all of the elements in an

 Write the Java code for a method with the signature shown

Write the Java code for a method with the signature shown below that calculates and returns the average of all of the elements in an integer array using an enhanced for loop. public static double average( int array) Given the UML diagram below, write the class definition for the Room class. Include only the attributes, constructor, and methods shown The formatRoom() method will return a single String containing the number and building attributes concatenated in the format: 123 Stright Write the class definition for the Professor class. Include attributes and only the attributes, constructor and methods shown. The getoffice() method returns the room using the formatRoom() method of the Room class. Professor Room -name: String -office: Room -number: String building:String +Professor( name: String, office: Room ) +getName0: String +getOfficel): Room +Roomi number: String, building: String) +formatRcom): String Assume the Professor and Room classes in the previous question are correctly defined. Write the code for a user program. First, instantiate a Room object for "109 Fine Hall". Next, instantiate a Professor object for "Albert Einstein" using the Room object you just created. Finally, print the report shown below using the appropriate getters and formatting. [Hint: The two important concepts are (1) properly using the classes, and (2) formatting ouput to produce the report.] 4. Professor: Albert Einstein Office: 109 Fine Hal1

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!