ITECH1000 Programming-House Deposit Calculator
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.
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.
Requirements:
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.
Answer:
Display Welcome message
DO
PRINT “1. Enter House Prices”
PRINT “2. Enter Avocado on Toast Price”
PRINT “3. Deposit Calculator”
PRINT “4. Exit System”
READ menuChoice
IF menuChoice==1 THEN
Read “Cheapest Price”, dblCheapest
Read “Chosen Price”, dblSelected
Read “Median Price”, dblMedian
ELSE IF menuChoice==2 THEN
READ “Avocados on Toast Price : “, avocadoPrice
text-align: justify;">ELSE IF menuChoice==3 THEN
PRINT “DEPOSIT SAVING CALCULATOR”
PRINT “You will need to NOT buy”
PRINT “dblCheapest*discount/avocadoPrice+" smashed avocados on toast to save $"+dblCheapest*discount+" deposit for the cheapest house"
PRINT “dblSelected*discount/avocadoPrice+" smashed avocados on toast to save $"+ dblSelected*discount+" deposit for the chosen house"
PRINT “dblMedian*discount/avocadoPrice+" smashed avocados on toast to save $"+ dblMedian*discount+" deposit at the median price"
READ "How many times a week do you purchase avocado on toast?",numAcocadoPerWeek
ADD Current date to Number of Week
PRINT “If you stop buying avocado on toast starting from today and save the moneny instead,nyour deposit for a $”, futureDate
END IF
WHILE (menuChoice!=4)
PRINT “The House Deposit Calculator is now exiting
Section 2: Program Development
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.Scanner;
public class Assign1
{
public static Scanner readData=new Scanner(System.in);
public static void printStar(int count) //print the star which depends upon the count value
{
int i;
for(i=1;i<=count;i++)
System.out.print("*");
System.out.println();
}
public static int readChoice()
int inData=-1;
do
try
System.out.println("Please select an option from the menu :" );
System.out.println("1. Enter House Pricesn2. Enter Avocado on Toast Pricen3. Deposit Calculatorn4. Exit System");
inData=Integer.parseInt(readData.nextLine()); //read the menu choice
if(inData<0 || inData>4) //validate the menu choice is between 1 and 4
System.out.println("nPlease enter the input between 1 and 4n"); //if the condition is false, print the error message
else
break;
catch(NumberFormatException nfe) //if any number format has exception, it displays an error message
System.out.println("nInvalid input : please retryn");
catch(Exception e)
System.out.println("nInvalid input : please retryn");
}while(inData>0 && inData<=4);
return inData;
public static double readPositive(String str)
double data=0;
do
try
System.out.println(str);
data=Double.parseDouble(readData.nextLine()); //read the value
if(data<=0) //validate the input data is less than or equal to zero
System.out.println("nValue should be greater than 0n"); //if the condition is true, print an error message
else
break;
catch(NumberFormatException nfe)
System.out.println("nInvalid input : please retryn");
catch(Exception e)
System.out.println("nInvalid input : please retryn");
}while(true);
return data;
public static void main(String[] args)
int menuChoice=-1,flag=0,numAcocadoPerWeek=0,futureNumWeek;
double dblCheapest=0,dblSelected=0,dblMedian=0,avocadoPrice=0,discount=20.0/100;
GregorianCalendar currentDate=new GregorianCalendar();
SimpleDateFormat dFormat = new SimpleDateFormat("dd/mm/yyyy"); //date formatting object
NumberFormat nFormat = new DecimalFormat("#0.00"); //decimal number format
printStar(86);
System.out.println("ntttSAVE A HOUSE DEPOSIT CALCULATORn"); //display the welcome message
System.out.println("Developed by Mohammad Mozammel Hoque, Student ID 30332712 for ITECH1000 Sem 2 2017n");
printStar(86);
do
menuChoice=readChoice(); //read menu choice
if(menuChoice==1)
System.out.println("nHouse Details :");
dblCheapest=readPositive("Enter asking price for cheapest house listing : $"); //read the cheapest price of house
dblSelected=readPositive("nEnter asking price for your chosen house : $"); //read the chosen price of house
if(dblCheapest<dblSelected) //check the cheapest is less than the selected value
dblMedian=readPositive("nEnter the median value for this area : $"); //if yes, read the median value
if(dblCheapest<dblMedian) //validate the cheapest is less than median, set 1 to flat
flag=1;
else
dblCheapest=0.0; //if the cheapest is greater than median, set cheapest, chosen and median to zero
dblSelected=0.0;
dblMedian=0.0;
flag=0;
System.out.println("nCheapest price should be less than median housen");
else
System.out.println("nCheapest price should be less than chosen housen"); //if the selected value is less than cheapest, display an error message
else if(menuChoice==2) //if the choice is 2,
if(flag==1) //if flag is 1 (it means that house data are entered successfully)
avocadoPrice=readPositive("Enter the price (in dollars) of avocado on toast from a local cafe or restaurant: $"); //read the avocado on toast price
flag=2;
else
System.out.println("nYou need to enter all the house prices firstn" ); //if house data are not entered, it displays an error message
else if(menuChoice==3)
if(flag==2)
System.out.println("DEPOSIT SAVING CALCULATOR");
printStar(95);
System.out.println("You will need to NOT buy"); //display the deposit saving calculating information
System.out.println(nFormat.format(dblCheapest*discount/avocadoPrice)+" smashed avocados on toast to save $"+nFormat.format(dblCheapest*discount)+" deposit for the cheapest house");
System.out.println(nFormat.format(dblSelected*discount/avocadoPrice)+" smashed avocados on toast to save $"+nFormat.format(dblSelected*discount)+" deposit for your chosen house");
System.out.println(nFormat.format(dblMedian*discount/avocadoPrice)+" smashed avocados on toast to save $"+nFormat.format(dblMedian*discount)+" deposit for a house at the median price");
printStar(95);
numAcocadoPerWeek=(int) readPositive("How many times a week do you purchase avocado on toast?");
futureNumWeek=(int) (dblSelected /(numAcocadoPerWeek * 4 * 20)); //read the number of toast per week purchased
currentDate.add(Calendar.WEEK_OF_MONTH, futureNumWeek); //add current date to number of avocado per week
System.out.println("nIf you stop buying avocado on toast starting from today and save the moneny instead,nyour deposit for a $"+dblSelected+" house will be saved in the week of "+dFormat.format(currentDate.getTime()));
printStar(100);
else
System.out.println("nYou need to enter all house and avocado prices firstn");
}while(menuChoice!=4);
System.out.println("nThe House Deposit Calculator is now exiting"); //print the exit message
Section 3: Testing
Document your testing here. Copy your test cases here from Section 1 as you need them. You can use screen captures to show the Actual Results – if using Microsoft Windows, the Snipping Tool is handy for this.
Note: If you find that a test case fails when you try it (i.e. the program does not return the expected results), make sure you include that in your results too. This is a GOOD thing and the reason for testing in the first place – even professional programmers make mistakes while coding and we need to test to find these issues. After you find an error, find the issue, try to fix it, and then test the code again. Show your updated results in the Actual Results section as well. You can include comments with this to explain what has happened.
Buy ITECH1000 Programming-House Deposit Calculator Answers Online
Talk to our expert to get the help with ITECH1000 Programming-House Deposit Calculator Answers to complete your assessment on time and boost your grades now
The main aim/motive of the management assignment help services is to get connect with a greater number of students, and effectively help, and support them in getting completing their assignments the students also get find this a wonderful opportunity where they could effectively learn more about their topics, as the experts also have the best team members with them in which all the members effectively support each other to get complete their diploma assignments. They complete the assessments of the students in an appropriate manner and deliver them back to the students before the due date of the assignment so that the students could timely submit this, and can score higher marks. The experts of the assignment help services at urgenthomework.com are so much skilled, capable, talented, and experienced in their field of programming homework help writing assignments, so, for this, they can effectively write the best economics assignment help services.