Concept explainers
Stock Transaction
Last month, Joe purchased some stock in Acme Software. Inc. Here are the details of the purchase:
▪ The number of shares that Joe purchased was 2,000.
▪ When Joe purchased the stock, he paid $40.00 per share.
▪ Joe paid his stockbroker a commission that amounted to 3 percent of the amount he paid for the stock.
Two weeks later, Joe sold the stock. Here are the details of the sale:
▪ The number of shares that Joe sold was 2,000.
▪ He sold the stock for $42.75 per share.
▪ He paid his stockbroker another commission that amounted to 3 percent of the amount he received for the stock.
Write a program that displays the following information:
▪ The amount of money Joe paid for the stock.
▪ The amount of commission Joe paid his broker when he bought the stock.
▪ The amount for which Joe sold the stock.
▪ The amount of commission Joe paid his broker when he sold the stock.
▪ Display the amount of money that Joe had left when he sold the stock and paid his broker (both times). If this amount is positive, then Joe made a profit. If the amount is negative, then Joe lost money.
Learn your wayIncludes step-by-step video
Chapter 2 Solutions
Starting Out with Python (4th Edition)
Additional Engineering Textbook Solutions
Starting Out with Java: From Control Structures through Objects (7th Edition) (What's New in Computer Science)
Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)
Database Concepts (8th Edition)
Starting Out with Java: Early Objects (6th Edition)
Java How to Program, Early Objects (11th Edition) (Deitel: How to Program)
Starting Out with C++: Early Objects (9th Edition)
- python languagearrow_forwardCustomer (CID, CName, Street, City, State, Gender)Agent (AgentID, GName, Position, Salary, Gender, BranchNo)Invoice(InvoiceNo, CID, AgentID, Product, Quantity, Total_amt) List the name of agents, position and salary for all agents that begin with ‘Sales’ in their title position and with salary more than the average salary. Example of titles with ‘Sales’ are ‘Sales Executive’, ‘Sales Manager’, ‘Salesman’ and many other titles. Sort the list by name in alphabetical orderarrow_forwardHoliday Travel Vehicle (HTV) sells new recreational vehicles and travel trailers. When new vehicles arrive at HTV, a new vehicle record is created. Included in the new vehicle record are a vehicle serial number, name, model, year, manufacturer, and base cost. When a customer arrives at HTV, he or she works with a salesperson to negotiate a vehicle purchase. When a purchase has been agreed upon, a sales invoice is completed by the salesperson. The invoice summarizes the purchase, including full customer information, information on the trade-in vehicle (if any), the trade-in allowance, and information on the purchased vehicle. The invoice also summarizes the final negotiated price, plus any applicable taxes and license fees. If the customer requests dealer-installed options (simply options), they are listed on the invoice as well. A customer may decide to have no options added to the vehicle or may choose to add many options. Dealer-installed options are described by an option code,…arrow_forward
- Topic name: data structures please solve quicklyarrow_forwardTranscribed Image Text A summer camp offers a morning session and an afternoon session. The list morningList contains the names of all children attending the morning session, and the list afternoonList contains the names of all children attending the afternoon session. Only children who attend both sessions eat lunch at the camp. The camp director wants to create lunchList, which will contain the names of children attending both sessions. The following code segment is intended to create lunchList, which is initially empty. It uses the procedure IsFound (list, name), which returns true if name is found in list and returns false otherwise. FOR EACH child IN morningList { <MISSING CODE> Which of the following could replace <MISSING CODE> so that the code segment works as intended? IF (IsFound (afternoonList, child)) { A APPEND (lunchList, child)arrow_forwardFormatting Customer Names Build a function that displays a customer's name and location if applicableSuppose that you are building a Customer Relationship Management (CRM) system, and you want to display a user record in the following format: John Smith (California). However, if you don't have a location in your system, you just want to see "John Smith." Create a format_customer() function that takes two required positional arguments, first_ name and last_name, and one optional keyword argument, location. It should return a string in the required format. Create the customer.py file. Define the format_customer() function. Open a Python shell (Or Jupyter Notebook) and import your format_customer() function. Try running a few examples. The calls should look like this: from customer import format_customerformat_customer('John', 'Smith', location='California') and the output should look like this: John Smith (California) In [ ]:arrow_forward
- Introduction Some number of teams are participating in a race. You are not told how many teams are participating but you do know that: Each team has a name, which is one of the uppercase letters A-Z. No two teams have the same name, so there are a maximum number of 26 teams. Each team has the same number of members. No two runners cross the finish line at the same time – i.e. there are no ties. At the end of the race we can write the results as a string of characters indicating the order in which runners crossed the finish line. For example: ZZAZAA We can see there were two teams: A and Z. Team A’s runners finished in 3rd, 5th and 6th place. Team Z’s runners finished in 1st, 2nd and 4th place. Scoring the race Each runner is assigned a score equal to their finishing place. In the example above team Z’s runners achieved scores of 1, 2 and 4. Team A’s runners scores were 3, 5, and 6 respectively. The team’s score is the sum of the members score divided by the number of people on…arrow_forward11 Worksheet 5 Note:Solution using Matlab Code Write a program that prompts the user to enter a number within the range of 1 through 7, those numbers represent the weekdays as shown in the table. If the entered number is more than 7, display 'invalid day'. Number 1 2 3 4 5 6 7 Day Sunday Monday Tuesday Wednesday Thursday Friday Saturday Type of the day Workday Workday Workday Workday Workday Weekend Weekend The program should continue to repeat itself 10 times, after which, the program should stop. Furthermore, the program should be able to show a message saying if this is a 'workday' or a 'weekend day'. Note: you are required to add a comment beside your command. Hint: to add a comment you may use the % sign. thank guys you dodo great.arrow_forwardEmployee view attendance report The employee must be logged in to the system to perform this function. The employee selects the report period (range of dates: from - to). The employee selects "show report". Range of dates for the report must be maximum 3 months, so if the range is invalid, the system displays an error message. The system displays every working day in the report with the status of the employee in this day, which could be one of the following: on time, late, did not come. One actor? One use case name? One class ? Attributes for the class ? One relation between classes ?arrow_forward
- C++ Language Write a program that prints a custom conversion table from Celsius temperatures to Fahrenheit and Newton (Links to an external site.) temperatures. The formula for the conversion from Celsius to Fahrenheit is : F=9/5*C+32 F is the Fahrenheit temperature, and C is the Celsius temperature. The formula for the conversion from Celsius to Newton is C = 100/33*N N is the Newton Temperature and C is the Celsius temperature Your program should prompt the user for a lower value and upper value for a range of temperatures in Celsius. It should then prompt the user for the amount they want to increment by. Then use a loop to output to a file named conversion_table.txt a table of the Celsius temperatures and their Fahrenheit and Newton equivalents within the range of values using the increment given by the user. Make sure to format your output to 2 decimal places. INPUT VALIDATION: Ensure the second number is greater than the first number, and make sure the increment is greater…arrow_forwardc++arrow_forwardQuery Board Python or Java(Preferred Python please) Thank you! Programming challenge description: There is a board (matrix). Every cell of the board contains one integer, which is 0 initially.The following operations can be applied to the Query Board:SetRow i x: change all values in the cells on row "i" to value "x".SetCol j x: change all values in the cells on column "j" to value "x".QueryRow i: output the sum of values on row "i".QueryCol j: output the sum of values on column "j".The board's dimensions are 256x256."i" and "j" are integers from 0 to 255."x" is an integer from 0 to 31. Input: Your program should read lines from standard input. Each line contains one of the above operations. Output: For each query, output the result of the query. Test 1 Test InputDownload Test 1 Input SetCol 32 20 SetRow 15 7 SetRow 16 31 QueryCol 32 SetCol 2 14 QueryRow 10 Expected OutputDownload Test 1 Input 5118 34arrow_forward
- Programming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:CengageNp Ms Office 365/Excel 2016 I NtermedComputer ScienceISBN:9781337508841Author:CareyPublisher:CengageC++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr