Practical work 1For this first practical work, you are asked to program a counter of '0' and '1' from an input character string.The practical work can be done alone, or in groups of two, at your...

file


Practical work 1 For this first practical work, you are asked to program a counter of '0' and '1' from an input character string. The practical work can be done alone, or in groups of two, at your discretion. When handing in, clearly indicate who is in the group handing in the work. Topic The program will detect the end of input via the '$' character. As soon as it encounters it, it will display a summary of the characters counted, then it will stop. Two modes of operation will be expected: 1: Ignore invalid characters 2: Stop as soon as you encounter an invalid character Invalid characters in our case will be anything other than '0', '1', or '$'. To choose the mode of operation, we ask the user what he wants. The menu should have two options: Ignore as choice 1, and Stop as choice 2. The user will then have to enter his choice. If he enters an invalid choice, we will display an error message, then we will ask him to enter his choice again. Before counting the characters, all characters that are neither '0', nor '1', nor '$' must be ignored until the first valid character to evaluate the input, after which the chosen mode will be taken into account. 1 Translated from French to English - www.onlinedoctranslator.com https://www.onlinedoctranslator.com/en/?utm_source=onlinedoctranslator&utm_medium=pdf&utm_campaign=attribution Examples The following examples are to be run on your program in PEP/8. The tests will be executed in Batch I/O. 2 The entry is to be copied/pasted as is in the boxbatch I/O,and the output will compare to what comes with the topic. The tests that you will find in the directory delivered with the archive will be run in the same way. Example 1 Hall: 11101011010101$ Exit: Choose what to do in case of invalid character: 1) Ignore 2) Reject Choice? Number of 0: 5 Number of 1: 8 Example 2 Hall: a211i1$ Exit: Choose what to do in case of invalid character: 1) Ignore 2) Reject Choice? Wrong entry Invalid entry 3
Oct 06, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here