C++ How to Program (Early Objects Version)
10th Edition
ISBN: 9780134448824
Author: Paul Deitel; Harvey M. Deitel
Publisher: Pearson Education (US)
expand_more
expand_more
format_list_bulleted
Concept explainers
Textbook Question
Chapter 2, Problem 2.28E
(Digits of an Integer) Write a
4 2 3 3 9
Expert Solution & Answer
Trending nowThis is a popular solution!
Students have asked these similar questions
(Financial: credit card number validation) Credit card numbers follow certain pat-
terns. A credit card number must have between 13 and 16 digits. It must start with:
4 for Visa cards
5 for Master cards
37 for American Express cards
6 for Discover cards
In 1954, Hans Luhn of IBM proposed an algorithm for validating credit card
numbers. The algorithm is useful to determine whether a card number is entered
correctly or whether a credit card is scanned correctly by a scanner. Credit card
numbers are generated following this validity check, commonly known as the
Luhn check or the Mod 10 check, which can be described as follows (for illustra-
tion, consider the card number 4388576018402626):
1. Double every second digit from right to left. If doubling of a digit results in a
two-digit number, add up the two digits to get a single-digit number.
4388576018402626
→ 2 * 2 = 4
→ 2 * 2 = 4
→ 4 * 2 = 8
→ 1 * 2 = 2
6 * 2 = 12 (1+ 2 = 3)
→ 5 * 2 = 10 (1+ 0 = 1)
→ 8 * 2 = 16 (1 + 6 = 7)
→ 4 * 2 = 8
(IN C LANGUAGE) Cumulative Addition: Computer selects a number between 7 and 23 at random. User will only add 2, 3 or 5 numbers to reach that number.For example: To reach 14:
User will enter 5 5 2 2 (4 input).Also he can enter 2 2 2 2 2 2 2 (7 input) or 3 3 3 3 2 (5 input).
https://www.bartleby.com/questions-and-answers/in-c-language-cumulative-addition-computer-selects-a-number-between-7-and-23-at-random.-user-will-on/0509c740-d993-44ed-a468-7e02da552600
[Calculate grades’ average for a student] write a program that calculates the student grades’ average for a semester for the number of courses taken in that semester. Your program should do the following:
1.Read from user the number of courses (n)
2. Then, read the courses’ grades for n times (Hint: use a loop)
3.If a grade is grater than 100 or less than 0, ask the user to enter the grade again.
4.Calculate the average of grades using the following formula:
average = (sum of grades) / n
5.Print out the average grade on the screen.
Note: Always use appropriate data types.
Chapter 2 Solutions
C++ How to Program (Early Objects Version)
Ch. 2 - Discuss the meaning of each of the following...Ch. 2 - Fill in blanks in each of the following: a)...Ch. 2 - Write a single C++ statement or line that...Ch. 2 - State which of the following are true and which...Ch. 2 - Fill in the blanks in each of the following: a)...Ch. 2 - What, if anything, prints when each of the...Ch. 2 - Which of the following statements contain...Ch. 2 - Given the algebraic equation y — ax 3 + 7. which...Ch. 2 - (OrderofEvaluation) State the order of evaluation...Ch. 2 - (Arithmetic) Write a program that asks the user to...
Ch. 2 - (Printing) Write a program that prints the numbers...Ch. 2 - (Comparing Integers) Write a program that asks the...Ch. 2 - (Arithmetic, Smallest and Largest) Write a program...Ch. 2 - (Diameter, Circumference and Area of a Circle)...Ch. 2 - (Displaying Shapes with Asterisks) Write a program...Ch. 2 - What does the fallowing code print? Cout “*\n...Ch. 2 - (Largest and Smallest Integers) Write a program...Ch. 2 - (Odd or Even) Write a program that reads an...Ch. 2 - (Multiples)Write a program that reads in two...Ch. 2 - (Checkerboard Pattern) Display the following...Ch. 2 - (Integer Equivalent of a Character) Here is a peek...Ch. 2 - (Digits of an Integer) Write a program that inputs...Ch. 2 - (Table) Using the techniques of this chapter,...Ch. 2 - (Body Mass Index Calculator) We introduced the...Ch. 2 - (Car-Pool Savings Calculator) Research several...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
What is an uninitialized variable?
Starting Out with Programming Logic and Design (4th Edition)
A byte is made up of eight a. CPUs b. addresses c. variables d. bits
Starting Out with Java: From Control Structures through Objects (7th Edition) (What's New in Computer Science)
Consider the adage Never ask a question for which you do not want the answer. a. Is following that adage ethica...
Experiencing MIS
The following C++ program will not compile because the lines have been mixed up. cout Success\n; cout Success...
Starting Out with C++ from Control Structures to Objects (9th Edition)
Are reflex actions (such as flinching from a hot stove) rational? Are they intelligent?
Artificial Intelligence: A Modern Approach
Porter’s competitive forces model: The model is used to provide a general view about the firms, the competitors...
Management Information Systems: Managing The Digital Firm (16th Edition)
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
- (DEBUG AND MAKE A FLOWCHART OF THIS PROGRAM) // This pseudocode is intended to display// employee net pay values. All employees have a standard// $45 deduction from their checks.// If an employee does not earn enough to cover the deduction,// an error message is displayed.// This example is modularized.start Declarations string name string EOFNAME = ZZZZ while name not equal to EOFNAME housekeeping() endwhile while name not equal to EOFNAME mainLoop() endwhile while name not equal to EOFNAME finish() endwhilestop housekeeping() output "Enter first name or ", EOFNAME, " to quit "return mainLoop() Declarations num hours num rate num DEDUCTION = 45 num net output "Enter hours worked for ", name input hours output "Enter hourly rate for ", name input rate gross = hours * rate net = gross - DEDUCTION if net > 0 then output "Net pay for ", name, " is ", net else output "Deductions not covered. Net is…arrow_forwardPlease answer item number 4. (pyhthon programming)arrow_forward6. (Geometry: area of a pentagon) The area of a pentagon can be computed using the following formula (s is the length of a side): Area 5x s² 4 X tan TT 5 Write a program that prompts the user to enter the side of a pentagon and displays the area. Here is a sample run: Enter the side: 5.5 Enter The area of the pentagon is 53.04444136781625arrow_forward
- ) that generates a random even positive integer less than 10 Write a program (Li and displays, using asteriskS, a filled diamond. For example, if the generated length is 4, the program should display a filled diamond like the one below.arrow_forward(IN C LANGUAGE) Cumulative Addition: Computer selects a number between 7 and 23 at random. User will only add 2, 3 or 5 numbers to reach that number. For example: To reach 14:User will enter 5 5 2 2 (4 input).Also he can enter 2 2 2 2 2 2 2 (7 input) or 3 3 3 3 2 (5 input)arrow_forward) /₹3soos alspaarrow_forward
- Q5. (Find the second lowest interger number) Write a program that prompts the user to enter a set of integer numbers, and finally displays the second lowest integer number in the set. To exit from the program enter -1. Here is a sample run Enter a set of integer numbers: 3 57 928-1 The second lowest number is 3.arrow_forward(Python) Please write a program that creates steps. You are expected to take in a single positive integer which will be used as the number of steps in your staircase. The program only accepts integers greater than 0 and less than 500. If 0 is entered a message stating "Your staircase has no steps." and if the user enters a value greater than or equal to 500, a message stating "I can't build a staircase that tall." For all other values not within the valid range or not integers an "Invalid staircase size provided." will be displayed to the user. The program will always run only once for each user input. One thing to note, the messages should be the return string from your printSteps() function and printed from the calling function. Additional Requirements: The very first step in the staircase will be left-aligned and for each subsequent level, the step will move above and to the right of the prior step. There are no spaces after the right of any of the steps. The bottom-most row ends…arrow_forward9- Write a program which read a number of 3 digits and check if (units, tens, hundreds) digit is greater than 5, convert this digit to 5. FOR eg. 147 After check 145 983 After check 553arrow_forward
- C# (Guess the Number Game) Write a program that plays “guess the number” as follows: Your program chooses the number to be guessed by selecting an int at random in the range 1–1000. The program then displays the following text in a label: A TextBox should be used to input the guess. As each guess is input, the background color should change to red or blue. Red indicates that the user is getting “warmer,” blue that the user is getting “colder.” A Label should display either “Too High” or “Too Low,” to help the user zero in on the correct answer. When the user guesses the correct answer, display “Correct!” in a message box, change the Form’s background color to green and disable the TextBox. Recall that a TextBox (like other controls) can be disabled by setting the control’s Enabled property to false. Provide a Button that allows the user to play the game again. When the Button is clicked, generate a new random number, change the background to the default color and enable the TextBox.arrow_forwardH.W : Write a program that inputs a five-digit number, separates the number into its individual digits and prints the digits separated from one another by each. (Hint: Use the integer division and modulus operators.) For three spaces example, if the user types in 42339 the program should print 4 2 3 3 9.arrow_forward5) Analyze the following code: boolean even = ((240 % 2) = 0): if (even) System.out.println("It is even!"): a. The program has a syntax error b. The program has a runtime error c. The program displays “It is odd!" d. d. The program displays "It is even!" else Page 2 of 6 System.out.println("It is odd!");arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education
Literals in Java Programming; Author: Sudhakar Atchala;https://www.youtube.com/watch?v=PuEU4S4B7JQ;License: Standard YouTube License, CC-BY
Type of literals in Python | Python Tutorial -6; Author: Lovejot Bhardwaj;https://www.youtube.com/watch?v=bwer3E9hj8Q;License: Standard Youtube License