Question: Read this exercise carefully and take your time to work out the logic. Your chapter 1 0 folder contains versions of software 2 . html
Read this exercise carefully and take your time to work out the logic. Your chapter folder contains versions of softwarehtml and softwarephp as well as a text file named orders.txt which contains a list of software orders. Each line in the file contains the name of an operating system Linux Windows, or macOS followed by a colon, followed by the number of copies ordered, for example:
macOS:
This exercise also processes orders.txt but this time you are asked to develop a WHILE loop that contains selection structures. Add the necessary code to softwarephp to process the data in orders.txt and count the number of orders that request more than one copy, the number of copies of Linux software ordered, the number of copies of macOS software ordered, and the number of copies of Windows software ordered. The correct counts are orders with multiple copies, copies of Linux, copies of macOS, and copies of Windows but your code should still work correctly if you change the data in the file The output and some other statements have been provided to save time.
Not sure what to do Use your text editor to open orders.txt Now take a piece of paper and pencil, and solve the problem as if you are the softwarephp program. Each time you read a line from the file and identify the operating system and number of copies, what test should you use to decide whether or not to increment the variable that is counting the number of orders with more than one copy? Should you increment this count by or by the number of copies? And then, what tests will you need to decide which operating system this order is for, and what value should you add to the total number of copies for that operating system? HINT: Review the processwages example in the chapter, but note that you will need multiple tests to count the number of orders with more than one copy, and to decide whether to add the number of copies to your Window, macOS, or Linux totals.
orders.txt is
Linux:
macOS:
Windows:
macOS:
macOS:
Linux:
macOS:
Windows:
macOS:
Windows:
Windows:
Linux:
macOS:
Linux:
Windows:
macOS:
Windows:
Linux:
macOS:
Windows:
Software
SOFTWARE ORDERS: REPORT";
print
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
