Hey everyone, I'm new to the site, this site returned the most results when trying to look for relevant information so here i am. I have seen people write questions to assignments on here without trying expecting people to answer the assignment question. And ive also seen people steal code and ask for a pseudocode breakdown.

I hope i fall in neither of those categories as they seemed to get laughed at quite a bit i am just looking for some clarification in my code to determine if it is correct to start programming in C++. I havent given the question to the assignment as i am led to believe with a good pseudo code you should be able to determine the idea of the program.

Loan_deposit_calculator
READ Loan_Amount THEN
IF Loan_Amount <=$0.00 or >$100,000 THEN
error_message ='Loan amount is under $0.00 or exceeds $100,000'
END IF
PRINT error_message

READ Loan_Amount THEN

IF Loan_Amount <$25,000 THEN
Calculate Deposit_Amount = 0.05*Loan_Amount

ELSE IF Loan_Amount >=$25,000 and <$50,000 THEN
Calculate Deposit_Amount = (0.10*Loan_Amount) + $1,250

ELSE IF Loan_Amount >=$50,000 and <=$100,000 THEN
Calculate Deposit_Amount = (0.25*Loan_Amount) + $5,000

END IF

PRINT Loan_Deposit
END


Thanks to anyone in advance who can help.

Recommended Answers

All 4 Replies

I often use pseudo code to express clearly what I want to do. However, do try to be consistent. Example, in your IF/ELSE/ENDIF block you assign the calculated amount to the variable Deposit_Amount, but at the end you print Loan_Deposit, and not Deposit_Amount, which is what I think you were intending. Also, your initial read/if/endif block where you take input to Loan_Amount, should probably be a do/while loop, breaking out only when the Loan_Amount value is valid, or a termination value is input.

Great,

Thanks for your help there "rubberman" Deposit_Amount updated and ill change the code around to include the DO/WHILE loop, makes more sens that way too.

Thanks

Are you sure that this line:

Calculate Deposit_Amount = (0.25*Loan_Amount) + $5,000

shouldn't be:

Calculate Deposit_Amount = (0.25*(Loan_Amount - $50,000)) + $3,750

and similarly for the other ones. That would seem to make more sense to me (at least, that's how income tax is calculated). I mean, the deposit amount should be a continuous function of the loan amount, right? As in, 0 -> 25,000 loan (5% bracket) requires 0 -> 1,250 deposit, 25,000 -> 50,000 loan (10% bracket) requires 1,250 -> 3,750 deposit, and 50,000 -> 100,000 loan (25% bracket) requires 3.750 -> 15,500 deposit. Otherwise, when you go from 24,999 to 25,000 you get a jump of 2,500 in the deposit amount.

I see where your coming from but i dont think the question goes into that much detail.

Loan Amount - Deposit
< $25,000 = 5% of loan value
$25,000 - $49,999 = $1250 + 10% of loan over $25,000
$50,000 - $100,000 = $5,000 + 25% of loan over $50,000

Unless i am reading it wrong, in that case thankyou.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.