(Solved) : C Switch Case Lab Chapters Covered Basic C Syntax Basic Expressions Various If Amp Conditional Statements And Flags Switches . . .
Question Description
* Please read and thank you for your help*
Chapters Covered – ( Basic C++ syntax , Basic Expressions , various if – if else & conditional statements , and flags / switches)
!!! Please don’t use methods more advanced than what’s listed above !!!
////////////////////////////////////////////////////////// C++ “Switch and Case” Lab instructions
An on line music store offers the following package options:
Package A:
Price $4.99 per month. You get 10 free songs and $0.99 per song after that.
Package B:
Price $9.99 per month. You get 20 free songs and $0.59 per song after that.
Package C:
Price $14.99 per month. You get 30 free songs and $0.29 per song after that.
- In this lab you ask for the user of what package they have and how many songs they downloaded. Then you report the total due.
- Sales tax is 6%.
- You must use switch case for the package choice.
- Ifs are allowed AFTER that in your project (to see if the number of downloaded songs is legal, etc.).
- If you have an if statement (or conditional operator) inside the switch statement then you are doing something wrong.
- If you are using an if (or conditional operator) to distinguish what packet choice they have you are breaking the requirements.
- If you have repeated code you are doing something wrong. Future labs may need to have if inside the switch, but this one doesn’t not. See how the situation is handled in this handout that improves an example of a program found in your book so it no longer has repeated code.
- The switch is responsible for anything that has to do with the package choice. The if that you need to have after the switch should NOT have the package choice in its condition. It is there to see if the number of songs is legal, etc. Anything that depends on the package choice should be “resolved” in the switch!
- If there are not extra charges you don’t have to say anything (run the example exe with package A and 9 songs vs 11 songs).
- Have your code repeat for ever for easy testing. For instructions on how to have your code repeat for ever click
- Use constants when appropriate and use the EVERYWHERE instead of the corresponding literal!
- Try not to have duplicated/repetitive code!
- Do NOT mix the input phase with the processing phase and the output phase!
Expert Answer
Answer to C Switch Case Lab Chapters Covered Basic C Syntax Basic Expressions Various If Amp Conditional Statements And Flags Switches . . .
OR