Note that there are some explanatory texts on larger screens.

plurals
  1. PONovice Programmer In need of help for a school Project
    primarykey
    data
    text
    <p>Stock Market Project. Finding errors where the double asterisk's start and end. Tried to fix on my own but to of no avail. I really don't have that much knowledge of programming so i might be missing some key symbols, but I just don't know where they would have to go.</p> <pre><code>package Price; import java.util.Scanner; **public class Trade {** public void StockMarket () { Scanner keyboard = new Scanner(System.in); double next = 0, sum = 0; } public double openpricedow; public double closepricedow; public double currentpricedow; public double lowpricedow; public double openpricenas; public double closepricenas; public double currentpricenas; public double lowpricenas; public double openpricesp; public double closepricesp; public double currentpricesp; public double lowpricesp; String company, dow, nas, sp; int NumberofShares = 0; public void Trade() { System.out.println("Welcome to the Stock Market"); System.out.println("Please enter your stock company"); } **public double findPrice();** **findPrice(); company = keyboard.next();** **Switch (company){** **case "dow":** System.out.println("Please enter your number of shares"); //Scanner keyboard = new Scanner (System.in);// openpricedow = 11.50; closepricedow = 18; lowpricedow = 14.50; currentpricedow = 12.50; boolean areMore = true; while (areMore = true) { next = keyboard.nextInt(); if (next &lt; 0) { areMore = false; } else { sum = Numberofshares + next; } } System.out.println(" You have bought " + sum + " shares at $ " + currentpricedow + " and your total is $ " + (sum * currentpricedow)); // if (Shares &gt; 1000) { // double returnedShares = (Shares * currentpricedow); // System.out.println("You have bought " + Shares + " shares at $" + currentpricesp + " and your total is $" + returnedShares); if (Shares &lt; 1000) { System.out.println("Your number of shares are insufficient"); } case "sp": System.out.println("Please enter your number of shares"); //Scanner keyboard = new Scanner (System.in);// //Shares = keyboard.nextInt(); openpricesp = 13.50; closepricesp = 16; lowpricesp = 15.50; currentpricesp = 8; Shares = 0; next = keyboard.nextDouble(); while (next &gt; 0) { sum = +sum + next; Shares++; next = keyboard.nextDouble(); } if (next &lt; 0) { System.out.println(" You have bought " + sum + " shares at $ " + currentpricesp + " and your total is $ " + (sum * currentpricesp)); } // if (Shares &gt; 1000) { // double returnedShares = (Shares * currentpricesp); // System.out.println("You have bought " + Shares + " shares at $" + currentpricesp + " and your total is $" + returnedShares); else if (Shares &lt; 1000) { System.out.println("Your number of shares are insufficient"); } case "nas": System.out.println("Please enter your number of shares"); //Scanner keyboard = new Scanner (System.in);// Shares = keyboard.nextInt(); openpricenas = 12.50; closepricenas = 14; lowpricenas = 17.50; currentpricenas = 9.80; if (closepricenas &lt; lowpricenas) { System.out.println("Your cannot buy shares at this moment"); } else { Shares = 0; next = keyboard.nextDouble(); while (next &gt; 0) { sum = sum + next; Shares++; next = keyboard.nextDouble(); } if (next &lt; 0) { System.out.println(" You have bought " + sum + " shares at $ " + currentpricenas + " and your total is $ " + (sum * currentpricenas)); } } } // if (Shares &gt; 1000) { // double returnedShares = (Shares * currentpricenas); // System.out.println("You have bought " + Shares + " shares at $" + currentpricenas + " and your total is $" + returnedShares);} **else if (Shares &lt; 1000) System.out.println("Your number of shares are insufficient"); return findPrice;}** **}** enter code here public class Price { public static void main (String [] args) {Trade dow = new Trade(); //&lt;=====buy is the object. stock is the class. dow.openpricedow = 11.50; dow.closepricedow = 18; dow.currentpricedow = 14.50; dow.lowpricedow = 12.50; dow.Trade(); double result = dow.findPrice(); System.out.println("The higher Stock is " + result); } {Trade nas = new Trade(); //&lt;=====buy is the object. stock is the class. nas.openpricenas = 11.50; nas.closepricenas = 18; nas.currentpricenas = 14.50; nas.lowpricenas = 12.50; nas.Trade(); double result = nas.findPrice(); System.out.println("The higher Stock is " + result); } {Trade sp = new Trade(); //&lt;=====buy is the object. stock is the class. sp.openpricesp = 13.50; sp.closepricesp = 16; sp.currentpricesp = 15.50; sp.lowpricesp = 8; sp.Trade(); double result = sp.findPrice(); System.out.println("The higher Stock is " + result); // } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload