Programming Homework Help

University of Texas at San Antonio Create a Java Program Computer Programming Task

Get Your Custom Essay Written From Scratch
We have worked on a similar problem. If you need help click order now button and submit your assignment instructions.
Just from $13/Page
Order Now

Your program should consist of three files: Substance.java, Milk.java, and Tester.java. Once you have completed this program, attach these files with this question.

Refer to the UML class diagram included under the Exams section of the course.

1. Write the Substance interface, which consists of the single abstract method listed in the UML class diagram.

2. Write the Milk class, which implements the Substance interface.

3. The Milk class contains a single field: pH. Initialize this field to 6.5.

4. Implement the behavior for the checkpH method. This method checks if the pH is less than 7, greater than 7, or equal to 7.

a. If the pH is less than 7, return 0.

b. If the pH is equal to 7, return 1.

c. If the pH is greater than 7, return 2.

5. Implement the toString method to return a statement about the ph of milk, such as “The pH of milk is 6.5.” Make sure you are using the field in place of the value 6.5.

6. In the Tester class, construct an object of the Milk class.

7. Display the state of the object by printing this object to the console. This will involve the use of the toString method.

8. Use the checkpH method to indicate if milk is basic, neutral, or acidic.

a. If the value 0 is returned, print the following String: “Milk is basic.”

b. If the value 1 is returned, print the following String: “Milk is neutral.”

c. If the value 2 is returned, print the following String: “Milk is acidic.”