Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Add a new package named hw2p4 to the project. a. Add a public class called Max without a main to the hw2p4 package. b.

image text in transcribed
1. Add a new package named hw2p4 to the project. a. Add a public class called Max without a main to the hw2p4 package. b. Define a public, non-static, non-void method called maxOfThree with three parameters of type int to return the maximum of three integers: public int max3(int a, int b, intc) C. You must not use any built-in method, such as Math.max(), for the maxOfThree method. 2. Add a public launcher class called MaxMain with a main to the hw2p4 package. a. Write code for the main method to print the maximum of five integers (i.e., 10, 5, 15, 20,5) and nine integers (i.e., 10, 5, 15, 20, 5, 25, 20, 10, 30). b. The code must include only calls to the method maxOfThree of the Max class and a few System.out.println() statements. C. The output should look like the one below: The max of 10, 5, 15, 20, 5 is 20 The max of 10, 5, 15, 20, 5, 20, 10, 30 is 30 3. Copy the Max class and paste it onto the hw2p4 package with a new name Max2. a. Open the Max2 class in the editor and remove the access modifier public so the class definition looks like: class Max2 { } b. A class without any access modifier is called the package private class. 4. Add a new package called hw2p41 to the project. a. Copy the MaxMain class from the hw2p4 package and paste it onto the hw2p41 package. b. Modify the code of the main method to call the maxOfThree method of the Max2 class along with a few System.out.println() statements. It will raise an error. c. Add a text file named why.txt to the hw2p41 package and explain the reason for the error in the file

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing

Authors: David M. Kroenke, David Auer

11th Edition

B003Y7CIBU, 978-0132302678

More Books

Students also viewed these Databases questions

Question

10. Describe the relationship between communication and power.

Answered: 1 week ago