Concept explainers
Stock Profit
The profit from the sale of a stock can be calculated as follows:
- where NS is the number of shares,
- SP is the sale price per share,
- SC is the sale commission paid,
- PP is the purchase price per share,
- and PC is the purchase commission paid.
If the calculation yields a positive value, then the sale of the stock resulted in a profit. If the calculation yields a negative number, then the sale resulted in a loss.
Write a function that accepts as arguments the number of shares, the purchase price per share, the purchase commission paid, the sale price per share, and the sale commission paid. The function should return the profit (or loss) from the sale of stock.
Demonstrate the function in a
Want to see the full answer?
Check out a sample textbook solutionChapter 6 Solutions
Starting Out with C++: Early Objects
Additional Engineering Textbook Solutions
Starting out with Visual C# (4th Edition)
Web Development and Design Foundations with HTML5 (8th Edition)
Starting Out With Visual Basic (8th Edition)
Introduction To Programming Using Visual Basic (11th Edition)
Starting Out with Python (3rd Edition)
Digital Fundamentals (11th Edition)
- To determine a new credit card balance, use the following formula. New Balance = Previous Balance + Finance Charge + Purchases and Cash Advances − Payments and Credits TrueFalsearrow_forwardCalculate the moments of the Bernstein Durrmeyer operator.arrow_forwardA multiple-choice quiz consists of 5 questions with 4 possible choices. In how many ways can a student answer the questions if the student answers every question (i.e. they don't leave any question blank). Group of answer choices. 1024,512,2048,256arrow_forward
- 9 = ; Y= 5 50 18 100 81 Cul culate, Loss,L= mse (7,9) Note: mse = mean squane ennoto 对5 经arrow_forwardWhat is the opposite of greater than?arrow_forward(Transportation) Road construction requires estimating the expected loads on a road’s pavement over its design life. A common approach for determining this information is to use ESAL values; one ESAL is the load a single 18,000-lb (80,000 N) single-axle truck applies to the road’s surface. The ESAL value for any single-axle vehicle can be approximated by this formula: ESAL=[W18,000]4 ESAL is the equivalent single-axle load. W is the vehicle’s weight (lbs). Using this formula, write, compile, and run a C++ program that determines ESAL values and use it to complete the following chart. The ESAL values should be output in a field width of 10, with six digits after the decimal point.arrow_forward
- Question 6 3 points Save Answer A fair coin is flipped 5 times. What is the probability that exactly 2 of the 5 flips come up heads? (answer in fraction form only, no factorial notation, permutation or combination notation is allowed)arrow_forward1) Given the percentages below; [e: 13%, a: 8%, o: 7%, i: 7%, u: 3%] a) Give the value of Pr(x is a vowel) b) Give the value of Pr(x = ‘e’ |x is a vowel) c) Give the value of Pr(x is a vowel |x is not ‘a’)arrow_forwardGolf scores record the number of strokes used to get the ball in the hole. The expected number of strokes varies from hole to hole and is called par (i.e. 3, 4, or 5). Each score's name is based on the actual strokes taken compared to par: "Eagle": number of strokes is two less than par "Birdie": number of strokes is one less than par "Par": number of strokes equals par "Bogey": number of strokes is one more than par Given two integers that represent par and the number of strokes used, write a program that prints the appropriate score name. Print "Error" if par is not 3, 4, or 5 need answer in pythonarrow_forward
- Golf scores record the number of strokes used to get the ball in the hole. The expected number of strokes varies from hole to hole and is called par (i.e. 3, 4, or 5). Each score's name is based on the actual strokes taken compared to par: "Eagle": number of strokes is two less than par "Birdie": number of strokes is one less than par "Par": number of strokes equals par "Bogey": number of strokes is one more than par Given two integers that represent par and the number of strokes used, write a program that prints the appropriate score name. Print "Error" if par is not 3, 4, or 5. Ex: If the input is: 4 3 the output is: Birdie (in java please)arrow_forwardGolf scores record the number of strokes used to get the ball in the hole. The expected number of strokes varies from hole to hole and is called par (i.e. 3, 4, or 5). Each score's name is based on the actual strokes taken compared to par: "Eagle": number of strokes is two less than par "Birdie": number of strokes is one less than par "Par": number of strokes equals par "Bogey": number of strokes is one more than par Given two integers that represent par and the number of strokes used, write a program that prints the appropriate score name. Print "Error" if par is not 3, 4, or 5. Ex: If the input is: 4 3 the output is: Birdie javaarrow_forwardPython Big-O Notation Pls answer only if u know Big-O Clue is given below: Will give thumbs up if correct ty!arrow_forward
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrNp Ms Office 365/Excel 2016 I NtermedComputer ScienceISBN:9781337508841Author:CareyPublisher:CengageCOMPREHENSIVE MICROSOFT OFFICE 365 EXCEComputer ScienceISBN:9780357392676Author:FREUND, StevenPublisher:CENGAGE L
- Operations Research : Applications and AlgorithmsComputer ScienceISBN:9780534380588Author:Wayne L. WinstonPublisher:Brooks ColeProgramming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:CengageC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning