Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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. */ } }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle 11G SQL

Authors: Joan Casteel

2nd Edition

1133947360, 978-1133947363

More Books

Students also viewed these Databases questions