1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
GaryK [48]
3 years ago
9

You decide to buy some stocks for a certain price and then sell them at another price. Write a program that determines whether o

r not the transaction was profitable. Here are the details: • Take three separate inputs: the number of shares, the purchase price of the stocks, and the sale price, in that order. • You purchase the number of stocks determined by the input. • When you purchase the stocks, you pay the price determined by the input. • You pay your stockbroker a commission of 3 percent on the amount paid for the stocks. • Later, you sell the all of the stocks for the price determined by the input. • You pay your stockbroker another commission of 3 percent on the amount you received for the stock. Your program should calculate your net gain or loss during this transaction and print it in the following format: If your transaction was profitable (or if there was a net gain/loss of 0) print: "After the transaction, you made 300 dollars." (If, for example, you gained 300 dollars during the transaction.) If your transaction was not profitable, print: "After the transaction, you lost 300 dollars." (If, for example, you lost 300 dollars during the transaction.) Use string formatting.
Computers and Technology
1 answer:
ser-zykov [4K]3 years ago
4 0

Answer:

#here is code in python.

#read number of shares

num_share = int(input("Enter number of shares:"))

#read purchase price

buy_p = float(input("Enter purchase price:"))

#read sell price

sell_p = float(input("Enter sale price:"))

#total buying cost

buy_cost=buy_p*1.03*num_share

#total selling cost

sell_cost=sell_p*0.97*num_share

#if net profit

if(sell_cost>buy_cost):

   print("After the transaction, you made " +str(sell_cost-buy_cost)+ " dollars.")

#if net loss

else:

   print("After the transaction, you lost " +str(buy_cost-sell_cost)+ " dollars.")

Explanation:

Read the total number of shares from user.Then read buying price of a share and selling price of a share.Then calculate total buying cost including commission.Calculate total selling cost excluding the commission.If total buying cost is greater than total selling cost the print the profit else print the loss in the transaction.

Output:

Enter number of shares:10

Enter purchase price:10

Enter sale price:10

After the transaction, you lost 6.0 dollars.

You might be interested in
PLZZZ HELP!!!!!!!
jek_recluse [69]

Answer: A is the correct choice.

5 0
2 years ago
Hey should I get a r()blox gift card if so what amount 5 dollars 10 or 100
IRINA_888 [86]

Answer:

yes you should get a 10 bc it not to much and u can still get something cool

6 0
2 years ago
How does Accenture help companies harness the power of data to achieve optimal business outcomes?
EleoNora [17]

Accenture help companies harness the power of data to achieve optimal business outcomes as they develop data governance frameworks that go on to form the basis of the company's data analytics strategy.

<h3>What is Accenture known for?</h3>

Accenture is known to be a body that is known for its different range of service that they do offer as well as their  practice areas. These is made up of: strategy, management, digital, technology, and also that of operations consulting.

Accenture is known to be one that tends to helps a lot of firms to be able to make full use of the power of data to be able to get the proper market benefits from the data and they also allow the firms to learn and describe the "art of the possible" via the use of their data and analysis.

Therefore, Accenture help companies harness the power of data to achieve optimal business outcomes as they develop data governance frameworks that go on to form the basis of the company's data analytics strategy.

Learn more about Accenture  from

brainly.com/question/25682883

#SPJ1

See full question below

How does Accenture help companies harness the power of data to achieve optimal business outcomes?

- They help companies think about and define the "art of the possible" with their data assets.

- They develop data governance frameworks that go on to form the basis of the company's data analytics strategy.

- They utilize only their Data and Analytics Platform to enable companies.

- They provide an interactive front end for a database solution that changes the data culture.

5 0
1 year ago
Consider the following code segment: try : inputFile = open("lyrics.txt", "r") line = inputFile.readline() print(line) _________
aleksandrvk [35]

Answer:

The answer is "except IOError:"

Explanation:

It is part of the exception handling, that stands for input/ output operation fails, this exception aeries when we attempting to access an anti-existent file, in the program so, it will give the program related errors.

  • This type of error is handled in the try block, it also allows you to prepare the deal with the exceptional block.  
  • It also helps you to hide the bugs by using code, if you handle an unexpected error.
6 0
3 years ago
What types of storage can be used to access data from another computer
Aleksandr-060686 [28]
<span>Hard disk drives
</span><span>RAM<span>Random access memory (RAM)
</span></span><span>External hard disks
<span>USB port
</span></span>CD and DVD drives
<span>Memory cards</span>
6 0
3 years ago
Read 2 more answers
Other questions:
  • It is important that researchers design rigorous study methods to eliminate: a. inferences. b. the need for a CONSORT flow chart
    10·1 answer
  • The left column values in a table array are called table ____
    13·1 answer
  • What type of data can we enter in a spreadsheet?
    11·1 answer
  • hello my friend is doing a give away at 100 followers would you follow him for a chance to win 2000 vbucks his name is ZoVa_Velo
    15·2 answers
  • Yall like portal 1 or 2
    8·1 answer
  • What is the BCC feature used for?
    12·2 answers
  • Why do software managers have to be generalists with a range of skills, rather than simply technical specialists?
    14·1 answer
  • 1. What does a computer
    7·2 answers
  • Question #8
    13·1 answer
  • Is y0utube an example of unsupervised learning or supervised learning?
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!