Java代写 | 4483/8995 Software Technology

University of Canberra

Faculty of Science and Technology

 

4483 Software Technology 1 and

8995 Software Technology 1 G

Semester WT, 2019

Marked Tutorial 

(5% of grade Optional Assignment)

 

The House Cost Calculator

 

GENERAL INSTRUCTIONS

This assignment should be done individually. The assignment consists of writing a program and demonstrating it.

 

This assignment is marked by demonstration if you can’t complete it on time (i.e. week 5, then show your tutor what you have done and then do a re-submission week 6). Resubmissions will be allowed until end of week 6. I encourage all students to aim for 5/5 for this mini assignment.

 

Your tutor, will mark the assignment demonstration that you will give. One purpose of the demonstration is for other students to watch, learn and become inspired. Your tutor, can ask you to explain your code as a check that you wrote the assignment yourself.

 

I strongly suggest that you build the assignment over the weekend or in the evenings – it’s likely that a two-hour tutorial is not long enough for a student to complete the assignment to a satisfactory level.

 

Students can work at different levels according to their preferences; the grade you will achieve will depend on the functionality of the submitted program as shown in the marking rubric later in this document. If you are pressed for time skip the Investor report (only 1 mark)

You can ask for help in the tutorials and at PALS, but nobody should do the assignment for you (this is your chance to learn programming on a more realistic problem than the tutorials).

In many ways this is a practice Assignment – the assignment is of similar difficulty, here is a chance to practice and get help so you can confidently attack the main assignment.

MT1  Briefing:

 

Important NOTE: For MT1 you do not need to allow for input of non-numeric in numeric inputs. My test cases will not include things like entering ‘fred’ in the ‘cost of property’ field. So, you don’t need to use exceptions (but you will need to do this in the main assignment due week 7)

 

Here in Australia the housing market is divided into mainly 2 kinds of purchasers.

  • First Home Buyers
  • Investors

 

The system you need to build helps both kinds of customers with different reports by providing the following services:

 

  • For first home buyers it will give them a report on how much they need to pay each month as a repayment;
  • For investors it will report if the property is positive or negative cash flow;

 

The Current Interest Rates are:

 

Bank Loan Type Interest Rate Loan Establishment fee Max percent able to be borrowed
WESTPAC HOME 3.79% 395 80%
WESTPAC INV 3.89% 395 95%
COMB HOME 3.79% 600 95%
COMB INV 3.99% 600 95%
ANZ HOME 3.69% 600 95%
ANZ HOME2 3.63% 600 80%
NAB HOME 3.54% 790 95%
NAB INV 4.86% 0 95%
BEYOND HOME2 3.79% 0 95%

 

Loan Term in Years is 30 years (or 30*12 months = 360 months, 360 Payments)

 

NOTE1: The above rates and information is based on reality but is not reality, its simplified for the assignment. Banks have all kinds of varying terms and conditions to make it hard to compare one bank with another.

NOTE2: Westpac and NAB do not actually have a loan establishment fees as shown. I am using it as an approximation for the assignment, the above table is not a reflection of reality it’s a first-year assignment example.

 

The program must have

  • A clear easy to use main menu with an exit

 

  • Displays the table above, called the “rates report”.

 

  • It produces a report “First Home Buyer report” for a first home buyer of what they will repay each month.

 

  • It produces a ‘Investor report’ for an investor what they will pay each and using the weekly rent as input if it is cashflow negative or positive.

 

  • Note also that some input errors should be detected specifically:

 

  • Bank codes must be WESTPAC, COMB, ANZ, NAB, BEYOND (or the relevant subset)
  • Cost of property must be between 150,000 and 1,000,000
  • Loan type must be INV, HOME, HOME2 (or the relevant subset)
  • Deposit must be between 0 and the cost of the property
  • The rent must be between $100 to $1000
  • NOTE/WARNING – On my marking sheet test cases will check some of this editing

 

 

Calculation of First Home buyer repayments

 

Before we can calculate the repayments there are a few inputs needed:

  1. the cost of the property
  2. The bank
  3. The loan type (Home or Home2)
  4. The amount of deposit

 

Also, in the ACT a $7,000 grant is given to new home buyers; this needs to be added to the deposit (assume this program is for the ACT only).

We are ignoring stamp duty which is low for first home buyers

 

Step Action Notes
1 input and check The cost of the property Range 150,000 to 1,000,000
2 input and check The bank code WESTPAC, COMB, etc.
3 input and check loan type INV, HOME, HOME2
4 input and check amount of deposit Range 0 to cost of property
5 Add 7000 to deposit to give final deposit  
6 Add loan establishment fee to cost of property giving amount needed  
7 Subtract final deposit from amount needed giving amount of loan  
8 Compute % being loaned

(amount of loan)/(cost of the property)*100

 

 
9 Check that the loan is for less than or equal to the max % that can be borrowed If not print a message and return to menu
10 Convert the % interest rate to a decimal Eg 3.71% would become 0.0371
11 Use the supplied formulae to find the monthly repayments This is the method ‘calcMonthPayment’
12 Display all the details – see example run  
     
     

 

Example Calculation: (WESTPAC HOME  3.79%    395     80%)

Step Action Notes
1 input and check The cost of the property 300,000
2 input and check The bank code WESTPAC
3 input and check loan type HOME
4 input and check amount of deposit 50,000
5 Add 7000 to deposit to give final deposit 57,000
6 Add loan establishment fee to cost of property giving amount needed 300,395
7 Subtract final deposit from amount needed giving amount of loan 300,395-57,000 = 243,395
8 Compute % being loaned

(amount of loan)/(cost of the property)*100

243,395/300,000 = 0.8113

=81.13

9 Check that the loan is for less than or equal to the max % that can be borrowed 81.13 < 80 (false)

 

print a message and return to menu

10 Convert the % interest rate to a decimal  
11 Use the supplied formulae to find the monthly repayments  
12 Display all the details – see example run  

 

Example Calculation: (WESTPAC HOME  3.79%    395     80%)

Step Action Notes
1 input and check The cost of the property 300,000
2 input and check The bank code WESTPAC
3 input and check loan type HOME
4 input and check amount of deposit 60,000
5 Add 7000 to deposit to give final deposit 67,000
6 Add loan establishment fee to cost of property giving amount needed 300,395
7 Subtract final deposit from amount needed giving amount of loan 300,395-67,000 = 233,395
8 Compute % being loaned

(amount of loan)/(cost of the property)*100

233,395/300,395 = 0.77798

=77.80

9 Check that the loan is for less than or equal to the max % that can be borrowed 77.80 < 80 (true)

 

10 Convert the % interest rate to a decimal 3.79 becomes 0.0379
11 Use the supplied formulae to find the monthly repayments repay = calcMonthPayment(0.0379,

233395,30);

 

Calculated in Excel this is (-$1,086.19)

12 Display all the details – see example run  

 

 

 

 

 

Calculation of Investor Report

 

Before we can calculate the repayments there are a few inputs needed:

  1. the cost of the property
  2. The bank
  3. The loan type (Home or Home2)
  4. The amount of deposit
  5. The expected weekly rent

 

Also for cash flow purposes:

  • The rent received is typically for 50 weeks (not 52 – this allows for 2 weeks of vacancy)
  • 10% of the rent goes to the renting agent
  • Roughly 4% of the rent goes on maintenance
  • About 6% of the rent goes in land tax, rates and other holding costs
  • We are ignoring stamp duty which is not low for Investors but its complicated so to keep it simple we ignore it.

 

Step Action Notes
  First do the cost calculation  
1 input and check The cost of the property Range 150,000 to 1,000,000
2 input and check The bank code WESTPAC, COMB, etc.
(3) Loan type will be INV  
4 input and check amount of deposit Range 0 to cost of property
5 Input and check weekly rent Range $100 to $1000
6 Add loan establishment fee to cost of property giving amount needed  
7 Subtract final deposit from cost of the property giving amount of loan  
8 Compute % being loaned

(amount of loan)/(cost of the property)*100

 

 
9 Check that the loan is for less than or equal to the max % that can be borrowed If not print a message and return to menu
10 Convert the % interest rate to a decimal Eg 3.71% would become 0.0371
11 Use the supplied formulae to find the monthly repayments This is the method ‘calcMonthPayment’
  Now we do the Income Calculation  
12 Take the weekly rent multiply by 50 giving gross rent  
13 Now multiply the gross rent by 0.8 giving gross income 10%+4%+6% = 20%

100%-20% = 80%

80% >> *0.8

14 Now divide the gross income by 12 giving monthly income  
  Now we do the Cashflow Calculation  
15 Subtract the monthly repayments from monthly income to give monthly cash flow  
16 Display all the details – see example run  
     

 

Example Calculation: (WESTPAC INV       3.89%    395 95%)

Step Action Notes
1 input and check The cost of the property 500,000
2 input and check The bank code WESTPAC
(3) Loan type input not needed will be INV  
4 input and check amount of deposit 45,000
5 Input and check weekly rent $530
6 Add loan establishment fee to cost of property giving amount needed 500,395
7 Subtract deposit from amount needed giving amount of loan 500,395-45,000 = 455,395
8 Compute % being loaned

(amount of loan)/(cost of the property)*100

455,395/500,395 = 0.9100

=91.00

9 Check that the loan is for less than or equal to the max % that can be borrowed 91.00 < 95 (true)

 

10 Convert the % interest rate to a decimal 3.89 becomes 0.0389
11 Use the supplied formulae to find the monthly repayments repay = calcMonthPayment(0.0389,

455395,30);

 

Calculated in Excel this is:

(-$2,145.35)

  Now we do the Income Calculation  
12 Take the weekly rent multiply by 50 giving gross rent 530*50 = 26,500
13 Now multiply the gross rent by 0.8 giving gross income 26500*0.8 = 21,200
14 Now divide the gross income by 12 giving monthly income 21,200/12=1,766.66
  Now we do the Cashflow Calculation  
15 Subtract the monthly repayments from monthly income to give monthly cash flow 1,766.66-2,145.35 = -378.69

 

Yep in this case you lose 378.69 dollars a month

16 Display all the details – see example run  

 

 

 

 

 

 

 

 

Notes

 

During my testing I found small rounding errors were affecting the result. Consequently, I will allow minor rounding errors in the answer (about 1c).

 

The Excel PMT function can help in the creation of test data

The following formulae will give the repayments on a loan of $20,000 over 3 years at 5%

 

=PMT(0.05/12,3*12,20000)   The correct answer is 599.42

 

This website seems to use the same formula as me (as detailed below) accurate to the nearest cent: It may help in testing.

 

http://www.calculator.net/loan-calculator.html?cloanamount=40000&cloanterm=7&cloantermmonth=0&cinterestrate=3&ccompound=monthly&cpayback=month&x=69&y=5

 

The formula I used can be found on Wikipedia. Most students don’t need this level of detail but it’s here for the curious.

 

https://en.wikipedia.org/wiki/Amortization_calculator

 

 

double calcMonthPayment(double yearlyrate, double loan, int years)

{

/* Inputs to this routine are:

yearlyrate – the yearly interest rate as a decimal

(eg a 5% interest rate would be entered as 0.05)

loan – the amount of the loan in dollars and cents (eg 21210.90)

years – an integer indicating the years of the loan (eg 3 )

*/

double retv;

int payments;

double mul;

double rate;

rate = yearlyrate / 12;

payments = years * 12;

mul = Math.pow(1 + rate, payments);

retv = (loan * mul * rate) / (mul – 1);

return retv;

}

 

 

 

 

I provide some code as follows:

 

I provide a Banks class that has been reasonably tested to assist you. It comes with some examples from the lecture.

 

I provide a menu example which uses a do while loop and has two options A and B (as well as an exit)

 

The following code is how I input the deposit amount

System.out.printf(“\nEnter Deposit: “);

double dep = in.nextDouble();

String temp = in.nextLine(); // eat whitespace

 

The following code is how I input bank code

System.out.printf(“\nEnter Bank Id: “);

String ban = in.nextLine();

//ban=ban.trim().toUpperCase();// you may want this

 

Students can change all the object/class models that I supply (there are better ones, but as it’s presented, it’s easy for beginners).

 

I give you this code so you can use it (i.e. its ok to copy and or modify the supplied code).

 

 

 

How to Get Started

 

This may look daunting but its designed to be done in baby steps – each small piece within your grasp (about 27 small steps – each one as simple (I hope) as a tutorial).

 

Beginner students should start with the following process:

  1. Read the assignment through carefully
  2. I mean it – Read the assignment through carefully; try to understand it
  3. Produce a test plan – not a huge formal one but calculate a few examples (as I do above, say 3 new First homebuyers and 3 new Investor reports). This process ensures you understand the maths of how to do it (use the PMT function in excel, I supply a spreadsheet)
  4. Load the menu example run it try to understand it
  5. Modify it so its suitable for the assignment and the exit works (this is worth 1 mark)
  6. Try to code the Rates Report if possible, using supplied Banks Class – if not like print hello (this is worth 1 mark)
  7. Then code the First Homebuyers report it’s the most straightforward (this is worth 2 marks)
    1. First get the menu option working
    2. Then code the input routine for cost of property (check range)
    3. Then code the input routine for bank code and check it
    4. Code the input routine for loan type
    5. Code the input routine for inputting deposit
    6. Do the calculations (will involve declaring new variables)
    7. Do the 15 or so lines of code to print the answer (and all other variables shown in the example) out.
    8. Tidy it up so its neatly formatted
  8. Then code the Investor report (this is worth 1 mark)
    1. Use basically the same steps as the First home buyers plus the extra input and computation.
  9. Test all options thoroughly (this stops mark deductions for things wrong)
  10. Show it to your tutor who will have a test sheet to work through with you and allocate a mark.
  11. If the mark is low and you think you can improve on it, then fix the problem and re-submit it in week 6.

 

 

 

 

 

 

 

 

Marking Rubric

Marks Feature
0 No submission till too late (once I have gone through the answer in the lecture in week 10 we can’t mark any more)
1 Your menu works and exits
+1 the Rates Report works and is nicely formatted
+2 The First Home Buyer Report works and is nicely formatted
+1 the Investor report works and is nicely formatted
   
-0.5 Poor formatting or minor accuracy error
-0.5 minor accuracy error
-0.5 input not edited – WARNING (this will NOT include putting letters in numeric fields)
-0.5 the menu fails to loop
-0.5 Additional failings as identified by your tutor

 

 

Example Runs

 

Menu Exit

 

 

 

Rates Report

 

First Home Buyers

 

 

 

Investment Loan

 

 

 

Error Case 1 Borrow To high a percentage

 

 

Error case 2 ANZ has no INV loan type

 

 

 

Error case 3 Deposit is out of range

 

Error case 4 – cost numbers negative or to big

 

 

 


程序代写代做C/C++/JAVA/安卓/PYTHON/留学生/PHP/APP开发/MATLAB


本网站支持淘宝 支付宝 微信支付  paypal等等交易。如果不放心可以用淘宝交易!

E-mail: [email protected]  微信:itcsdx


如果您使用手机请先保存二维码,微信识别。如果用电脑,直接掏出手机果断扫描。

blank

发表评论