



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




JavaDoc & Other Comments Assignment (5) (Copy and paste when necessary) Note: This is assignment four with the required comments added. Stocks.java /* File: Stocks.java
this.stockDollars = stockDollars ; // dollars portion of stock price this.stockEighths = stockEighths ; // eighths portion of stock price // "This" will prevent Java from shadowing the instance variables. } /**
import javax.swing.JOptionPane ; // User Input public class StocksTest { public static void main(String[] args) // Have the user enter the data (company name, number of // shares, dollars, eighths) { System.out.println("@ Name (\u00A7U0#)") ; String company = JOptionPane.showInputDialog ("Write the Company Name Here.") ; int shares = Integer.parseInt(JOptionPane.showInputDialog ("Place the Number of Shares Below")) ; int stockDollars = Integer.parseInt(JOptionPane.showInputDialog ("Place the Dollar Portion of the Stock Price Below.")) ; int stockEighths = Integer.parseInt(JOptionPane.showInputDialog ("Place the Portion of the Stock Price Below.")) ; // Create a StockPortfolio object Stocks Port = new Stocks(company,shares,stockDollars,stockEighths); // Print Port's data System.out.println("Company: " + company + "\n") ; System.out.println("Shares Held: " + shares + "\n" ) ; System.out.println("Opening Price per Share: " + stockDollars + " "
Port.modify(dollars,eighths) ; stockDollars = Port.getStockDollars() ; stockEighths = Port.getStockEighths() ; // Get and print the updated stock price System.out.println("Closing Price per Share: " + stockDollars + " " + stockEighths + "/8\n") ; // Get and print the updated portfolio value decimal = Port.decimal() ; System.out.println("Closing Portfolio Value: $"
OUTPUT run: @ Name (§U0#)