Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

trying to figure out what i am missing in this debugging // The Mortgage class contains fields for mortgage // number, customer name, price of

trying to figure out what i am missing in this debugging

// The Mortgage class contains fields for mortgage // number, customer name, price of house, down // payment, mortgage amount, and mortgage rate, // and methods to set and get the values. // The mortgage number must be betwen 10000 and 59999 inclusive // or else it is set to 0 // The down payemnt cannot be more than the price of the house // If it is, an error message is displayed // and the down payment is reduced // The mortage amount is the difference between the house price // and the down payment // The mortgage rate differs for loans of different sizes // Loans over $200,000 get a preferred rate // The demonstration program instantiates three Mortgages and // purposely assigns invalid values to some of the arguments; // the class methods will correct the invalid values. class Mortgage Declarations private num mortgageNumber private string customer private num price private num downPayment private num mortgageAmt private rate public void setMortgageNumber(num number) num LOW_NUM = 10000 num HIGH_NUM = 59999 if number = HIGH_NUM then mortgageNumber = 0 else if number < LOW_NUM then mortgageNumber = 0 else number = mortgageNumber endif endif return public void setCustomer() customer = cust return public void setPriceAndDown(num pr, num down) if down > pr then down = pr output "Down payment being reduced to price of house" endif price = pr downPayment = down mortgageAmt = price * downPayment setRate() return private void setRate() Declarations num LOW_RATE = 0.05 num HIGH_RATE = 0.06 num CUTOFF = 200000 if mortgageAmt > CUTOFF rate = LOW_RATE else rate = HIGH_RATE return private void displayMortgage() output "Mortgage #", mortgageNumber output "Customer: ", customer output "Price of house ", price output "Down payment ", downPayment output "Mortgage amount ", mortgageAmt output "Rate ", rate return endClass

start Declarations Mortgage loan1 Mortgage loan2 Mortgage loan3 loan1.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() stop

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Filing And Computer Database Projects

Authors: Jeffrey Stewart

2nd Edition

007822781X, 9780078227813

More Books

Students also viewed these Databases questions

Question

What is the Definition for Third Normal Form?

Answered: 1 week ago

Question

Provide two examples of a One-To-Many relationship.

Answered: 1 week ago