Concept explainers
Write one or more C++ statements that assign the correct value to discount, using the logic described here:
Assign .20 to discount if dept equals 5 and price is $100 or more.
Assign .15 to discount if dept is anything else and price is $100 or more.
Assign .10 to discount if dept equals 5 and price is less than $100.
Assign .05 to discount if dept is anything else and price is less than $100.
Want to see the full answer?
Check out a sample textbook solutionChapter 4 Solutions
Starting Out with C++: Early Objects (9th Edition)
Additional Engineering Textbook Solutions
Elementary Surveying: An Introduction To Geomatics (15th Edition)
INTERNATIONAL EDITION---Engineering Mechanics: Statics, 14th edition (SI unit)
Mechanics of Materials (10th Edition)
Problem Solving with C++ (10th Edition)
Vector Mechanics for Engineers: Statics
Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)
- (Data processing) Years that are evenly divisible by 400 or are evenly divisible by 4 but not by 100 are leap years. For example, because 1600 is evenly divisible by 400, 1600 was a leap year. Similarly, because 1988 is evenly divisible by 4 but not by 100, it was also a leap year. Using this information, write a C++ program that accepts the year as user input, determines whether the year is a leap year, and displays a message telling the user whether the entered year is or is not a leap year.arrow_forwardUsing C++ programming Language: Write the code for a game called “ASCII Strength” of a four-letter word selected by Player 1 followed by a four-letter word selected by Player 2. The result would be the sum of the ASCII value of each of the letters of the selected words and whoever has higher sum (called ASCII strength) wins.arrow_forwardC++ Programming Exercise: When you borrow money to buy a house, a car, or for some other purpose, you repay the loan by making periodic payments over a certain period of time. Of course, the lending company will charge interest on the loan. Every periodic payment consists of the interest on the loan and the payment toward the principal amount. To be specific, suppose that you borrow $1,000 at an interest rate of 7.2% per year and the payments are monthly. Suppose that your monthly payment is $25. Now, the interest is 7.2% per year and the payments are monthly, so the interest rate per month is 7.2/12 = 0.6%. The first month's interest on $1,000 is 1000 X 0.006 = 6. Becuase the payment is $25 and the interest of the first month is $6, the payment toward the principal amount is 25-6 = 19. This means after making the first payment, the loan amount is 1,000-19 = 981. For the second payment, the interest is calculated on $981. So the interest for the second month is 981 X 0.006 = 5.886,…arrow_forward
- Please answer in C++arrow_forwardProgramming Language: C++arrow_forwardBuilt in C++ using just if conditional: A fashion store is on promotion with all its clothes. If I buy three items I get a 50% discount on the two cheapest items. It is required to make a program that allows the user to enter the price of three items to be purchased and must show the value that must be paid for each item, the total to be paid and the total value of the discount. The program must validate that the prices entered are valid. Examples Original price 1: $125 2: $98 3: $132 Price to Pay: 1: $62.5 2: $49 3: $132 Total: $243.5 Discount: $111.5 Original price 1:$42 2: $89 3: $64 Price to Pay: 1:$21 2: $89 3: $32 Total: $142 Discount: $53 Original price 1: $111.8 2: $104.2 3: $78.6 Price to Pay: 1: $111.8 2: $52.1 3: $39.3 Total: $203.2 Discount: $91.4arrow_forward
- Using C++ Write a program that plays a dice game called "21" It is a variation on BlackJack where one player plays against the computer trying to get as close to 21 as possible without going over. Here are the rules of the game: You will play with dice that have numbers from 1 to 11. To win, the player or the computer has to get to 21, or as close as possible without going over. If the player or computer goes over 21, they instantly lose. If there is a tie, the computer wins. Starting the game: The player is asked to give the computer a name. For now, we'll simply call the computer opponent, "computer." The game starts with rolling four dice. The first two dice are for the player. These two dice are added up and the total outputted to the screen. The other two dice are for the computer. Likewise, their total is outputted to the screen. Player Loop: If a total of 21 has been reached by either the player or the computer, the game instantly stops and the winner is…arrow_forwardGET THE C++ CODE 1. A student took four quizzes in a term and would like to compute their average. He also would like to know what will be the remarks. Follow the range of grades and its equivalent remarks, and then fill-up the table below: 100-95 - Excellent 94-90 – Very Satisfactory 89-85 - Satisfactory 84-80 - Fine 79-75 - Fair 74 and below – Poor Answer the following: What statement in the program that determines that the average is passing? What was the condition applied to satisfy the requirement? What have you observed in using if-else statement in this program? What have you observed in using nested if statement in this program?arrow_forwardIn C++, write a program that converts a temperature from degrees Fahrenheit to degrees Celsius. The formula for converting the temperature from Fahrenheit to Celsius is: celsius = (5/9) (fahrenheit - 32). The program should prompt the user to enter a temperature in Fahrenheit as an integer. It will output the temperature in both Fahrenheit and Celsius. Round decimal values to 4 decimal places.arrow_forward
- Ineed help programming this C++ program: Write a C++ console application that calculates and displays the charges for using a parking garage. The parking garage charges a $3.00 minimum fee to park for up to three hours. The garage charges an additional $0.85 per hour or fraction of an hour in excess of three hours. The maximum charge for any given 24-hour period is $20.00. You may assume that no car parks for longer than 24 hours at a time. Your program will use a function named calculateCharges to determine the charges based on the amount of time the car was parked. Your program will prompt the user for the number of hours parked in the garage. It will then display the parking charges for that transaction. Keep track of the number of transactions as well as accumulating the number of hours parked and the parking charges. Your program will execute repeatedly until the user enters a value for the number of hours parked that is less than or equal to zero. Your program will then display…arrow_forwardC++arrow_forwardDirections: Write a program that will perform a casino game using C or C++. Provide comments in the codeexplaining everything. See above deliverable instructions. Requirements: A menu will first appear asking the user to choose which game they would like to play. The userwill be able to choose between blackjack and roulette.The blackjack game will only play one hand at a time against the dealer. If the dealer and the user have the same,then it’s a draw. If you do not know how to play blackjack, then you might need to research the game.The roulette game will ask the user what numbers they would like to bet on. If the random number is chosen, thenthe user wins.Each game should ask the user how much money they would like to bet before the game starts. The user shouldhave a starting amount of money, once the user loses their money, the user will then need to stop playing.arrow_forward
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrProgramming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage Learning