Design a class named checkingaccount that holds a

This preview shows page 3 - 7 out of 15 pages.

5.Design a class namedCheckingAccountthat holds a checking account number,name of account holder, and balance. Include methods to set values for each data fieldand a method that displays all the account information. Create the class diagram andwrite the pseudocode that defines the class.
We have textbook solutions for you!
/Java-Programming-9th-Edition-9781337397070-773/
The document you are viewing contains questions related to this textbook.
Chapter 1 / Exercise 5
Java Programming
Farrell
Expert Verified
Programming Logic and Design, 7eSolutions 10-4-balance: num+setAccountNum(number : num) : void+setName(name : string) : void+setBalance(bal : num) : void+displayValues() : voidPseudocode:class CheckingAccountDeclarationsprivate num accountNumprivate string nameprivate num balancepublic void setAccountNum(num number)accountNum = numberreturnpublic void setName(string name)this.name = namereturnpublic void setBalance(num bal)balance = balreturnpublic void displayValues()output “Account number: ”, accountNumoutput “Name: ”, nameoutput “Balance: ”, balancereturnendClass6.Complete the following tasks:a. Design a class namedStockTransactionthat holds a stock symbol (typicallyone to four characters), stock name, and price per share. Include methods to set andget the values for each data field. Create the class diagram and write the pseudocodethat defines the class.
Programming Logic and Design, 7eSolutions 10-5+getStockSymbol() : string+getStockName() : string+getPricePerShare() : numPseudocode:class StockTransactionDeclarationsprivate string stockSymbolprivate string stockNameprivate num pricePerSharepublic void setStockSymbol(string symbol)stockSymbol = symbolreturnpublic void setStockName(string name)stockName = namereturnpublic void setPricePerShare(num price)pricePerShare = pricereturnpublic string getStockSymbol()return stockSymbolpublic string getStockName()return namepublic num getPricePerShare()return pricePerShareendClassb. Design an application that declares twoStockTransactionobjects and setsand displays their values.
Programming Logic and Design, 7eSolutions 10-6DeclarationsStockTransaction 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()return

Upload your study docs or become a

Course Hero member to access this document

Upload your study docs or become a

Course Hero member to access this document

End of preview. Want to read all 15 pages?

Upload your study docs or become a

Course Hero member to access this document

Term
Fall
Professor
N/A
Tags
Subroutine, Return statement, Void type, National identification number
We have textbook solutions for you!
The document you are viewing contains questions related to this textbook.
Java Programming
The document you are viewing contains questions related to this textbook.
Chapter 1 / Exercise 5
Java Programming
Farrell
Expert Verified

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture