Question: 6.4 Procedure 6.4.1 Exercise 1: If...Else... Structure Write a program that first prompts a user to select a type of candy from a list. Then
6.4 Procedure 6.4.1 Exercise 1: If...Else... Structure Write a program that first prompts a user to select a type of candy from a list. Then it will prompt the user on how they will pay for the selected candy. The program will output the correct change based on the selected candy and payment entered. REQUIREMENT: Use the if..else statement for decision making (not the switch statement). Sample Output 1: Select a candy from the list below: 1 - Snarties ($0.50) 2 - M&M's Selection? 2 How are you going to pay for these M&M's? 1 - Loonie 2 - Toonie Selection? 1 You will get the following change: $ 0.25 Your program should contain: 1. Your name, lab #. program description and comments for blocks of code: You can use the single line comment (l) or the multi line comment (/* ... *) 2. Good spacing of sections of code 3. Proper indentation of lines of code 4. Good variable names (descriptive, but not too long) 6.4 Procedure 6.4.1 Exercise 1: If...Else... Structure Write a program that first prompts a user to select a type of candy from a list. Then it will prompt the user on how they will pay for the selected candy. The program will output the correct change based on the selected candy and payment entered. REQUIREMENT: Use the if..else statement for decision making (not the switch statement). Sample Output 1: Select a candy from the list below: 1 - Snarties ($0.50) 2 - M&M's Selection? 2 How are you going to pay for these M&M's? 1 - Loonie 2 - Toonie Selection? 1 You will get the following change: $ 0.25 Your program should contain: 1. Your name, lab #. program description and comments for blocks of code: You can use the single line comment (l) or the multi line comment (/* ... *) 2. Good spacing of sections of code 3. Proper indentation of lines of code 4. Good variable names (descriptive, but not too long)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
