Include methods to set values for each data field and

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

model of automobile, and balance. Include methods to set values for each data field and a method that displays all the loan information. Create the class diagram and write the pseudocode that defines the class.
Programming Logic and Design, 9eSolutions 10-4AutomobileLoan-loanNum: num-make: string-model: string-balance: num+setLoanNum(number : num) : void+setMake(make : string) : void+setModel(mod : string) : void+setBalance(bal : num) : void+displayValues() : voidPseudocode:class AutomobileLoanDeclarationsprivate num loanNumprivate string makeprivate string modelprivate num balancepublic void setLoanNum(num number)loanNum = numberreturnpublic void setMake(string make)this.make = makereturnpublic void setModel(string mod)model = modreturnpublic void setBalance(num bal)balance = balreturnpublic void displayValues()output “Loan number: ”, loanNumoutput “Make: ”, makeoutput “Model: ”, modeloutput “Balance: ”, balancereturnendClassb. Design an application that declares two AutomobileLoanobjects and sets and displays their values.
Programming Logic and Design, 9eSolutions 10-5loan1 = getLoanData()loan2 = getLoanData()display(loan1)display(loan2)stopAutomobileLoan getLoanData()DeclarationsAutomobileLoan loanstring makestring modelnum loanNumnum balanceoutput “Enter the make ”input makeoutput “Enter the model ”input modeloutput “Enter loan number ”input loanNumoutput “Enter balance ”input balanceloan.setMake(make)loan.setModel(model)loan.setLoanNum(loanNum)loan.setBalance(balance)return loanvoid display(AutomobileLoan loan)output “Automobile loan data”loan.displayValues()returnc. Design an application that declares an array of 20 AutomobileLoanobjects. Prompt the user for data for each object, and then display all the values.
Programming Logic and Design, 9eSolutions 10-6x = x + 1endwhilestopAutomobileLoan getLoanData()DeclarationsAutomobileLoan loanstring makestring modelnum loanNumnum balanceoutput “Enter the make ”input makeoutput “Enter the model ”input modeloutput “Enter loan number ”input loanNumoutput “Enter balance ”input balanceloan.setMake(make)loan.setModel(model)loan.setLoanNum(loanNum)loan.setBalance(balance)return loand. Design an application that declares an array of 20 AutomobileLoanobjects. Prompt the user for data for each object, and then pass the array to a method that determines the sum of the balances.

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture