Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)
4th Edition
ISBN: 9780134787961
Author: Tony Gaddis, Godfrey Muganda
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Concept explainers
Textbook Question
Chapter 2, Problem 19PC
Stock Transaction Program
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 1,000.
- When Joe purchased the stock, the paid $32.87 per share.
- Joe paid his stockbroker a commission that amounted to 2% 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 1,000.
- He sold the stock for $33.92 per share.
- He paid his stockbroker another commission that amounted to 2% 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 that Joe sold the stock for.
- The amount of commission Joe paid his broker when he sold the stock.
- Display the amount of profit that Joe made after selling his stock and paying the two commissions to his broker. (If the amount of profit that your program displays is a negative number, then Joe lost money on the transaction.)
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Menu option C The program reads in data from HowManyHours.txt, displays a report header with the report creator’s name, employee id, and department and who they created the report for. The body of the report displays the total number of students who used the program, the average credits taken, and the average study hours. In the following format –STUDY HOURS REPORT Created for Dr. Payne, A004567893 Dept: Computer Science
Created By: Karen Smith, A00494928Dept: Advising
Total Students: 3Average Credits: 9.00Average Study Hours: 20.00Menu option DThank the user for using the programTerminates the program
LOGICAL EXPRESSIONS
#15 SURGERY_DATE is a datetime column that stores the dates on which surgeries were performed. The time
stored is midnight.
Which of the following will return TRUE for surgeries performed in 2016 and FALSE for all other surgeries?
SELECT ONE OF THE FOLLOWING
A. SURGERY_DATE BETWEEN '31 DEC 2015' AND '31 DEC 2016'
B. SURGERY_DATE BETWEEN '31 DEC 2015' AND '1 JAN 2017'
C. SURGERY_DATE BETWEEN '1 JAN 2016' AND '31 DEC 2016'
D. SURGERY_DATE BETWEEN '1 JAN 2016' AND '1 JAN 2017'
Payment
=
Principal [rate ((1 + rate)months)]
[(rate + 1)months - 1]
For the formula to compute monthly payment, see Listing 2.9, ComputeLoan.java.
(Financial application: loan amortization schedule) The monthly payment for a
given loan pays the principal and the interest. The monthly interest is computed
by multiplying the monthly interest rate and the balance (the remaining princi-
pal). The principal paid for the month is therefore the monthly payment minus
the monthly interest. Write a program that lets the user enter the loan amount
Chapter 2 Solutions
Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)
Ch. 2.1 - Prob. 2.1CPCh. 2.1 - When the program in Question 2.1 is saved to a...Ch. 2.1 - Complete the following program skeleton so it...Ch. 2.1 - On paper, write a program that will display your...Ch. 2.1 - Prob. 2.5CPCh. 2.1 - Every Java application program must have...Ch. 2.2 - The following program will not compile because the...Ch. 2.2 - Study the following program and show what it will...Ch. 2.2 - On paper, write a program that will display your...Ch. 2.3 - Examine the following program. // This program...
Ch. 2.3 - What will the following program display on the...Ch. 2.4 - Which of the following are illegal variable names...Ch. 2.4 - Prob. 2.13CPCh. 2.4 - Prob. 2.14CPCh. 2.4 - Prob. 2.15CPCh. 2.4 - A program declares a float variable named number,...Ch. 2.4 - Prob. 2.17CPCh. 2.4 - Prob. 2.18CPCh. 2.4 - Prob. 2.19CPCh. 2.4 - Prob. 2.20CPCh. 2.4 - What is wrong with the following statement? char...Ch. 2.5 - Prob. 2.22CPCh. 2.5 - Prob. 2.23CPCh. 2.6 - Write statements using combined assignment...Ch. 2.7 - The following declaration appears in a program:...Ch. 2.7 - The variable a is a float and the variable b is a...Ch. 2.9 - Write a statement that declares a String variable...Ch. 2.9 - Assume that stringLength is an int variable. Write...Ch. 2.9 - Prob. 2.29CPCh. 2.9 - Prob. 2.30CPCh. 2.9 - Prob. 2.31CPCh. 2.11 - Prob. 2.32CPCh. 2.11 - How are documentation comments different from...Ch. 2.14 - Prob. 2.34CPCh. 2.14 - Write code that will display each of the dialog...Ch. 2.14 - Write code that displays an input dialog asking...Ch. 2.14 - Prob. 2.37CPCh. 2 - Every complete statement ends with a __________....Ch. 2 - The following data 72 'A' Hello World 2.8712 are...Ch. 2 - A group of statements, such as the contents of a...Ch. 2 - Which of the following are not valid assignment...Ch. 2 - Which of the following are nor valid println...Ch. 2 - The negation operator is __________. a. unary b....Ch. 2 - This key word is used to declare a named constant....Ch. 2 - These characters mark the beginning of a...Ch. 2 - These characters mark the beginning of a...Ch. 2 - These characters mark the beginning of a...Ch. 2 - Which Scanner class method would you use to read a...Ch. 2 - Which Scanner class method would you use to read a...Ch. 2 - You can use this class to display dialog boxes. a....Ch. 2 - Prob. 14MCCh. 2 - Prob. 15MCCh. 2 - True or False: A left brace in a Java program is...Ch. 2 - True or False: A variable must be declared before...Ch. 2 - True or False: Variable names may begin with a...Ch. 2 - True or False: You cannot change the value of a...Ch. 2 - True or False: Comments that begin with / / can be...Ch. 2 - True or False: If one of an operators operands is...Ch. 2 - What will the following code segments print on the...Ch. 2 - int x = 0, y=2; x = y 4; System.out.println(x +...Ch. 2 - System.out.print(I am the incredible);...Ch. 2 - System.out.print(Be careful\n);...Ch. 2 - int a, x = 23; a = x % 2; System.out.println(x +...Ch. 2 - Find the Error There are a number of syntax errors...Ch. 2 - Show how the double variables temp, weight, and...Ch. 2 - Prob. 2AWCh. 2 - Write assignment statements that perform the...Ch. 2 - Assume the variables result, w, x, y, and z are...Ch. 2 - Prob. 5AWCh. 2 - Modify the following program so it prints two...Ch. 2 - What will the following code output? int apples =...Ch. 2 - What will the following code output? double d =...Ch. 2 - What will the following code output? String...Ch. 2 - What will the following code output? String...Ch. 2 - Convert the following pseudocode to Java code. Be...Ch. 2 - Prob. 12AWCh. 2 - Write the code to set up all the necessary objects...Ch. 2 - Prob. 14AWCh. 2 - A program has a float variable named total and a...Ch. 2 - Is the following comment a single-line style...Ch. 2 - Is the following comment a single-line style...Ch. 2 - Describe what the phrase self-documenting program...Ch. 2 - Prob. 4SACh. 2 - Prob. 5SACh. 2 - Prob. 6SACh. 2 - Prob. 7SACh. 2 - Prob. 8SACh. 2 - Briefly describe the difference between variable...Ch. 2 - What is the difference between comments that start...Ch. 2 - Briefly describe what programming style means. Why...Ch. 2 - Assume that a program uses the named constant PI...Ch. 2 - Assume the file Sales Average, java is a Java...Ch. 2 - Prob. 14SACh. 2 - Name, Age, and Annual Income Write a program that...Ch. 2 - Name and Initials Write a program that has the...Ch. 2 - Personal Information Write a program that displays...Ch. 2 - Star Pattern Write a program that displays the...Ch. 2 - Sales Prediction The East Coast sales division of...Ch. 2 - Land Calculation One acre of land is equivalent to...Ch. 2 - Sales Tax Write a program that will ask the user...Ch. 2 - Cookie Calories A bag of cookies holds 40 cookies....Ch. 2 - Miles-per-Gallon A cars miles-per-gallon (MPG) can...Ch. 2 - Test Average Write a program that asks the user to...Ch. 2 - Circuit Board Profit An electronics company sells...Ch. 2 - Prob. 12PCCh. 2 - Restaurant Bill Write a program that computes the...Ch. 2 - Male and Female Percentages Write a program that...Ch. 2 - Stock Commission Kathryn bought 600 shares of...Ch. 2 - Energy Drink Consumption A soft drink company...Ch. 2 - Ingredient Adjuster A cookie recipe calls for the...Ch. 2 - Word Game Write a program that plays a word game...Ch. 2 - Stock Transaction Program Last month Joe purchased...Ch. 2 - Planting Grapevines A vineyard owner is planting...Ch. 2 - Compound Interest When a bank account pays...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
What does the following code print? System.out.println(""); System.out.println(""); System.out.println(""); Sys...
Java How to Program, Early Objects (11th Edition) (Deitel: How to Program)
World Series Champions If you have downloaded the source code you will find a file named WorldSeriesWinners txt...
Starting Out with Python (4th Edition)
Create a flowchart that shows the necessary steps for making the cookies in the following recipe: Ingredients: ...
Starting Out With Visual Basic (8th Edition)
In Exercises 41 through 46, identify the errors.
Introduction To Programming Using Visual Basic (11th Edition)
Describe two properties that each candidate key must satisfy.
Modern Database Management
Largest Number Assume that a file containing a series of integers is named numbers.dat and exists on the comput...
Starting Out with Programming Logic and Design (5th Edition) (What's New in Computer Science)
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
- c++ taskarrow_forward(Numerical) Write an assignment statement to calculate the nth term in an arithmetic sequence. This is the formula for calculating the value, v, of the nth term: v=a+(n1)d a is the first number in the sequence. d is the difference between any two numbers in the sequence.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
- python languagearrow_forwardUse the following list in the program. hours For recording the hours worked by each employee. gross_pay for each employee's wage record. and add the following information section Which employee was paid the most and how much was he paid? Which employee gets the lowest wage and how much? Example of running the program (User enters an underlined value)arrow_forwardTrue or False 5. The name gross_pay is written in the camelCase convention.arrow_forward
- Book (ISBN, Category, BTitle, Quantity,CID) Sales (SalesNo, Month_Year, TotalSales, ISBN) Shop (RegNo, Location, SalesNo) Customer (CID, CName, TelNo, Age) (ii)What was the title and category of the book that the customer Emekabought? (iii)Who purchased the book in the Coding category,or the quantity is greater than two? (iv)What isthe total sales and location of the shop with the registration number "REG KL 100" in the month ofApril 2021? (v)Display the identification number, name, age together with the total salesof the customers who purchasedthe Computer Fundamentals title book.arrow_forwardPlease right solution only please fast u will like itarrow_forwardA shop collects the following information from its customers: 1. Full name (first name, last name, and optional middle initial) 2. Address (street name and number, city, zip code, and state) 3. Phone number 4. Email 5. First visit/service date 6. Most recent visit/service date 7. Total amount charged 8. Current balance and description of the last service You are to write a program that allow the shop to manage their customers. The shop needs the following functionalities: 1. Search for a customer by:a. Nameb. Phone numberc. Email (The result of the search would have similar option as in the “List all customers” option below) 2. List all customersa. Select and edit a customer b. Delete a customer 3. Add a new customera. Prompt for appropriate data fields 4. Get account consolidation sheet that shows total charges and total balance of all customers 5. Get the records of the biggest 5 spenders (spend the most) 6. Exit and save all changes (all changes to the customers should be stored…arrow_forward
- File Name: Surname_MP8.m Problem Statement: Based on an automobile's model year and weight the state of New Jersey determines the car's weight class and registration fee using the following schedule: Model Year 1970 or earlier 1971 to 1979 1980 or later Weight Less than 2700 lbs 2700 to 3800 lbs More than 3800 lbs. Less than 2700 lbs 2700 to 3800 lbs More than 3800 lbs Less than 3500 lbs Weight Class 1 2 3 4 5 6 7 Registration Fee $ 16.50 25.50 46.50 27.00 30.50 52.50 19.50 3500 or more lbs 8 52.50 Using this information, write a MATLAB program (using Switch statement) that accepts the year and weight of an automobile and determines and displays the weight class and registration fee for the car.arrow_forwardQuestion#1 Scenario of web shop application: A supplier (with Supp-#) processes many purchase orders (with PO-#) and sells a number of products (with Prod-#). A product is sold by only one supplier. Each of the purchase orders that a supplier may process includes several products. The relationship between order and product is defined as "Line Item". A customer (with Cust-#) may place one or more purchase orders. A purchase order may be placed by only one customer. Design a complete ER diagram for the above verbal description of web shop application.arrow_forwardEnter number of pencils @ 0.150 each Enter number of A4 papers @ 1.200 each : 2 Enter number of markers @ 0.600 each : 3 : 1 **** Customer Bill **** Description Sub Total Price of all pencils Price of all A4 papers Price of all markers 0.450 2.400 0.600 Total bill 3.450 Cashier Name: Ahmedarrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- 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
- Programming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage Learning
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:9781337508841
Author:Carey
Publisher:Cengage
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:9781337102124
Author:Diane Zak
Publisher:Cengage Learning
Python Tutorial #10; Math Functions in Python; Author: Art of Engineer;https://www.youtube.com/watch?v=OviXsGf4qmY;License: Standard YouTube License, CC-BY