Reference no: EM13782884
Programming Problems
Follow these instructions for your programming problems:
· You must follow the good programming practices discussed in class. (Remember that in some places the book shows examples that include poor programming practices that are not allowed in this class!)
· You must include appropriate comments in your code.
· For each programming problem, you must create an output text file as discussed in the labs that will show your complete console.
· Be sure that you understand your program completely in English before you try to solve the problem in Java. It helps if you rewrite the problem statement in your own words before you begin coding. Be sure that you think about the explicitly defined information and the implied information from the problem statement.
Modified Milk Problem
Modify the main method in your Milk problem from Homework as follows:
· Be sure to fix any errors in your previous homework.
· The first line of the program after your variables have been declared and initialized should print out Milk Production for Your Name (except use your actual name).
· Use console input and output instead of GUI.
· Be sure to validate your input appropriately.
· The program should prompt the user at the beginning for the number of different milk quantities to evaluate in this one run of the program.
· For any milk quantity that exceeds 25 liters, the profit for each carton of milk increases by 50%.
· For any milk quantity that is lower than 5 liters, the cost for production of one liter of milk increases by 10%.
· The output of the program should be in the format shown below. The program must print out two blank lines between each Quantity of milk evaluated in the run of the program.
Quantity of Milk in liters: 15.85
Cost: $6.02
Profit: $1.08
When you have completed this project run your program for each value of liters of milk listed below. Save all output to a single text file to turn in with this assignment. Remember that your program must work for any numbers that are entered. These are just some samples to use for input to turn in with your homework.
· First run will evaluate the following quantities of milk in liters: 15.85
· Second run will evaluate the following quantities of milk in liters: 75.25, 13.32, 9.8
· Third run will evaluate the following quantities of milk in liters: 100.0, 3.75
Print out a copy of your source code and your output file to turn in with this assignment.