NO

Author Topic: helpppp plz! ive had some help just need alil more lol  (Read 5066 times)

dnasty54

  • Guest
helpppp plz! ive had some help just need alil more lol
« on: September 30, 2014, 08:18:41 PM »
/*
* Monthly car payment
*/

#include <stdio.h>  /* printf, scanf definitions */
#include <math.h>

int
   main (void)
{
   double down_payment_price; /* input - down payment price */
   double purchase_price; /*  input - purchase price */
       double n; /* input - total number of payments */
   double annaual_interest_rate; /* input - annaual interest rate */
   double total_number_of_payments; /* input - total number of payments */
   double monthly_payment; /* output- monthly payment */

   /* get the down payment of car */
   printf("enter down payment price> ");
   scanf('%lf", down_payment price);

   /* get purchase price */
   printf(" enter purchase price> ");
   scanf("%lf", purchase_price);

   /* get total number of payments */
   printf(" enter total number of payments> ");
   scanf("%lf", n);

   /* get annaual interest rate */
   printf(" enter annaual interest rate> ");
   scanf("%lf", annaual_interest_rate);

   /* get the total number of payments */
   printf(" the total number of payments> ");
   scanf("%lf", total_number_of_payments);

      /* calculate amount borrowed */
   p = purchase_price - down_payment;

   /* calculate monthly interest rate */
   I = annaual_interest_rate /2

   /* calculate monthly car payment */
   monthly_car_payment = 1-(1+i)^-n/ip

   /* display the monthly car payment */
   printf("\nthe monthly car payment is %.2f", payment);

      return (0)
}


C:\Users\student\Documents\monthly car payment.c(20): error #1040: Unterminated string or char const.
C:\Users\student\Documents\monthly car payment.c(23): error #2140: Type error in argument 1 to 'scanf'; found 'int' expected 'restrict const char *'.
C:\Users\student\Documents\monthly car payment.c(23): error #2001: Syntax error; found ';' expecting ')'.
C:\Users\student\Documents\monthly car payment.c(39): error #2048: Undeclared identifier 'p'.
C:\Users\student\Documents\monthly car payment.c(39): error #2048: Undeclared identifier 'down_payment'.
C:\Users\student\Documents\monthly car payment.c(42): error #2048: Undeclared identifier 'I'.
C:\Users\student\Documents\monthly car payment.c(45): error #2001: Syntax error; found 'monthly_car_payment' expecting ';'.
C:\Users\student\Documents\monthly car payment.c(45): error #2048: Undeclared identifier 'monthly_car_payment'.
C:\Users\student\Documents\monthly car payment.c(45): error #2048: Undeclared identifier 'i'.
C:\Users\student\Documents\monthly car payment.c(45): error #2048: Undeclared identifier 'ip'.
C:\Users\student\Documents\monthly car payment.c(48): error #2168: Operands of ^ have incompatible types 'int' and 'double'.
C:\Users\student\Documents\monthly car payment.c(48): error #2001: Syntax error; found 'printf' expecting ';'.
C:\Users\student\Documents\monthly car payment.c(48): error #2048: Undeclared identifier 'payment'.
C:\Users\student\Documents\monthly car payment.c(51): error #2001: Syntax error; found '}' expecting ';'.
C:\Users\student\Documents\monthly car payment.c(16): warning #2114: Local 'monthly_payment' is not referenced.
C:\Users\student\Documents\monthly car payment.c(11): warning #2114: Local 'down_payment_price' is not referenced.
*** Error code: 1 ***
Done.

Offline Bitbeisser

  • Global Moderator
  • Member
  • *****
  • Posts: 772
Re: helpppp plz! ive had some help just need alil more lol
« Reply #1 on: October 01, 2014, 12:53:52 AM »
No hard feelings but you really need to pay attention to the (first) error message you get, just click on the error in the message window and the IDE will highlight the offending source code line. And when you then take a look at what exactly you wrote and the look at the error message, it tells you pretty much exactly what you did wrong...

And on a more general note, please note that nobody will do your homework/class assignments for you! If you ask specific questions, you will get specific answers to that, not getting a completely fixed result.

Ralf

PS: The string delimiter " and the char delimter ' can not randomly be mixed, you need to properly begin and terminate each string and/or character with the proper (and same!) delimiter!

dnasty54

  • Guest
Re: helpppp plz! ive had some help just need alil more lol
« Reply #2 on: October 01, 2014, 01:00:33 AM »
it does not highlight the line when i try to click on it!

dnasty54

  • Guest
Re: helpppp plz! ive had some help just need alil more lol
« Reply #3 on: October 01, 2014, 01:04:05 AM »
it doesnt even let me click on the error messages

Offline Bitbeisser

  • Global Moderator
  • Member
  • *****
  • Posts: 772
Re: helpppp plz! ive had some help just need alil more lol
« Reply #4 on: October 01, 2014, 01:16:36 AM »
it doesnt even let me click on the error messages
Sure it does, see the attachment.

And looking over the program in general, I would suggest to take a deep breath and go over the program line by line, there are at least a dozen or so rather trivial errors here that should be obvious even to a complete newbie. You just need to try to focus and concentrate on what you are trying to accomplish and what in fact you are typing...

Ralf

dnasty54

  • Guest
Re: helpppp plz! ive had some help just need alil more lol
« Reply #5 on: October 01, 2014, 02:04:20 AM »
Awwwww ok thanks that helped ALOT!! now im stuck on these last few errors idk what there asking me to????


/*
* Monthly car payment
*/

#include <stdio.h>  /* printf, scanf definitions */
#include <math.h>

int
   main (void)
{
   double down_payment_price; /* input - down payment price */
   double purchase_price; /*  input - purchase price */
       double n; /* input - total number of payments */
   double annaual_interest_rate; /* input - annaual interest rate */
   double total_number_of_payments; /* input - total number of payments */
   double monthly_car_payment; /* output- monthly payment */
   double p; /* output- principal */
   double I; /* output - monthly interest rate */

   /* get the down payment of car */
   printf("enter down payment price> ");
   scanf("%lf", down_payment_price);

   /* get purchase price */
   printf(" enter purchase price> ");
   scanf("%lf", purchase_price);

   /* get total number of payments */
   printf(" enter total number of payments> ");
   scanf("%lf", n);

   /* get annaual interest rate */
   printf(" enter annaual interest rate> ");
   scanf("%lf", annaual_interest_rate);

   /* get the total number of payments */
   printf(" the total number of payments> ");
   scanf("%lf", total_number_of_payments);

      /* calculate amount borrowed */
   p = purchase_price - down_payment_price;

   /* calculate monthly interest rate */
   I = annaual_interest_rate /2

   /* calculate monthly car payment */
   monthly_car_payment = 1-(1+I)^-n/I*p

   /* display the monthly car payment */
   printf("\nthe monthly car payment is %.f", monthly_car_payment);

      return (0)
}

C:\Users\student\Documents\monthly car payment.c(47): error #2001: Syntax error; found 'monthly_car_payment' expecting ';'.
C:\Users\student\Documents\monthly car payment.c(50): error #2168: Operands of ^ have incompatible types 'double' and 'double'.
C:\Users\student\Documents\monthly car payment.c(50): error #2001: Syntax error; found 'printf' expecting ';'.
C:\Users\student\Documents\monthly car payment.c(53): error #2001: Syntax error; found '}' expecting ';'.
*** Error code: 1 ***

Offline Bitbeisser

  • Global Moderator
  • Member
  • *****
  • Posts: 772
Re: helpppp plz! ive had some help just need alil more lol
« Reply #6 on: October 01, 2014, 03:04:41 AM »
Why do you keep posting all over the place?  :( :-\

Again, the lines given in the error message might not point at the immediately faulty instructions, but at the instruction/line of code right after it...
And as such, in your case, the error message tells you exactly what is wrong...

Ralf

dnasty54

  • Guest
Re: helpppp plz! ive had some help just need alil more lol
« Reply #7 on: October 01, 2014, 05:27:28 AM »
i still dont dont know what its talking about ralf!!! if i did i wouldnt be post everywhere trying to figure it out

Offline DMac

  • Member
  • *
  • Posts: 272
Re: helpppp plz! ive had some help just need alil more lol
« Reply #8 on: October 01, 2014, 06:47:50 AM »
One of the problems that I see based on the code hastily and recklessly re-posted (without code tags I might add)  is that you did not get enough errors.  That code should have given you many more errors than it did. :'(

Now as for these few simple errors, let's think about what the compiler is telling us.
Quote
C:\Users\student\Documents\monthly car payment.c(47): error #2001: Syntax error; found 'monthly_car_payment' expecting ';'.

We look at line 47 and we see that the first symbol is 'monthly_car_payment' but the compiler is telling us that it was expecting to see a semicolon, something that is used to indicate the end of a statement.  looking at what comes before the monthly_car_payment I see a comment and another line....

Oh ho -- what's this?  shur nuff t' linz missin' uh semicolon.  Lol guess t' compiler wuz smarter dan I thought it wuz. :D

Seriously, use the clues that the errors give you and after a few of these assignments, it will become obvious to you what is wrong and you won't even have to think about it, you'll just fix 'em quicker than you can reply to a text.
« Last Edit: October 01, 2014, 06:49:58 AM by DMac »
No one cares how much you know,
until they know how much you care.

Offline Bitbeisser

  • Global Moderator
  • Member
  • *****
  • Posts: 772
Re: helpppp plz! ive had some help just need alil more lol
« Reply #9 on: October 01, 2014, 09:42:11 PM »
i still dont dont know what its talking about ralf!!! if i did i wouldnt be post everywhere trying to figure it out
The error message tells you that it is expecting a ";" while parsing the code and when you look at the line just before the one that is listed in the error message, you will (should) see that you did not properly terminate the preceding line of code with a semicolon. The same with the next line as well as after the return (0) statement...

Seriously, the compiler gives you all the answers, you just have to read them. The same also goes for using differently named or totally undeclared variables all over the place.

Ralf
« Last Edit: October 01, 2014, 09:45:50 PM by Bitbeisser »