Tuesday, April 17, 2012

::::|| VU ||:::: CS 201 Assighments solution

#include<iostream.h>
main(){
// declaring variables to save data in the programe
int volType, amountOfFine, noOfDays;
char choice;

// Taking input from the user
a: cout<<"*****CHALLAN CALCULCULATION FOR TRAFFIC VOILATION ******** ";
cout<<"{Enter '1' for breaking traffic signal"<<endl;
cout<<"Enter '2' for over speeding"<<endl;
cout<<"Enter '3' for not wearing seat belt }"<<endl;
cout<<"Please Enter the Voilation Type (1,2 or 3) : ";
cin>>volType;

// cheking the validity of the input givn by the user
if(volType>3||volType<1)
{
cout<<volType<<" Is an Invalid Choice Please Enter a valid type of traffic violation : ";
goto a; }
if(volType==1)
{

amountOfFine=500;
}else if(volType==2)
{
amountOfFine=300;
}else if(volType==3)
{

amountOfFine=200;
}

// taking input from user
cout<<"Please Enter the No. Of Days till Challan : ";
cin>>noOfDays;
// After Calculating the Amount of fine giving feed back to the User
if(noOfDays<=10)
{

cout<<"The Total Amount of Challan ="<< amountOfFine<<endl;
}else if(noOfDays>10&&noOfDays<=30)
{

cout<<"The Total Amount of Challan ="<< amountOfFine+amountOfFine<<endl;
} else if(noOfDays>30)
{

cout<<"The Total Amount of Challan ="<< amountOfFine+amountOfFine+amountOfFine/2<<endl;
}
cout<<"N Do you want to mak another calculation! Press Y for yes and press N for No"<<endl;
cin>>choice;
// Lopeing back to the Next calculation on users choice
while (choice=='y'||choice=='Y')
{goto a;}
cout<< "Take Care Allah Hafiz"<< endl;
system("PAUSE");
}


--

     

Phr Yaad-e-Khuda Se Ghafil Iss Duniya Ki Hawass Mein

Iss Mukhtasir Si Zindgi Ka Ik Aor Din Beet Gaya...!!!

                <<<<<<<<<< sAd pAncHi >>>>>>>>>>


--
For study materials, past papers and assignments,
Join VU School at www.vuscool.com
 
Facebook Group link
http://www.facebook.com/groups/vuCoooL
 
CoooL Virtual University Students Google Group.
To post to this group, send email to coool_vu_students@googlegroups.com
 
home page
http://groups.google.com/group/coool_vu_students?hl=en

No comments:

Post a Comment