Your goal is to solve the following simple programming exercise. You have been a
ID: 3635562 • Letter: Y
Question
Your goal is to solve the following simple programming exercise. You have been asked by your accounting department to design an algorithm determining the annual profit for your company. The algorithm should ask the user for the projected monthly sales for 12 months. Then, you need to determine the annual profit and display it to the user. The annual profit is 21% of the total sales.write the monthly sales amounts to a file, monthly_Sales.dat. (Hint: be sure to enter a sentinel value for end of file processing later.)
Explanation / Answer
Algorithm:
1. declare variables sales, profit, and file pointer.
2. ask user for input and read the values into sales
3. profit = 0.21 x sales
4. display profit to user
5. open new file in write mode using the file pointer with required name
6. write the same line that was displayed into the file
7. close the file
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.