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 chapter10 folder contains versions of software2.html and software2.php 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:2
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 software2.php 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 8 orders with multiple copies, 13 copies of Linux, 23 copies of macOS, and 16 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 software2.php 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 1 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 process-wages5 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:1
macOS:1
Windows:1
macOS:1
macOS:2
Linux:5
macOS:10
Windows:10
macOS:1
Windows:1
Windows:1
Linux:1
macOS:5
Linux:4
Windows:1
macOS:1
Windows:1
Linux:2
macOS:2
Windows:1```
Software2
SOFTWARE ORDERS: REPORT");
print ("
Read this exercise carefully and take your time

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!