1. Engineering
  2. Computer Science
  3. anyone help with me with this assignment you are calculating...

Question: anyone help with me with this assignment you are calculating...

Question details

Anyone help with me with this assignment, you are calculating ROI and AnnualizedROI.

  • Receive the user's first and last name (in two different lines) and print the below line to the console:
[First character of first name][First character of last name]
  • Receive the initialStockPrice, finalStockPrice, shares (this should be integer), dividends, commissions, and holding period (an integer number of days) from the user and store them in relevant variables.
    • Use the exact same order in receiving the input.
    • Receive all of the inputs of this bullet point in one line.
  • Use the ROI formula (under the "A Simple ROI Example" section), calculate ROI and print the below line to the console:
The ROI of your investment is: [calculated ROI in the 00.00 format]%
  • Use the Annualized ROI formula (under the "Special ROI Considerations" section) and calculate the annualized ROI and print the below line:
    • In converting days to years, consider only 30-day months (assume that one year is 360 days).
The annualized ROI of your investment is: [calculated annualized ROI in the 00.00 format]%
  • Note:
    • ROI and annualized ROI are rounded up to two decimal digits. So, if ROI is 10%, your program should print 10.00%, and if ROI is 9.929% your program should print 10.93%
    • The same rounded value of ROI should be used in annualized ROI calculation. For example if ROI is 9.528, 9.53% or 0.953 should be used when calculating annualized ROI.

import java.util.Scanner;

public class Main {
public static void main(String[] args) {
Scanner scnr = new Scanner(System.in);

/* Type your code here. */
}
}

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution