
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Concept explainers
Question

Transcribed Image Text:Lab
Write a complete program that:
1. Prompts the user to enter an integer and reads in an integer number from the keyboard.
2.
Prompts the user to enter a second integer and reads in a second integer number from the keyboard.
Adds the integer from (1) to the integer from (2)
3.
4.
Subtracts the integer from (2) from the integer from (1)
5. Multiplies the integer from (1) to the integer from (2).
6. Divides the integer from (1) by the integer from (2)
7. Modulus the integer from (1) by the integer from (2)
8. Prompts the user to enter a double and reads in a double number from the keyboard.
9. Prompts the user to enter a second double and reads in a second double number from the keyboard.
10. Divides the double from (8) by the double from (9)
11. Writes the answers from (3)-(7) and (10) out to the display
The user should be prompted to enter the input values and the result of the arithmetic should be output.
Example Output
An example of an interaction with your program is shown below, your output should match these examples exactly. (The words
printed in blue are from the computer, based on your commands, the words in red are user input. Note these colors are simply
here to distinguish components and not needed in your program.):
Alexs-iMac:labib alex$ g++ -Wall -pedantic -Werror main.cpp
Alexs-iMac:labib alex$ /a.out
Enter an integer
**12
Enter another integer
**9
129 21
12- 93
129 108
12/9-1
129-3
Enter a double
**6.8
Enter another double
**4.5
6.8 4.5 1.51111
See Code Grade for more examples.
Hand-In Procedure
1. Save
Save your code as main.cpp. Do not ignore this step or save your file(s) with different names.
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 3 steps with 1 images

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
- Computer ProgrammingLanguage: CConditional Statementsarrow_forward6 Problem: Count occurrence of numbers Write a program that reads integers in the range 1 - 100 and counts the occurrences of each. Assume that 0 indicates the end of input. Sample Runs: Enter the integers between 1 and 100: 1 1 2 2 2 0 1 occurs 2 times 2 occurs 3 times ________________________ Enter the integers between 1 and 100: 11 10 99 99 99 5 5 2 2 2 2 0 2 occurs 4 times 5 occurs 2 times 10 occurs 1 time 11 occurs 1 time 99 occurs 3 timesarrow_forwardProblem 1 Create a program that will print all odd integers from 1 up to a given value entered by the user. Problem 2 Write a program that will print out all the Fibonacci numbers up to a certain number of digits. Yourprogram should input the number of Fibonacci numbers to be displayed and display those values.For example if 8 was input it should display 1 1 2 3 5 8 13 21 Problem 3 Write a program that will allow us to sum all the integers from 1 up to a given number. The programwill prompt for and allow input for an integer. It will then calculate and display the sum of all integersfrom 1 to that value. Problem 4 Create a program that can be used to practice simple multiplication problems. The program shouldrandomly generate 2 single digit numbers for the user to multiply and display it in the form of aproblem. The user should enter an answer to the problem and it should check if they got it right orwrong. The program will continue asking until the user gets 3 correct answers. Problem…arrow_forward
- P print out of range QUESTION 5 Implement the following: 1) Request an integer input by the user. 2) Display the sum value of 1/10 + 2/10 + 3/10 + ... + n/10 to two decimal places. 3) Display the average to two decimal places. Input text can be any content. Just make sure to precisely match the output format below. Write your entire program in the Answer area provided below (must include comments if using code is not covered in the course). Example Output Enter an integer: 50 The sum 1/10 + 2/10 + 3/10 +. + n/10 (n = 50) is 127.50. The average is 2.55. For the toolbar, press ALT+F10 (PC) or ALT+FN+F10 (Mac). BIUS Paragraph V Arial 10pt Click Save and Submit to save and submit. Click Save All Answers to save all answers. Programs Ev Ev A V Varrow_forwardWrite a Program in R that asks the user to enter two numbers then perform 5 mathematical operations on the two numbers: Addition, Subtraction, Multiplication, Division, and Average. The program should display All the results.arrow_forwardQ3a) Summary Newton’s law states that the force, F, between two bodies of masses M1 and M2 is given by: in which k is the gravitational constant and d is the distance between the bodies. The value of k is approximately 6.67 X 10-8 dyn. cm²/g² . Instructions Write a program that prompts the user to input: The masses of the bodies The distance between the bodies. The program then outputs: The force between the bodies. Your program should be able to work with decimals. Q3b) Cindy uses the services of a brokerage firm to buy and sell stocks. The firm charges 1.5% service charges on the total amount for each transaction, buy or sell. When Cindy sells stocks, she would like to know if she gained or lost on a particular investment. Instructions Write a program that allows Cindy to input: The purchase price of each share The selling price of each share The number of shares sold The program outputs: The total amount invested The total amount received from selling The total service…arrow_forward
- 2. Need help creating a SPIM program for question #1.arrow_forward5-1) (Count positive and negative numbers and compute the average of numbers) Write a program that reads an unspecified number of integers, determines how many positive and negative values have been read, and computes the total and average of the input values (not counting zeros). Your program ends with the input 0. Display the average as a floating-point number. 5-1) (Count positive and negative numbers and compute the average of numbers) Write a program that reads an unspecified number of integers, determines how many positive and negative values have been read, and computes the total and average of the input values (not counting zeros). Your program ends with the input 0. Display the average as a floating-point number. SAMPLE RUN #4: java Avgwithloop Interactive Session Hde Invisbies Highlight: None Show Highlighted Only D Enter-an-integer, -the-input-ends-if-it-is-e:-44.-33.-12-15-89-45-113-117-45-ge The nunber-of- positives is-64 The nunber of negatives is-3+ The total-is-335.8+…arrow_forwardDevelop a pseudocode or flowchart for all the following problems : 1. Write a program which will display “I AM GOOD” on the computer screen for 10x2. Write a program which will display “I AM GREAT” on the computer screen for 100x3. Write a program which will display “I AM SUPERMAN” on the computer screen for 1000x4. Accept two integers from computer user and check whether they are equal or not.5. Write a program to check whether a given number is even or odd.6. Write a program to check whether a given number is positive or negative7. Write a program to read the value of an integer m and display the value of n is 1 when m is larger than 0, 0when m is 0 and -1 when m is less than 08. Write a program which accept the user’s height in cm then display :a. You are so tall → if the height is more than 180cmb. You are not that tall → if the height is between 100 – 179cmc. You are short ha ha ha → if the height is less than 100cm9. Write a program to read 10 numbers from keyboard and find their…arrow_forward
- 9: perfect.cpp) A number is called perfect if the sum of its divisors is equal to the original number. A number is called deficient if the sum of its divisors is less than the original number. A number is called abundant if the sum of its divisors is more than the original number. Write a program that answers the following questions: What numbers below 5000 are perfect? What odd numbers below 5000 are abundant? What are the relative proportions of deficient, abundant, and perfect numbers? 5000 should be in a global constant.arrow_forward-Prompts the user to enter an integer x. Assume without error checking the user enters a positive integer. -The program then will print all the odd integers between 1 and x that are a multiple of 3. Sample: Enter an integer x: 15 3 is a multiple of 3 9 is a multiple of 3 15 is a multiple of 3arrow_forwardcorrect all errors.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