Question: I need help with the first part, Part I - Debugging. #include #include #include #include using namespace std; int main() { string carMake, carModel; double
I need help with the first part, Part I - Debugging.
#include #include #include #include
using namespace std;
int main() { string carMake, carModel; double annualInterestRate, monthlyInterestRate, price, downPayment, tradein; double principal, monthlyPayment, salesTaxRate, salesTax; int numYears, numMonths; int monthlyPrincipal, monthlyInterest, loanBalance;
// get inputs cout > carMake; cout > carModel; cout > price; cout > salesTaxRate; cout > downPayment; cout > tradein; cout > annualInterestRate; cout > numYears;
// calculate monthly payment salesTax = price * salesTaxRate / 100; principal = price + salesTax - downPayment + tradein; monthlyInterestRate = annualInterestRate / 12 / 100; numMonths = numYears * 12; monthlyPayment = principal * monthlyInterestRate / 1 - pow(1 + monthlyInterestRate, -numMonths);
// format numbers to two decimal points cout.setf(ios::fixed); cout.setf(ios::showpoint); cout.precision(2);
// display results cout
cout
cout



Debugging and Health Data Calculator Activity Directions: For each programming exercise, provide your C++ source code and screenshot of your program output Part I - Debugging There are three bugs in carPayment Calculator.cpp. The description of the purpose of the program is in carPaymentCalculator.pdf. Find the three bugs using the techniques discussed in lecture. For each bug, explain your troubleshooting strategy and the nature of the bug. How did you find the bug? How did you fix the bug? What is the bug? (Include line of original code containing the bug) Part II - Health Data Calculator The following program calculates a user's age in days based on the user's age in years: Figure 2.19.1: Health data: Age in days. int main() { int userAgeYears; int userAgeDays; cout > userAge Years; userAgeDays userAge Years * 365; T cout Payment Ant ($) 1831.28 1831.28 1831.28 1831.28 1831.28 1831.28 1831.28 1831.28 1831.28 1831.28 1831.28 1831.28 Principal ($) 1750.84 1757.41 1764.00 1770.61 1777.25 1783.92 1790.61 1797.32 1804.06 1810.83 1817.62 1824.44 80.43 73.87 67.28 60.66 54.02 47.36 40.62 19698.98 17940.67 16176.67 14406.06 12628.80 10844.88 9054.27 7256.95 5452.88 3642.06 1824.44 -0.00 33.95 27.21 20.45 13.66 6.84 Press any key to continue ... DETAILED PROJECT REQUIREMENTS 1. The program should prompt the user to enter the following information about the vehicle and loan: O o vehicle make and model purchase price ($) sales tax rate (%) o down payment amount ($) trade-in value ($) annual interest rate (%) length of loan in years 2. After getting the above information from the user, the program should display a summary of the information given by the user (i.e. those listed under item 1 above). In addition, it should calculate and display the following in the vehicle and loan summary: sales tax = price x sales tax rate loan principal = price + sales tax - down payment - trade-in value monthly payment = (loan principal)x (monthly interest rate) 1-(1+monthly interest rate)-(length of loan in months) Note: monthly interest rate is (annual interest rate) / 12 Note: length of loan in months is (length of loan in years) x 12 3. The program should also display a payment summary for each month until the loan is paid off, including the following information: month number o monthly payment amount ($) Note: this is described in item 2 above interest contributed by that month's payment amount ($) = (loan balance from the previous month) x (monthly interest rate) principal contributed by that month's payment amount ($) = (monthly payment) - interest contributed by that month's payment amount) loan balance ($) after that month's payment = (loan balance from the previous month) - (principal contributed by that month's payment amount) o . o Hint: To display outputs in columns of fixed width, use the setw function from the
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
