Write a program in Java. The program should purcahase uniforms for a baseball te
ID: 3802998 • Letter: W
Question
Write a program in Java. The program should purcahase uniforms for a baseball team. The user will enter the shoe cost, the shirt/pants combo cost and te hat cost and the number of players. Calculate the total cost for the uniforms and add 7 percent sales tax. display the final cost. Write three versions of the program: one with simple java, other with dialog boxes, and the other with classes.
Explanation / Answer
Simple java program: We just to ask the user for the costs, read them, calculate the total cost and display the final cost. Below is the code.
Dialog boxes: The only difference is to scan the input from dialog box instead of the console. We can use JOptionPane to do that.
Classes: We need to modularize the code with classes. One simple way is to extract the uniform cost calculation into a separate class.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.