Starting Out with C++: Early Objects (9th Edition)
9th Edition
ISBN: 9780134400242
Author: Tony Gaddis, Judy Walters, Godfrey Muganda
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
Chapter 4, Problem 2RQE
If the resultant value of relational expression is 0, then the expression is “False”, if the resultant value of relational expression is 1, then the expression is “True”.
Program Plan Intro
Relational Operators:
Relational operators are used to compare numeric and character values using the following operators:
- Greater than (>)
- Less than (<)
- Greater than or equal to (>=)
- Less than or equal to (<=)
- Equal to (==)
- Not equal to (!=)
These operators will determine whether specific relationship exists between two values of same type.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
The operators that you use to compare values are called ________________ operators.
Financial Assistance Application
Create the Financial Assistance Application. A non-governmental organization
needs your application to calculate the amount of financial assistance for needy
families. The formula is as follows:
• If the annual household income is between $30,000 and $40,000 and the house-
hold has at least three children, the amount is $1,000 per child.
• If the annual household income is between $20,000 and $30,000 and the house-
hold has at least two children, the amount is $1,500 per child.
• If the annual household income is less than $20,000, the amount is $2,000 per
child.
Implement a function for this computation. The program asks for the household
income and number of children for each applicant, printing the amount returned
by your function. Use -1 as a sentinel value for the input. The program output
should be formatted as shown in the Sample Run.
Note: You must use at least one function in your code.
Following code in C
using random Name Reg no and highschool name
Use switch case in C language to do the following:
Create a restaurant with the name “Your Name - Reg_No – Name of your highschool”
The restaurant should come with the options of delivery and take away and the choice should be displayed as “Delivery – Registration No” and “Takeaway – Name”
Each option should have the same menu and an extra 15% charge be included if a customer wants home delivery
Both menus should have two items that are customizable, such as a burger can have chillies removed, cheese added and extra mayonnaise.
The user should have the option of choosing multiple items with multiple quantity.
Print a bill in the end.
Chapter 4 Solutions
Starting Out with C++: Early Objects (9th Edition)
Ch. 4.1 - Prob. 4.1CPCh. 4.1 - Indicate whether each of the following statements...Ch. 4.1 - Prob. 4.3CPCh. 4.1 - What will the following program segment display?...Ch. 4.2 - Write an if statement that performs the following...Ch. 4.2 - Write an if statement that multiplies payRate by...Ch. 4.2 - Write an if statement that performs the following...Ch. 4.2 - TRUE or FALSE: Both of the following if statements...Ch. 4.2 - Write an if statement that performs the following...Ch. 4.2 - Write an if statement that prints The performance...
Ch. 4.2 - Although the following code segments are...Ch. 4.3 - Write an if/else statement that assigns 0.10 to...Ch. 4.3 - Write an if / else statement that assigns 1 to x...Ch. 4.3 - Write an if /else statement that assigns .10 to...Ch. 4.3 - True or false: The following if / else statements...Ch. 4.3 - Will the if / else statement shown on the right...Ch. 4.4 - What will the following program segment display?...Ch. 4.4 - The following program is used in a bookstore to...Ch. 4.4 - Write an if/else if statement that carries out the...Ch. 4.4 - Write an if/else if statement that performs the...Ch. 4.6 - If you execute the following code, what will it...Ch. 4.6 - If you execute the following code, what will it...Ch. 4.7 - Prob. 4.23CPCh. 4.7 - If a = 2, b = 4, and c = 6, indicate whether each...Ch. 4.7 - If a = 2, b = 4, and c = 6, is the following...Ch. 4.7 - Rewrite the following using the ! operator so that...Ch. 4.9 - Write an if statement that prints the message The...Ch. 4.9 - Write an if statement that prints the message The...Ch. 4.9 - Find and fix the errors in the following code...Ch. 4.10 - Prob. 4.30CPCh. 4.10 - Indicate whether each of the following relational...Ch. 4.10 - Prob. 4.32CPCh. 4.10 - Indicate whether each of these character testing...Ch. 4.11 - Rewrite the following if / else statements as...Ch. 4.11 - Rewrite the following conditional expressions as...Ch. 4.11 - Prob. 4.36CPCh. 4.12 - Explain why you cannot convert the following i...Ch. 4.12 - What is wrong with the following switch statement?...Ch. 4.12 - What will the following program segment display?...Ch. 4.12 - Complete the following program segment by writing...Ch. 4.12 - Rewrite the following program segment using a...Ch. 4.13 - Prob. 4.42CPCh. 4.13 - Follow the instructions to complete the following...Ch. 4 - An expression using the greater-than, less-than,...Ch. 4 - Prob. 2RQECh. 4 - The if statement regards an expression with the...Ch. 4 - For an if statement to conditionally execute a...Ch. 4 - In an if / else statement, the if part executes...Ch. 4 - The trailing else in an if / else if statement has...Ch. 4 - If the subexpression on the left of the logical...Ch. 4 - If the subexpression on the left of the || logical...Ch. 4 - The ____ logical operator has higher precedence...Ch. 4 - Logical operators have _____ precedence than...Ch. 4 - The _____ logical operator works best when testing...Ch. 4 - The _____ logical operator works best when testing...Ch. 4 - A variable with _____ scope is only visible when...Ch. 4 - The expression that is tested by a switch...Ch. 4 - A program will fall through to the following case...Ch. 4 - Prob. 16RQECh. 4 - Write an if statement that assigns 100 to x when y...Ch. 4 - Write an if/else statement that assigns 0 to x...Ch. 4 - Write an if / else statement that prints Excellent...Ch. 4 - Write an if statement that sets the variable hours...Ch. 4 - Convert the following conditional expression into...Ch. 4 - Convert the following if/else if statement into a...Ch. 4 - Assume the variables x = 5, y = 6, and z = 8....Ch. 4 - Assume the variables x = 5, y = 6, and z = 8....Ch. 4 - Write a C++ statement that prints the message The...Ch. 4 - Prob. 26RQECh. 4 - Write a C++ statement that prints the message The...Ch. 4 - Prob. 28RQECh. 4 - Using the following chart, write a C++ statement...Ch. 4 - Write one or more C++ statements that assign the...Ch. 4 - The following statement should determine if x is...Ch. 4 - The following statement should determine if count...Ch. 4 - The following statement should determine if count...Ch. 4 - The following statement should determine if x has...Ch. 4 - Each of the following program segments has errors....Ch. 4 - Sometimes either a switch statement or an if /else...Ch. 4 - Minimum / Maximum Write a program that asks the...Ch. 4 - Roman Numeral Converter Write a program that asks...Ch. 4 - Magic Dates The date June 10, 1960, is special...Ch. 4 - Areas of Rectangles The area of a rectangle is the...Ch. 4 - Book Club Points An online book club awards points...Ch. 4 - Change for a Dollar Game Create a change -counting...Ch. 4 - Time Calculator Write a program that asks the user...Ch. 4 - Math Tutor Version 2 This is a modification of the...Ch. 4 - Software Sales A software company sells a package...Ch. 4 - Bank Charges A bank charges 15 per month plus the...Ch. 4 - Prob. 11PCCh. 4 - Color Mixer The colors red, blue, and yellow are...Ch. 4 - Running the Race Write a program that asks for the...Ch. 4 - Personal Best Write a program that asks for the...Ch. 4 - February Days The month of February normally has...Ch. 4 - Body Mass Index Write a program that calculates...Ch. 4 - Fat Gram Calculator Write a program that asks for...Ch. 4 - Prob. 18PCCh. 4 - The Speed of Sound in Gases When traveling through...Ch. 4 - Spectral Analysis If a scientist knows the...Ch. 4 - Freezing and Boiling Points The following table...Ch. 4 - Mobile Service Provider A mobile phone service has...
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- CODE : def days_in_feb(user_year): is_leap_year = 29 not_leap_year = 28 if user_year % 4 ==0: return is_leap_year elif user_year % 4 ==0 and user_year % 100 == 0 and user_year % 400 == 0: return is_leap_year else: return(not_leap_year) if __name__ == '__main__': # Type your code here. Your code must call the function. user_year = int(input()) days = days_in_feb(user_year) print(user_year,'has', days, 'days in February.') ERROR OUTPUT IS NOT WORKING FOR YEAR 1900 Input 1712 Your output 1712 has 29 days in February. Your output days_in_feb(1913) correctly returned 28 days_in_feb(1600) Your output days_in_feb(1600) correctly returned 29 4: Unit testkeyboard_arrow_up 0 / 3 days_in_feb(1900) Your output days_in_feb(1900) incorrectly returned 29arrow_forwardGPA Calculator Students are concerned about their GPA. They need to calculate it accurately every semester to monitor their progress. Develop a GPA calculator that follows the AOU regulations (AOU-OU Grade Scale) using C# programming language. The application asks the student to enter his numeric grade of each course and the course's credit hours. Accordingly, the application calculates the student's GPA after converting the numeric grade to letter grade. The GPA calculation should produce floating-point results. Display the results rounded to the nearest hundredth. You should store the letter grades of all student's courses in an array. The final grade of the student should be also calculated. Sample I/O Enter the course grade (-1 to end): 93 Enter the course credit hours: 3 Enter the course grade (-1 to end): 74 Enter the course credit hours: 2 Enter the course grade (-1 to end): 60 Enter the course credit hours: 3 Enter the course grade (-1 to end): -1 The grades of your courses…arrow_forwardWhat does it mean when a value is assigned to something using the Assignment operator?arrow_forward
- The -= operator is an example of a(n) __________ operator.a. relationalb. augmented assignmentc. complex assignmentd. reverse assignmentarrow_forward99 question Reza Enterprises sells tickets for buses, tours, and other travel services. Because Reza frequently mistypes long ticket numbers, Reza Enterprises has asked his students to write an application that shows if a ticket is invalid. Your application/program tells the ticket agent to enter a six-digit ticket number. Ticket numbers are designed so that if you lose the last digit of the number, then divide by 7, the remainder of the division is exactly the same to the last dropped digit. This process is shown below: Step 1: Enter the ticket number; for example 123454 Step 2: Remove the last digit, leaving 12345 Step 3: Determine the remainder when the ticket number from step 2 is divided by 7. In this case, 12345 divided by 7 leaves a remainder of 4. Step 4: Display a message to the ticket agent indicating whether the ticket number is valid or not. If the ticket number is valid, save the number to a .txt file called “tickets.txt” and.arrow_forwardCalling a function is also called ____ a function. Group of answer choices casting initializing invoking delegatingarrow_forward
- Please help in JavaScriptarrow_forwardIf the intNums array contains six elements, which of the following statements assigns the number 6 to the intElements variable? intElements = Len(intNums) intElements = Length(intNums) intElements = intNums.Len intElements = intNums.Lengtharrow_forwardPlease draw the correct flowchart for this game ? # Function to display question and answer def new_game(): guesses = [] Right_guesses = 0 question_num = 1 num = 1 for key in questions: print("\n------------------------- \n") print("Question " + str(num) + "\n" ) num += 1 print(key) for i in options[question_num-1]: print(i) guess = input("\nAnswer (A, B, C, or D): ") guess = guess.upper() guesses.append(guess) Right_guesses += check_answer(questions.get(key), guess) question_num += 1 display_score(Right_guesses, guesses) # ------------------------- # Function to check answer def check_answer(answer, guess): if answer == guess: print("\nYour Answer Correct!") return 1 else: print("\nYour Answer Wrong!") return 0 # ------------------------- # Function to display score def display_score(Right_guesses, guesses):…arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,Programming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:Cengage
- Programming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage LearningC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:9781337102124
Author:Diane Zak
Publisher:Cengage Learning
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning