Question: Write a program that asks the user to enter the weekly sales goal for his/her coffee shop. Your program should then prompt the user to
Write a program that asks the user to enter the weekly sales goal for his/her coffee shop. Your program should then prompt the user to enter the name of an input file where his or her weekly sales numbers are stored. Once the user enters a valid input file name, a loop should be used to sum the sales numbers in the file by keeping a running total (using an accumulator variable). When the loop finishes, the program should display the sales goal, the weekly sales and a message that states if the sales goal was accomplished or not.


Lab 8: Coffee-Shop Sales-Goal Calculator Write a program that asks the user to enter the weekly sales goal for his/her coffee shop. Your program should then prompt the user to enter the name of an input file where his or her weekly sales numbers are stored. Once the user enters a valid input file name, a loop should be used to sum the sales numbers in the file by keeping a running total (using an accumulator variable). When the loop finishes, the program should display the sales goal, the weekly sales and a message that states if the sales goal was accomplished or not. If the user enters an invalid input file name, then your program should display the message, Invalid input file name. Please try again., and then terminate Download and use the following input files from CourseWeb: weeklSalesData.txt week2SalesData.txt *Hint: See the code examples for Lecture 13 on CourseWeb, especially FileSum.java and FileSum2.java* Here are a few example runs (user input is given in>: 1. Welcome tthe Weekly Sales Goal Program! Enter the input file name:
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
