Class mortgage declarations private num

This preview shows page 26 - 30 out of 31 pages.

We have textbook solutions for you!
The document you are viewing contains questions related to this textbook.
JavaScript: The Web Warrior Series
The document you are viewing contains questions related to this textbook.
Chapter 7 / Exercise 14
JavaScript: The Web Warrior Series
Vodnik
Expert Verified
class MortgageDeclarationsprivate num mortgageNumberprivate string customerprivate num priceprivate num downPaymentprivate num mortgageAmtprivate ratepublic void setMortgageNumber(num number)num LOW_NUM = 10000num HIGH_NUM = 59999if number > HIGH_NUM then// test for number greater than HIGH_NUMmortgageNumber = 0elseif number < LOW_NUM thenmortgageNumber = 0elsemortgageNumber = number// assign number to mortgageNumberendifendifreturnpublic void setCustomer(string cust)// setCustomer() requires a parametercustomer = custreturnpublic void setPriceAndDown(num pr, num down)if down > pr thendown = pr
We have textbook solutions for you!
The document you are viewing contains questions related to this textbook.
JavaScript: The Web Warrior Series
The document you are viewing contains questions related to this textbook.
Chapter 7 / Exercise 14
JavaScript: The Web Warrior Series
Vodnik
Expert Verified
Programming Logic and Design, 8eSolutions 10-27output "Down payment being reduced to price of house"endifprice = prdownPayment = downmortgageAmt = price - downPayment// mortgageAmt should be price minus downPaymwntsetRate()returnprivate void setRate()Declarationsnum LOW_RATE = 0.05num HIGH_RATE = 0.06num CUTOFF = 200000if mortgageAmt > CUTOFFrate = LOW_RATEelserate = HIGH_RATEreturn public void displayMortgage()// displayMortgage() should be publicoutput "Mortgage #", mortgageNumberoutput "Customer: ", customeroutput "Price of house ", priceoutput "Down payment ", downPaymentoutput "Mortgage amount ", mortgageAmtoutput "Rate ", ratereturnendClassstartDeclarationsMortgage loan1Mortgage loan2Mortgage loan3loan1.setMortgageNumber(34556)loan1.setCustomer("Jones")loan1.setPriceAndDown(100000, 20000)loan1.displayMortgage()loan2.setMortgageNumber(34)loan2.setCustomer("Johnson")loan2.setPriceAndDown(300000, 30000)loan2.displayMortgage()loan3.setMortgageNumber(88849)loan3.setCustomer("Jordan")loan3.setPriceAndDown(180000, 181000)loan3.displayMortgage()stop2.Your downloadable student files for Chapter 10 include a file named DEBUG10-04.jpg that contains a class diagram with syntax and/or logical errors. Examine the class diagram and then find and correct all the bugs.Answer:
Programming Logic and Design, 8eSolutions 10-28Game Zone1.a. Playing cards are used in many computer games, including versions of such classics as Solitaire, Hearts, and Poker. Design a Card class that contains a string data field to hold a suit (spades, hearts, diamonds, or clubs) and a numeric data field for a value from 1 to 13. Include get and set methods for each field. Write an application that randomly selects two playing cards and displays their values.
Programming Logic and Design, 8e

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture