Sell Stock based on current and purchase price

Sell Stock based on current and purchase price -...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
/* * Sell Stock based on current and purchase price. */ package sellstock; import java.util.Scanner; /** * * @author Manny */ public class SellStock { /** * @param args the command line arguments */ public static void main(String[] args) { // Input System.out.println("Please enter the purchase price: "); Scanner in = new Scanner(System.in); double purchasePrice = in.nextDouble();
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: System.out.println("Please enter the current price of stock: "); double currentPrice = in.nextDouble(); //Process String recommendation; if(currentPrice > purchasePrice * .9) { recommendation = "You should sell the stock. "; } else { recommendation = "you should not sell the stock now. "; } //Output System.out.println(recommendation); } }...
View Full Document

This note was uploaded on 12/07/2011 for the course BUS 350 taught by Professor Leighjin during the Fall '11 term at S.F. State.

Ask a homework question - tutors are online