hi 2 all the programmers and programmers 2 be

Thread Solved

Join Date: Jun 2009
Posts: 14
Reputation: jessejamesjjr is an unknown quantity at this point 
Solved Threads: 0
jessejamesjjr jessejamesjjr is offline Offline
Newbie Poster

hi 2 all the programmers and programmers 2 be

 
0
  #1
Jun 21st, 2009
hey all, am a student of the University of Trinidad and Tobago. Am doing Computer Engineering - programming dip-bsc then masters- major in cryptgy...
any hows. am fascinated bout programming. if theres a code i have to write, i wouldnt 4 a sec leavt it until i get it to run...
i really love programming also i like to do web page design...

well i really came on here to be a part of the programmers forum- taughts and to share ideas....
i am seeking a greater help and understanding in programming -
C++ and java and netbeans...
so i hope to start interacting with u guys soon,,,,,,,
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 14
Reputation: jessejamesjjr is an unknown quantity at this point 
Solved Threads: 0
jessejamesjjr jessejamesjjr is offline Offline
Newbie Poster

Re: hi 2 all the programmers and programmers 2 be

 
0
  #2
Jun 21st, 2009
@ d moment, am doing sum reading up on "SWITCHES" and am not sure if am doing the code properly.. so i could share the problem and share my code with u guys.. i wood love to
and if u can suggest any help i wwo greatly appreaciate it....
thanks

Write a program to solve the following problem. DO NOT USE AN IF-ELSE CASCADE.

Calculate the fine to be paid on a speeding ticket. If the automobile speed is less than 50 km/hr, there is no fine. If the speed is between 50 and 60 km/hr, the fine is $15. If the speed is between 60 and 70 km/hr, the fine is $30. If the speed is between 70 and 80 km/hr, the fine is $60. Finally, if the speed is over 80 km/hr, the fine is $150.
Print out the speed and the fine, or the words “no fine” if there is no fine


my codes....
#include <iostream.h>
#include <stdlib.h>
#include <stdio.h>

int main(int nNumbersofArgs,char*pszArgs[])
{
int speed;
int Letter;
int a, b, c, d, e;

cout<<"Enter the speed of the automobile"<<endl;
cin>>speed;

cout<<"The following are speeds that are categorized"<<endl<<endl;
cout<<"a = speed is <50 Km/hr"<<endl;
cout<<"b = speed is >50 and <=60 Km/hr"<<endl;
cout<<"c = speed is >60 and <=70 Km/hr"<<endl;
cout<<"d = speed is >70 and <=80 Km/hr"<<endl;
cout<<"e = speed is >80 Km/hr"<<endl<<endl;

a = speed <50;
b = speed >50 && speed <=60;
c = speed >60 && speed <=70;
d = speed >70 && speed <80;
e = speed >80;

cout<<"Enter the Letter of the category that the speed of the automobile is in; ";
cin>>Letter;

switch (speed)
{
case 'A': case 'a':
cout<<"Speed is " ;
cout<<speed;
cout<< " Km/hr and there is No Fine"<<endl;
break;
case 'B': case 'b':
cout<<"Speed is " ;
cout<<speed;
cout<< " Km/hr and the Fine is $15.00 "<<endl;
break;
case 'C': case 'c':
cout<<"Speed is " ;
cout<<speed;
cout<< " Km/hr and the Fine is $30.00"<<endl;
break;
case 'D': case 'd':
cout<<"Speed is " ;
cout<<speed;
cout<< " Kn/hr and the Fine is $60.00"<<endl;
break;
case 'E': case 'e':
cout<<"Speed is " ;
cout<<speed;
cout<< " Km/hr and the Fine is $150.00"<<endl;
break;
defalt:
cout<<"Invalid Speed";
cout<<endl;
}

system("PAUSE");
return 0;
}

any suggestions as to wats wrong?? cause am not sure if am doing the SWITCH correct!!!!! thanks in advance
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 18
Reputation: certficationmx is an unknown quantity at this point 
Solved Threads: 0
certficationmx certficationmx is offline Offline
Newbie Poster

Re: hi 2 all the programmers and programmers 2 be

 
0
  #3
Jun 21st, 2009
I will study first the codes you have given, I can't post a relevant reply for now. I will just post it later.
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 14
Reputation: jessejamesjjr is an unknown quantity at this point 
Solved Threads: 0
jessejamesjjr jessejamesjjr is offline Offline
Newbie Poster

Re: hi 2 all the programmers and programmers 2 be

 
0
  #4
Jun 21st, 2009
ok thanks alot look 4ward to ur help cause am still reading but am not sure if am doing the switch correct!!
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 14
Reputation: jessejamesjjr is an unknown quantity at this point 
Solved Threads: 0
jessejamesjjr jessejamesjjr is offline Offline
Newbie Poster

Re: hi 2 all the programmers and programmers 2 be

 
0
  #5
Jun 22nd, 2009
hey guys thanks alot 4 ur time i figured it out....
i was jus missing out main (void)
so heres d code now and it works corectly...

#include <iostream.h>
#include <stdlib.h>
#include <stdio.h>

int main(void)
{
int speed;
char Letter;
int a, b, c, d, e;

cout<<"Enter the speed of the automobile"<<endl;
cin>>speed;

cout<<"The following are speeds that are categorized"<<endl<<endl;
cout<<"a = speed is <50 Km/hr"<<endl;
cout<<"b = speed is >50 and <=60 Km/hr"<<endl;
cout<<"c = speed is >60 and <=70 Km/hr"<<endl;
cout<<"d = speed is >70 and <=80 Km/hr"<<endl;
cout<<"e = speed is >80 Km/hr"<<endl<<endl;

a = speed <50;
b = speed >50 && speed <=60;
c = speed >60 && speed <=70;
d = speed >70 && speed <80;
e = speed >80;


cout<<"Enter the Letter of the category that the speed of the automobile is in; ";
cin>>Letter;

switch (Letter)
{

case 'A': case 'a':
cout<<"Speed is " ;
cout<<speed;
cout<< " Km/hr and there is No Fine"<<endl;
break;
case 'B': case 'b':
cout<<"Speed is " ;
cout<<speed;
cout<< " Km/hr and the Fine is $15.00 "<<endl;
break;
case 'C':case 'c':
cout<<"Speed is " ;
cout<<speed;
cout<< " Km/hr and the Fine is $30.00"<<endl;
break;
case 'D': case'd':
cout<<"Speed is " ;
cout<<speed;
cout<< " Km/hr and the Fine is $60.00"<<endl;
break;
case 'E': case 'e':
cout<<"Speed is " ;
cout<<speed;
cout<< " Km/hr and the Fine is $150.00"<<endl;
break;
}

system("PAUSE");
return 0;
}
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Community Introductions Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC