| | |
hi 2 all the programmers and programmers 2 be
Thread Solved |
•
•
Join Date: Jun 2009
Posts: 14
Reputation:
Solved Threads: 0
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,,,,,,,
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,,,,,,,
•
•
Join Date: Jun 2009
Posts: 14
Reputation:
Solved Threads: 0
@ 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
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
•
•
Join Date: Jun 2009
Posts: 14
Reputation:
Solved Threads: 0
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;
}
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;
}
![]() |
Similar Threads
- programmers and designers for $900/month (Post your Resume)
- scanf discussion (C)
- Web Based IDE -Beta Invitation (IT Professionals' Lounge)
- Web programmers making more then software programmers? (IT Professionals' Lounge)
- Coolest programming language? (IT Professionals' Lounge)
- Is My Understanding of C++ OO features correct? (C++)
- Your Valuable Opinion Needed - Thank You (C++)
Other Threads in the Community Introductions Forum
- Previous Thread: hi, everybody.
- Next Thread: Hie Guys
| Thread Tools | Search this Thread |
" "delete adsense aladar amatueurgrapicdesigner beginner business c# c#picturebox c++ champlain college contentwriting copywriter correspondence dba deleterectangle dheeraj experiences forensic forum givemetehcodez helloall internet internetmarketing introduction introductory itservices jauhari java lahore.civilengineer market marketing mca multiplerectangle naveen newbie newcomernote newgirl nigeria noob note oil online peertopeervideostreaming pekdi pictureboxselectobject prankerio profanitytest programmer projects research seo seoservices share shiva..... sqlserver stillnew student suthar tester traffic typhoon waliya'sgratituteandrequest. web webcam webdesign welcomenote wllu wolf wordpresstheme





