Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Complete the following tasks: a. Design a class named StockTransaction that hold

ID: 663742 • Letter: C

Question

Complete the following tasks:

a. Design a class named StockTransaction that holds a stock symbol (typically one to four characters), stock name, and price per share. Include methods to set and get the values for each data field. Create the class diagram and write the pseudocode that defines the class.

b. Design an application that declares two StockTransaction objects and sets and displays their values.

c. Design an application that declares an array of 10 StockTransactions. Prompt the user for data for each of the objects, and then display all the values.

Explanation / Answer

public class PC214
{
public static void main(String[ ] args)

{
double purShares,purPirce,purCost,purComm,soldShares,soldPrice, soldCommision; // StockBroker items

purShares=1000;
purPrice=32.87;
purCost=purShares*purPrice;
purComm=-purCost*.02;

soldShares=1000;
soldPrice=33.92;
soldCost=soldShares*soldPrice;
soldComm=-soldCost*.02;

System.out.println( purCost);
System.out.println( purComm);
System.out.println( soldCost);
System.out.println( soldComm +" ___________");

}
}