ee312bank - #include #define INTEREST 0.2 main int...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
#include <stdio.h> #define INTEREST 0.2 main () { int select, counter, end; float loan, term, emi, ppayment, sub; printf( "Good morning! Welcome to the EE312 Bank." ); start: printf( "\nPlease select from the following choices:\n" ); printf( "Press 1 to calculate the EMI for a new loan.\n" ); printf( "Press 2 to calculate payment amounts for prepaying a loan.\n" ); printf( "Press 3 to exit.\n" ); scanf( "%d" , &select); switch (select) { case 1: printf( "Enter the loan's principal ($ sign not required):" ); scanf( "%f" , &loan); printf( "Enter the loan's term (in months) :" ); scanf( "%f" , &term); if (loan >= 0){ if (term >= 0){ /*price and term of loan must be > 0*/ loan = loan + (loan * INTEREST); /*equation of loan plus the interest*/ emi = loan/term; /*equation of the monthly payments*/ printf( "Thank you. Your esimated monthly payment (EMI) for each month is: $%.2f\n" , emi); goto start; /*jumps to start of program*/ } else printf( "Illegal Value." ); break ; } else printf( "Illegal Value." ); break
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/01/2008 for the course EE 312 taught by Professor Shafer during the Spring '08 term at University of Texas.

Page1 / 2

ee312bank - #include #define INTEREST 0.2 main int...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online