This question is to verify your understanding of Boolean expressions and simple
ID: 3565917 • Letter: T
Question
This question is to verify your understanding of Boolean expressions and simple if/else statements. For the following problem assume you have the following variables: int x = 3, y = 6, z = 4; What is the result of the following Boolean Expressions in C++ (true/false for a-d)? This question is to help you read and trace code as it is executed with various inputs. Download and run the Names.cpp program from Blackboard. Which sections get executed (refer to section numbers in comments of Names.cpp) for the following input? What is the output when the input is used? What does this program do? How does C++ compare strings? In your answer you should also explain how it compares chars. How would you modify the if/else portion of the program so that it displays the strings in the opposite order? (It is not enough to change the output at the end) Submit your modified program as comments above the program in Part II. Important: Start early so that you can complete the program in time. Also, you are welcome to talk to me if you need more clarifications about the assignment. I) Suppose you are given a contract to develop a system that generates bills for a cellular phone company. The company has three subscriptions packages: Package A: For $9.95 per month 10 hours of free calls are provided. Additional hours are $2.00 per hour. Package B: For $14.95 per month 20 hours of free calls are provided. Additional hours are $1.00 per hour. Package C: For $19.95 per month unlimited access is provided. Write a program that will ask the user for the customer's phone number, how many hours were used, the customer's name, and which package the customer has. It should then calculate the total amount due and create a bill formatted as given in the sample runs below. Also, if the customer has Package A and they would save money by switching to Package B or C, the amount they would save by switching to each plan should be displayed on the bill. Similarly, if a customer has Package B and would save money by switching to Package C, then the amount the customer would save by switching to Package C should be displayed on the bill. If there would be no savings, then no message should be printed. Input Validation: Be sure the user enters a number between 0 and 744 for the number of hours used. If the user enter a number less than 0, the program should exit displaying "Invalid Hours. Number of hours must be positive." If the number is greater than 744, the program should exit displaying "Invalid Hours. There are at most 744 hours in a month." and "The hours entered must be less than 744." on separate lines. Input Validation: Be sure that the user only selects A, B, or C. The program should also accept a, b, or c. If an invalid package is selected the program should exit and display "Invalid package entered. Valid packages are A, B, or C."Explanation / Answer
1(a). false
(b). true
(c). false
(d). true
(e). x=3,y=12
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.