Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CSE 110 - Introduction to Computer Science I CSE 110-Car Loan Program PROJECT #1-File handling, Loops, and Functions Modify the Car Loan program that computed

image text in transcribed
image text in transcribed
image text in transcribed
CSE 110 - Introduction to Computer Science I CSE 110-Car Loan Program PROJECT #1-File handling, Loops, and Functions Modify the Car Loan program that computed car loan information (or create a new Project) to read the input values from a fle called loanData.txt. The program will ead a set of values, compute the results, and write the results to a file called yourName.txt and display them on the output console. Then read another set of data etc. until the end of the file is reached. The data is provided on the next page. The program conditions, one to compute amount, and at least one for the output. The loop that reads data and calls the functions should be in main. must have at least four (4) functions in a header file: one for opening the files with file failure the payment amount, one to compute the total interest paid-in and the total payback Create the input file (data on next page) named "loanData.txt" .The input and output streams must be declared in main and passed as needed to functions The program must read the data from the data file "loanData.txt" There should be a loop in main that reads data and calls the functions to compute the values and calls the output function, then reads another set of data etc until the end of file is reached . The program must produce the required output to the console window and to a file "your nome.txt . The output must be as shown below both in the console window and the output file Main will close both of the files before returning zero * Be sure to output "Project #1 and your name" at the top as shown below The equation for the monthly payment amount is in the previous lab instructions. Note that when interest is 0%, there is special handling for some computations Output Formatting for the display and output file are to be exactly as shown below including your name "ENBCCSpring 201 9CSE 1 10 1 02CSE 1 10 Labs NEw Lab 1234project 1 Car L-- Project -First Nano Last Nano Monthly Paynent Loan Asount Total Intereot Payback mount $10000.00 225.79 837.95 $10837.95 3617.86 $14500.00 428.7 934.75 $1543475 5600.00 162.85 262.77 $ 5862.7 27436.00 457.27 0.00 27436.00 $ 9999.00 232.54 $1162.99 $11161 99 $18750.00 310.74 3623.40$22373.40 3500.00 150.74 117.86 ocess returned 0 (0x0) execution tie 0.203 ess any key to continue CSE 110-Introduction to Computer Science I and test against the output shown above using this data. The input data order is loan, interest rate, and duration precision for both types of output. in months. Use Be sure to add a carriage return at the end of the data below (an extra blank line) in your text file. 10000 48 3500 3.2 24 14500 4.1 36 5600 36 27436 60 5.5 18750 72 Write a multi-file program for a car dealer that calculates the monthly payment and total payback amount for the inputs of loan amount, interest rate, and loan duration in months. Allow the user to run it multiple times without restarting the program. The program must have the following four (4) functions called from main and located in a header file 1. A function for getting and validating the input (input must be reasonable) 2. A function to compute and return the monthly payment amount 3. A function to compute the total interest paid-in and the total payback amount 4. A function to produce the output with the amounts right aligned The output will be formatted exactly as shown below (use setw(x) with the introduction banner as shown. Variables may not be declared globally, and must be passed by value when appropriate, and passed by reference when appropriate. All functions must be called from main The equation for determining the monthly payment for a loan is: Monthly Loan Payment Formula: The formula is MPL(r/ (1-(1 + 1). MP monthly payment amount L principal, meaning the amount of money borrowed . r effective interest rate. Note that this is usually not the annual interest rate; see below N -total number of payments Calculate the effective interest rate (r)- Most loan terms use the "nominal annual interest rate, but that is an annual rate. Divide the annual interest rate by 100 to put it in decimal form, and then divide it by the number of payments per year (12) to get the effective interest rate. For example, if the annual interest rate is 5%, and payments are made monthly (12 times per year), caculate 5/100 to get 0.05, then calculate rate -0.05/12 0.004167 * Use the cmath library for the power function.-#include math f the user runs the program again, use the following to clear the console window include system( CLS") CSE 110 - Introduction to Computer Science I CSE 110-Car Loan Program PROJECT #1-File handling, Loops, and Functions Modify the Car Loan program that computed car loan information (or create a new Project) to read the input values from a fle called loanData.txt. The program will ead a set of values, compute the results, and write the results to a file called yourName.txt and display them on the output console. Then read another set of data etc. until the end of the file is reached. The data is provided on the next page. The program conditions, one to compute amount, and at least one for the output. The loop that reads data and calls the functions should be in main. must have at least four (4) functions in a header file: one for opening the files with file failure the payment amount, one to compute the total interest paid-in and the total payback Create the input file (data on next page) named "loanData.txt" .The input and output streams must be declared in main and passed as needed to functions The program must read the data from the data file "loanData.txt" There should be a loop in main that reads data and calls the functions to compute the values and calls the output function, then reads another set of data etc until the end of file is reached . The program must produce the required output to the console window and to a file "your nome.txt . The output must be as shown below both in the console window and the output file Main will close both of the files before returning zero * Be sure to output "Project #1 and your name" at the top as shown below The equation for the monthly payment amount is in the previous lab instructions. Note that when interest is 0%, there is special handling for some computations Output Formatting for the display and output file are to be exactly as shown below including your name "ENBCCSpring 201 9CSE 1 10 1 02CSE 1 10 Labs NEw Lab 1234project 1 Car L-- Project -First Nano Last Nano Monthly Paynent Loan Asount Total Intereot Payback mount $10000.00 225.79 837.95 $10837.95 3617.86 $14500.00 428.7 934.75 $1543475 5600.00 162.85 262.77 $ 5862.7 27436.00 457.27 0.00 27436.00 $ 9999.00 232.54 $1162.99 $11161 99 $18750.00 310.74 3623.40$22373.40 3500.00 150.74 117.86 ocess returned 0 (0x0) execution tie 0.203 ess any key to continue CSE 110-Introduction to Computer Science I and test against the output shown above using this data. The input data order is loan, interest rate, and duration precision for both types of output. in months. Use Be sure to add a carriage return at the end of the data below (an extra blank line) in your text file. 10000 48 3500 3.2 24 14500 4.1 36 5600 36 27436 60 5.5 18750 72 Write a multi-file program for a car dealer that calculates the monthly payment and total payback amount for the inputs of loan amount, interest rate, and loan duration in months. Allow the user to run it multiple times without restarting the program. The program must have the following four (4) functions called from main and located in a header file 1. A function for getting and validating the input (input must be reasonable) 2. A function to compute and return the monthly payment amount 3. A function to compute the total interest paid-in and the total payback amount 4. A function to produce the output with the amounts right aligned The output will be formatted exactly as shown below (use setw(x) with the introduction banner as shown. Variables may not be declared globally, and must be passed by value when appropriate, and passed by reference when appropriate. All functions must be called from main The equation for determining the monthly payment for a loan is: Monthly Loan Payment Formula: The formula is MPL(r/ (1-(1 + 1). MP monthly payment amount L principal, meaning the amount of money borrowed . r effective interest rate. Note that this is usually not the annual interest rate; see below N -total number of payments Calculate the effective interest rate (r)- Most loan terms use the "nominal annual interest rate, but that is an annual rate. Divide the annual interest rate by 100 to put it in decimal form, and then divide it by the number of payments per year (12) to get the effective interest rate. For example, if the annual interest rate is 5%, and payments are made monthly (12 times per year), caculate 5/100 to get 0.05, then calculate rate -0.05/12 0.004167 * Use the cmath library for the power function.-#include math f the user runs the program again, use the following to clear the console window include system( CLS")

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

The company has fair promotion/advancement policies.

Answered: 1 week ago