Answer a sample solution follows start programming

This preview shows page 9 - 13 out of 27 pages.

Answer: A sample solution followsstart
Programming Logic and Design, 9eSolutions 10-10Declarationsnum x = 0num MAX = 15StockTransactions trans[MAX]while x < MAXtrans[x] = getStockData()x = x + 1endwhilex = 0while x < MAXdisplay(trans[x])x = x + 1endwhilestopStockTransaction getStockData()DeclarationsStockTransaction transstring stockSymstring namenum priceoutput “Enter stock symbol ”input stockSymoutput “Enter stock name ”input nameoutput “Enter price ”input pricetrans.setStockSymbol(stockSym)trans.setStockName(name)trans.setPricePerShare(price)return transvoid display(StockTransaction trans)output “Stock Transaction data”output “Stock symbol: ”, trans.getStockSymbol()output “Name: ”, trans.getStockName()output “Price: ”, trans.getPricePerShare()returnd. Design an application that declares an array of 15 StockTransactionobjects. Prompt the user for data for each object, and then pass the array to a method that determines and displays the two stocks with the highest and lowest price per share.
Programming Logic and Design, 9e
7.Complete the following tasks:a. Design a class named Cake. Data fields include two string fields for cake flavor and icing flavor and numeric fields for diameter in inches and price. Include methods to get and set values for each of these fields. Create the class diagram and write the pseudocode that defines the class.
Programming Logic and Design, 9eSolutions 10-12Diagram:Cake-cakeFlavor: string-icingFlavor: string-diameter: num-price: num+setCakeFlavor(cake : string) : void+setIcingFlavor(icing : string) : void+setDiameter(size : num) : void+setPrice(price : num) : void+getCakeFlavor() : string+getIcingFlavor() : string+getDiameter() : num+getPrice() : numPseudocode:class CakeDeclarationsprivate string cakeFlavorprivate string icingFlavorprivate num diameterprivate num pricepublic void setCakeFlavor(string cake)cakeFlavor = cakereturnpublic void setIcingFlavor(string icing)icingFlavor = icingreturnpublic void setDiameter(num size)diameter = sizereturnpublic void setPrice(num price)

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture