# need help setting this up

Hewlett-packard DV6000
January 23, 2009 at 11:46:33
Specs: Windows Vista, intel
 basically, i need to:(a) print a blank (empty) line and the message:"Part I:" and a blank line.(b) compute z = x * cosh(y) enter the values of x and y from the key board. print the values of x, y, and z using printf("%g * cosh(%g) = %g\n", x, y, z);(c) print a blank (empty) line and the message:"Part II:" and a blank line.(d) create a table for monthly payments of auto loans.For annual interest rates: annual_rate = 0.050 to 0.080 withthe increment of 0.0025, compute by using a for-loop themonthly payments for 3-year, 5-year, and 7-year loans.Print the results in a table on the screen using %12.4f forthe annual interest rates and %15.2f for the payments.i know im supposed to use the formula for equal-monthly-payments:month_pay = price * i* (1 + i)^n/((1 + i)^n - 1) (2.4) where i= annual_rate/12. (monthly interest rate),and n = the total number of payments.To compute (1 + i)^n use pow(1.0 + i, (double)n)can anyone help?

See More: need help setting this up

#1
January 23, 2009 at 16:15:25
 sorry. it was in c. i think i got it but im not sure. it says theres an error. can someone double check for me? heres the program:nclude #include int main(void){double x, y, z;double annual_rate, n_3, n_5, n_7;double m_rate, pmt_3, pmt_5, pmt_7, fact;int k, price;// Part Iprintf("\nPart I:\n\n");printf("To compute x * cosh(y), enter x and y values: ");scanf("%lf %lf", &x, &y);/*** 1 ***/z = x * cosh(y); /*** 1 ***/printf("%g * cosh(%g) = %g\n", x, y, z); /*** 1 ***/// Part IIprintf("\nPart II:\n\n");printf("Enter the price (int): \$");scanf("%d", &price); /**** 1 ***/printf("\nprice = \$%d\n\n", price);printf(" Monthly Payments \n\n");printf("Ann. Int. Rates 3-year loan 5-year loan 7-year loan\n");pri-------------\n");for(k=0; k<=12; k++){annual_rate = 0.05 + (double)k*0.0025;m_rate = annual_rate/12.0;/* for the 3-year loan */n_3=3.*12.;/* the number of months */fact = pow(1. + m_rate, n_3);pmt_3 = (double)price * m_rate * fact/(fact - 1.);/* for the 5-year loan */n_5=5.*12.;fact = pow(1. + m_rate, n_5);pmt_5 = (double)price * m_rate * fact/(fact - 1.);/* for the 7-year loan */n_7=7.*12.;fact = pow(1. + m_rate, n_7);pmt_7 = (double)price * m_rate * fact/(fact - 1.);printf("%12.4f %15.2f %15.2f %15.2f\n",annual_rate, pmt_3, pmt_5, pmt_7);}printf("\n");exit(0);/* optional */}and this is what it is supposed to do: or something like itEnter the price (int): \$50000price = \$50000Monthly PaymentsAnn. Int. Rates 3-year loan 5-year loan 7-year loan--------0.0500 ....... ...... ............ ....... ...... ............ ....... ...... ......0.0800 1566.82 1013.82 779.31when i do gcc hw.c -lmit says,/usr/include/iso/math_iso.h:29: error: syntax error before '}' token/usr/include/iso/math_iso.h:32: error: syntax error before "__huge_val"dunno what im doing wrong. anyone help?

Report •

#2
January 25, 2009 at 00:57:53
 It sounds like the header file "math_iso.h" is screwed up. I can't confirm, however, because I don't have a "math_iso.h" header.

Report •

Related Solutions