HOMEWORK 6 PART 1 Date Due: Wednesday, April 14, 2021 at 11:59pm Complete a program that allows the user to choose addition or subtraction operations on two numbers entered from the keyboard. Code getChoice as a function that returns choice, addition and subtraction as functions that accept the two numbers as parameters and return the results of the calculations, and displayResult as a void function that accepts the result as a parameter. Be sure to put your name as a comment at the beginning of your code and at the end as the programmer. Input Process Output 1. Choice of 1. Result of operation operation 2. First number 1. If choose to perform operation, add two numbers; otherwise, 3. Second number subtract two numbers

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

C++ beginner 

#include <iostream>

using namespace std;

int main()

{

cout << "HOMEWORK #6 PART 1";

int getchoice();

choice = getChoice();

HOMEWORK #6 PART 1
Please enter 1 if you want to add two numbers
enter 2 if you want to subtract two numbers 2
Please enter two numbers 4.65 9.2
The result is -4.55
Programmer: insert your name here
Transcribed Image Text:HOMEWORK #6 PART 1 Please enter 1 if you want to add two numbers enter 2 if you want to subtract two numbers 2 Please enter two numbers 4.65 9.2 The result is -4.55 Programmer: insert your name here
HOMEWORK 6 PART 1
Planning - Flow Charts
Date Due: Wednesday, April 14, 2021 at 11:59pm
addition
subtraction
getChoice
Complete a program that allows the user to choose addition or subtraction
operations on two numbers entered from the keyboard. Code getChoice as a
function that returns choice, addition and subtraction as functions that accept the
two numbers as parameters and return the results of the calculations, and
displayResult as a void function that accepts the result as a parameter. Be sure to
put your name as a comment at the beginning of your code and at the end as the
(num1, num2)
(num1, num2)
Ask user for
Result =
Result =
choice of
operation
num1+num2
num1-num2
programmer.
Input
Process
Output
1. Choice of
1. If choose to perform
1. Result of operation
Input
operation
2. First number
operation, add two
numbers; otherwise,
Return
Return
choice
(result)
(result)
3. Second number
subtract two numbers
main
Planning
- Breaking Program to Smaller Pieces
Return
Print
(choice)
title
getChoice
Main
displayResult
(result)
Get 2 numbers
Input
Process
Output
Choice is add
Display
subtraction
addition
result
getChoice
getNumbers
addition
subtraction
displayResult
displayResult
Return
Display name
end
Transcribed Image Text:HOMEWORK 6 PART 1 Planning - Flow Charts Date Due: Wednesday, April 14, 2021 at 11:59pm addition subtraction getChoice Complete a program that allows the user to choose addition or subtraction operations on two numbers entered from the keyboard. Code getChoice as a function that returns choice, addition and subtraction as functions that accept the two numbers as parameters and return the results of the calculations, and displayResult as a void function that accepts the result as a parameter. Be sure to put your name as a comment at the beginning of your code and at the end as the (num1, num2) (num1, num2) Ask user for Result = Result = choice of operation num1+num2 num1-num2 programmer. Input Process Output 1. Choice of 1. If choose to perform 1. Result of operation Input operation 2. First number operation, add two numbers; otherwise, Return Return choice (result) (result) 3. Second number subtract two numbers main Planning - Breaking Program to Smaller Pieces Return Print (choice) title getChoice Main displayResult (result) Get 2 numbers Input Process Output Choice is add Display subtraction addition result getChoice getNumbers addition subtraction displayResult displayResult Return Display name end
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
Structure chart
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
Recommended textbooks for you
Database System Concepts
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)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education