Housing affordability for first home owners has been discussed recently in the Australian media. It became a headline discussion when one commentator made the remark that young people could afford to save for a deposit if they stopped buying avocado on toast and takeaway coffees.
Your employer wants you to develop a small Java program that allows users to enter the cost to purchase properties in the user’s area, then calculates how many purchases of avocado on toast would be required to save a 20% deposit to purchase those properties. For example, if a house in a particular area cost $400,000 to purchase, a 20% deposit amounts to $80,000. This equates to 4000 purchases of avocado on toast at $20 per serve.
ITECH1000 Programming 1 1717 Java Assignment
Stage 1: Design
This stage requires you to prepare documentation that describes the function of the program and how it is to be tested. There is no coding or code testing involved in this stage. A document template has been provided for your use.
1) Read through Stage 2: Program Development to obtain details of the requirements of this program.
2) Write an algorithm, pseudocode or draw a flowchart that describes how the program will operate. a. All program requirements – base, standard and advanced – must be included, even if you do not end up including all these requirements in your program code.
b. The algorithm, pseudocode or flowchart must be structured logically so that the program would function correctly.
This documentation is aimed at helping you think clearly about how your program must work, so you understand the logic of the program before you attempt to code it. Spending time on this documentation before you begin coding will make it much easier for you to develop your program.
3) Prepare and document test cases that can be used to check that the program works correctly, once it has been coded. You do NOT need to actually run the test cases in this stage; testing will occur in Stage 3: Testing. a. All program requirements – base, standard and advanced, must be included, even if you do not end up including all these requirements in your program code.
b. Make sure the test cases include checking of data entered by the user to make sure that only valid data is accepted. If the user enters invalid data, the user should be informed of this and given another chance to enter the data. NB: As we have not covered exception handling, you may assume that the user will always enter integer values. This includes entering prices in whole amounts of dollars, ignoring the cents.
c. Test cases should be documented using a template like the one below. You may include extra information if you wish. At this stage, the Actual Result column will be left blank.
Stage 2: Program Development
Using your Design Documentation to assist you, develop a Java program that records house prices for an area then compares the deposit required to purchase these with the cost of purchasing avocado on toast, implementing the requirements outlined in this section. These requirements have been broken into three groups:
• Base Functionality includes the minimal level of requirements to achieve the essential components of this assignment. This group of requirements focuses on getting the code to work and on using the programming constructs we cover in class. You can expect to use constants, variables, loops, conditional statements and arithmetic operators for these requirements and you should look for opportunities to use these wherever you can. You will not receive full marks for implementing a requirement, even if it works, if you have not used the appropriate programming construct to do so.
At this level, you can decide if it is easier for you to code everything within a single method initially, or to modularize it straight away.
• Standard Functionality ensures the code is modularized, and that method calls are used to ensure the program flows correctly. It allows data to pass from one method to another as parameters.
• Advanced Functionality provides a challenge task, and is best left until all the other requirements have been addressed. It requires using the Java API to investigate and implement appropriate methods of the GregorianCalendar class.
You are expected to follow coding conventions, such as proper layout of code, using naming conventions and writing meaningful comments throughout your program.
An example of the program running is included in the Appendix for your reference.
CRICOS Provider No. 00103D 1717 Assignment 1 specification.docx Page 4 of 11
1. Display a welcome message when the program starts
• The welcome message should have a row of asterisks at the top and the bottom, just long enough to extend over the text. Hint: Use a For loop for this.
• The first line of the message should read “SAVE A HOUSE DEPOSIT CALCULATOR” and be approximately centred in the row of asterisks by printing white space first. Hint: Can you modify the For loop from the previous step to print the white spaces?
• A second line of the message should be blank.
• The third line should read “Developed by” followed by your name and a comma, then “ student ID ”, then your student id, then finally “ for ITECH1000 Sem 2 2017”.
• The fourth line should be blank.
• The fifth line should repeat the initial line of asterisks.
2. Provide a menu from which the user can select Enter House Prices, Enter Avocado on Toast Price, Deposit Calculator or Exit System. This menu should be repeated each time after the user has chosen and completed an option until the user chooses to Exit System. The user selects an option by entering the number listed next to it. If an invalid number is selected, the user is advised and shown the menu again to make another selection.
CRICOS Provider No. 00103D 1717 Assignment 1 specification.docx Page 5 of 11
3. When the user selects the Enter House Prices option, prompt the user to enter the house prices for the area. The user should be prompted three times, first for the cheapest house listing, second for the chosen house listing, and third for the median house listing. After each prompt, the system reads and saves a positive, whole number value from the user before proceeding. The system should also ensure that the value provided for the cheapest house is the cheapest of all three options entered. When all three values have been entered, the menu is redisplayed.
Note: the lighter values are user-entered while the program is running and may change each time.
4. When the user selects Enter Avocado on Toast Price, prompt the user to enter the price to purchase Avocado on Toast from a local café or restaurant. This should be a positive, whole number value only. Once the user has entered this value, save it for later access and redisplay the menu.
CRICOS Provider No. 00103D 1717 Assignment 1 specification.docx Page 6 of 11
5. When the user selects Deposit Calculator, display a calculation of how many smashed avocados on toast the user will need to not buy in order to save the deposit for each of the three house prices specified. This uses the data provided in Steps 3 and 4. a. The amount of the deposit is a flat 20% of the overall price of each property.
b. The number of avocados required may not be a whole number and should be displayed with 2 decimal places. You can obtain the number of avocados on toast required by dividing the amount of the deposit by the price of a single avocado on toast.
c. The deposit required should be displayed to 2 decimal places.
d. After displaying the calculations, the menu should be redisplayed.
6. When the user selects Exit System, quit the program with a message to the user.
purchase it here