Question: To become familiar with Java language basics (variable declaration, numeric expression, assignment statement, input using Scanner, and formatting output). Write a program to accept inputs
To become familiar with Java language basics (variable declaration, numeric expression, assignment statement, input using Scanner, and formatting output). Write a program to accept inputs from a user including yourName, numberShares shares (only whole shares allowed) purchased of some stock (for example the Microsoft stock symbol is MSFT) at the price of buyPrice per share and paid the stockbroker $15 buyTransactionFee. Two weeks later, the person sold the numberShares shares at sellPrice per share and paid another $10 for the sellTransactionFee. Create the necessary input, process and output variables, choosing appropriate data types, and write a Java program to accept input, calculate and display the following: dollar amount paid for the shares dollar amount of the shares sold total transaction fee paid to the broker (including both buy and sell) - Use constants/final amount of profit (or loss) made after selling the shares. yourName, numberShares. buyPrice. sellPrice Sample Run (user's inputs are shown in bold): What's your name? Joseph What stock are you purchasing? MSFT How many shares bought? 250 Buy price? 28.31 Sale price? 30.79 Using Java to get the inputs above. Calculate and generate the following formatted Output
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
